0

I'm trying to play an RTSP url in my android app, using the following code:

String url = "rtsp://mobilestr1.livestream.com/livestreamiphone/nyc";
                    Uri uri = Uri.parse(url);
                    System.out.println("URL="+url);
                    startActivity(new Intent(Intent.ACTION_VIEW, uri));

However an alert dialog pops up after a few seconds saying "Unable to play video". I have tried several RTSP urls and none of them work. What am I doing wrong?

Thanks

user1417302
  • 411
  • 3
  • 9
  • 22

2 Answers2

1

That stream is h264 MPEG-4 AVC Part 10. Which doesnt work on most android devices. This page has a list of what does work. But essentially you need an MPEG-4 Baseline stream.

http://developer.android.com/guide/appendix/media-formats.html#recommendations

If you open the stream in VLC and then : Window > Media Information > Codec Details you can verify this info as well

petey
  • 16,914
  • 6
  • 65
  • 97
1

Try the below code. It works for me. Don't forget to add internet permission in your manifest.

private void rtspStream(String rtspUrl) {
    mVideoView.setVideoURI(Uri.parse(rtspUrl));
    mVideoView.requestFocus();
    mVideoView.start();
}
VIVEK CHOUDHARY
  • 468
  • 5
  • 8