Reputation: 467
I want to play the video from live streaming as rtsp.Below is the code i am using to play the video
try {
String http_url="rtsp://live.wmncdn.net/jiljillive/bbb19eae240ec100af921d511efc86a0.sdp";
//String link = "http://qn.vc/files/data/2947/The%20Pappi%20-%20Heropanti%20-%20Feat%20Raftaar%20%5BMobMp4.Com%5D.mp4.mp4";
VideoView videoView = (VideoView) findViewById(R.id.videoView1);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
Uri video = Uri.parse(http_url);
videoView.setMediaController(mediaController);
videoView.setVideoURI(video);
videoView.start();
} catch (Exception e) {
// TODO: handle exception
Toast.makeText(this, "Error connecting", Toast.LENGTH_SHORT).show();
}
This code works fine in Android 4.x mobile devices.But it gives the error message as sorry cant play the video in Android 2.x mobiles
Please give me the solution for playing live video RTSP streaming in Android lower devices.
Upvotes: 2
Views: 3217
Reputation: 28484
yes you are right.
RTSP is support from 2.x but , sdp format is not supported by older android versions.
So what is the possible ways to support this?
If you have rights to access and modify RTSP server you can implement FFMPEG library that will convert the sdp format to mp3 which is widely accepted and also work with android 2.x devices.
If RTSP server is of third party and you do not have rights to modify it, you cant use FFMPEG library in you android project. But to use that you need to have enough knowledge of Android NDK.
Upvotes: 4
Reputation: 945
Try this
videoView.setVideoPath(http_url);
videoView.requestFocus();
And at the onPrepared(MediaPlayer mp)
method use:
@Override
public void onPrepared(MediaPlayer mp) {
mp.start();
}
Upvotes: 0