第一次做android开发 , 有这么个需求: 在android上跑了一个webServer ,然后 打包 上传了一些web的页面,其中有的页面带有mp4文建 然后在webview 中访问这个webServer,浏览web页面。 普通页面都可以看,包括图片啥的都正常显示了,但是带有mp4的页面不显示,请问是什么原因, 
android的webView支持看mp4文件吗?还是需要设置什么参数? 

解决方案 »

  1.   

    在电脑上看网页上的MP4
    也是要装播放器的
    浏览器没有自带播放器的播放flash,swf应该可以
      

  2.   

    我直接搜的不知道可不可以解决,貌似还要获取链接,自己解码。You need to override the shouldOverrideUrlLoading method of your webViewCient...final class MyWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            if (url.endsWith(".mp4") {
                Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(url));
                view.getContext().startActivity(intent);
                return true;
            } else {
                return super.shouldOverrideUrlLoading(view, url);
            }
        }
    }... that you assign to your webview:WebViewClient webViewClient = new MyWebViewClient();
    webView.setWebViewClient(webViewClient);Edit: also important that you add:webView.getSettings().setAllowFileAccess(true);to allow file downloads/streams such as mp4 files.
      

  3.   

    if (url.endsWith(".mp4") {
                //自己写播放器,如何通过start~
            }
      

  4.   

    android中如何用本地播放器播放webview中的非flash视频???求大虾指导!本人QQ1018478512,欢迎android开发者交流!