使用VideoView在Android中播放RTSP mrl

时间:2017-10-06 12:24:55

标签: java android

我尝试播放RTSP链接但无法在Android中播放 视频观看。还尝试使用Media.None媒体流向他们工作,但它在iOS中流畅地流式传输。

videoView.setVideoURI(Uri.parse(liveURI));
videoView.requestFocus();
videoView.start();

1 个答案:

答案 0 :(得分:0)

String  videoRtspUrl=“rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov“;

private void playInVideoView() {
VideoView videoView = (VideoView) this.findViewById(R.id.videoView);
        videoView.setVideoPath(videoRtspUrl);
        videoView.requestFocus();
        videoView.start();
}

private void playInApp(){
if (videoRtspUrl.startsWith("rtsp://")) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(videoRtspUrl));
startActivity(intent);
}

同时检查互联网权限

<uses-permission android:name="android.permission.INTERNET" />