I have a rtsp url from Wowza Media Server 2 Perpetual 2.2.4.07
How can I play it in app?
Asked
Active
Viewed 2,241 times
4

CompEng
- 7,161
- 16
- 68
- 122
2 Answers
3
This is how you start a media player with a data source. Keep in mind that android only supports certain audo/video codecs listed here.
MediaPlayer m = new MediaPlayer();
m.setDataSource("rtsp://rtsp.yourserver.com/stream.mp3");
m.prepare();
m.start();

jsb
- 329
- 1
- 11
-
put in a video to setDataSource and it will play a video... – jsb May 31 '12 at 19:14
-
no it doesnt . thanks for answering – CompEng May 31 '12 at 19:16
-
Then your video isn't in the correct format. look http://developer.android.com/reference/android/media/MediaPlayer.html it says "MediaPlayer class can be used to control playback of audio/video files and streams" So I would suggest re-encoding the video to H.264 – jsb May 31 '12 at 19:20
1
Alternatively you can use a VideoView
videoView.setVideoURI(Uri.parse("rtsp://server/track.mpg"));

Emmanuel Sys
- 817
- 6
- 12
-
I try this it opens but 1 minute later it closed and when look at logs says me : output eos has been reached – CompEng May 31 '12 at 18:54
-
-
It gives me error : path = null 11-30 17:36:08.335: D/MediaPlayer(7009): Couldn't open file on client side, trying server side 11-30 17:36:08.335: E/MediaPlayer(7009): error (1, -2147483648) 11-30 17:36:08.380: E/MediaPlayer(7009): Error (1,-2147483648) – SweetWisher ツ Nov 30 '13 at 12:06