How to stream video in android device via .sdp file from android device

不羁的心 提交于 2019-12-06 05:36:51

问题


I had anapplication to stream video(without audio) from android device(Blaze board) to PC. For that, I'm using vlc player to view streamed video by using the following command in command line

vlc stream.sdp

This .sdp file would be generated from my application. By using the above command, I can stream from blaze board to PC with the delay of 1 sec.

Now, My problem is that, I have to stream from one blaze board to another blaze board. I have searched a lot. But, Nothing is worked.

I have an idea to write viewer application ( For client ). This application will use sdp file path as url. I refer this page. Here, he had used "setDataSource(http://localhost/file.sdp)" . I used like this in my application. But, it also, didn't work.

String videoSrc = "rtsp://192.168.13.77:8086/stream.sdp";

Here is my code

public void surfaceCreated(SurfaceHolder arg0) {
        try {
         mediaPlayer = new MediaPlayer();
            mediaPlayer.setDisplay(surfaceHolder);

   mediaPlayer.setDataSource(videoSrc);
   mediaPlayer.prepare();
   mediaPlayer.setOnPreparedListener(this);
   mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
  } catch (IllegalArgumentException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } catch (SecurityException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } catch (IllegalStateException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } catch (IOException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }
 }

How to use .sdp file to play streamed video lively?

Whether I am going is correct path or not? If you are having any other way, please suggest me.

Any help will be appreciated.

来源:https://stackoverflow.com/questions/20883247/how-to-stream-video-in-android-device-via-sdp-file-from-android-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!