문제

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?

도움이 되었습니까?

해결책

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!

다른 팁

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();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top