4

I have a list of video links where some are http:// and some are rtsp://.

So, I created a method that invokes the native view in android to play the video. it works well with http but it is failing for the rtsp. Actually, It is giving me an error that is not helping either knowing that rtps is a supported media format (http://developer.android.com/guide/appendix/media-formats.html)

String url = (String) v.getTag();
            Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
            Uri data = Uri.parse(url);
            intent.setDataAndType(data, "video/*");
            startActivity(intent);

Any ideas?

3
  • can post sample value for url
    – Sush
    Jan 3, 2014 at 18:46
  • the url is dynamic since it is live stream. So, It might not be reachable once the stream is done.
    – Sam
    Jan 3, 2014 at 18:47
  • @Martin Cazares is right. Even i faced the same issue.
    – Sush
    Jan 3, 2014 at 18:49

2 Answers 2

1

RTSP is a communication protocol extremely affected by firewalls, the fact that http works fine and rtsp is not, means that your firewall might be blocking that content and the rtsp feed you are getting might be configured to use UDP, in order to make sure that you are getting the rtsp data properly you should change your router configuration to not block that info, remember that rtsp can use UDP or TCP as transport layers and gets affected by the security system accordingly.

Hope this helps.

Regards!

3
  • Well, I am getting this error: No Activity found to handle Intent { act=android.intent.action.VIEW dat=rtsp://XXXX/live/4fbd1d3c_0777_4eb1_08d0_d6cb8c68bf4b_20140103_134805 typ=video/ }* I changed the host name to XXX. This tells me that It is not recognizing rtsp as a valid protocol
    – Sam
    Jan 3, 2014 at 18:55
  • Yes, that means you are not getting the data, there's two ways you can fix that 1.- If you have access to the Media Server configuration, you can force it to use TCP transport protocol or 2.- Lower your security settings to allow UDP content Jan 3, 2014 at 18:57
  • Thanks Martin. I'll talk to sys admin now. Hope it works. I'll keep you updated.
    – Sam
    Jan 3, 2014 at 19:00
0

try this code :

    VideoView videoView = (VideoView) findViewById(R.id.videoView1);
    MediaController mediaController = new MediaController(this);
    mediaController.setAnchorView(videoView);
    mediaController.setMediaPlayer(videoView);

    Uri video = Uri.parse("your_RTSP_link");
    videoView.setMediaController(mediaController);
    videoView.setVideoURI(video);
    videoView.start();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.