I've implemented RTSP on Android MediaPlayer using VLC as rtsp server with this code:
# vlc -vvv /home/marco/Videos/pippo.mp4 --sout
#rtp{dst=192.168.100.246,port=6024-6025,sdp=rtsp://192.168.100.243:8080/test.sdp}
and on the Android project:
Uri videoUri = Uri.parse("rtsp://192.168.100.242:8080/test.sdp");
videoView.setVideoURI(videoUri);
videoView.start();
This works fine but if I'd like also to play live stream RTP so I copied the sdp file into the sdcard (/mnt/sdcard/test.sdp) and setting vlc:
# vlc -vvv /home/marco/Videos/pippo.mp4 --sout
#rtp{dst=192.168.100.249,port=6024-6025}
I tried to play the stream RTP setting the path of the sdp file locally:
Uri videoUri = Uri.parse("/mnt/sdcard/test.sdp");
videoView.setVideoURI(videoUri);
videoView.start();
But I got an error:
D/MediaPlayer( 9616): Couldn't open file on client side, trying server side
W/MediaPlayer( 9616): info/warning (1, 26)
I/MediaPlayer( 9616): Info (1,26)
E/PlayerDriver( 76): Command PLAYER_INIT completed with an error or info PVMFFailure
E/MediaPlayer( 9616): error (1, -1)
E/MediaPlayer( 9616): Error (1,-1)
D/VideoView( 9616): Error: 1,-1
Does anyone know where's the problem? I'm I wrong or it's not possible to play RTP on MediaPlayer? Cheers Giorgio
I have a partial solution for you.
I'm currently working on a Ra&D project involving RTP streaming of medias from a server to Android clients.
By doing this work, I contribute to my own library called smpte2022lib you may find here : http://sourceforge.net/projects/smpte-2022lib/.
Helped with such library (the Java implementation is currently the best one) you may be able to parse RTP multicast streams coming from professional streaming equipements, VLC RTP sessions, ...
I already tested it successfully with streams coming from captured profesionnal RTP streams with SMPTE-2022 2D-FEC or with simple streams generated with VLC.
Unfortunately I cannot put a code-snippet here as the project using it is actually under copyright, but I ensure you you can use it simply by parsing UDP streams helped with RtpPacket constructor.
If the packets are valid RTP packets (the bytes) they will be decoded as such.
At this moment of time, I wrap the call to RtpPacket's constructor to a thread that actually stores the decoded payload as a media file. Then I will call the VideoView with this file as parameter.
Crossing fingers ;-)
Kind Regards,
David Fischer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With