How to stream video in android device via .sdp fil

2020-07-18 04:09发布

问题:

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.