Android VideoView无法播放某些网址

时间:2016-12-01 16:53:23

标签: android android-videoview

String LINK = "my_url";
VideoView mVideoView  = (VideoView) findViewById(R.id.videoview);
MediaController mc = new MediaController(this);
mc.setAnchorView(videoView);
mc.setMediaPlayer(videoView);
Uri video = Uri.parse(LINK);
mVideoView.setMediaController(mc);
mVideoView.setVideoURI(video);
mVideoView.start();

http://benzeen.mn/media/a3638788-4a9f-4832-8861-cb9bae1b39e9/7c5961e5-a1bf-4f28-9aeb-2f70a0e79444.mp4”。此视频网址未播放VideoView。 Web浏览器可以成功播放此视频。我写了上面的代码。我也尝试使用(WebView),但无法加载视频。

2 个答案:

答案 0 :(得分:1)

inputView

答案 1 :(得分:0)

Try this code
        WebView view = (WebView) findViewById(R.id.webView1);
        view.setWebViewClient(new WebViewClient());
        view.getSettings().setJavaScriptEnabled(true);
        view.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
        view.getSettings().setPluginState(WebSettings.PluginState.ON);
        view.getSettings().setMediaPlaybackRequiresUserGesture(false);
        view.setWebChromeClient(new WebChromeClient());
        view.loadUrl("web_url");