第一次做android开发 , 有这么个需求: 在android上跑了一个webServer ,然后 打包 上传了一些web的页面,其中有的页面带有mp4文建 然后在webview 中访问这个webServer,浏览web页面。 普通页面都可以看,包括图片啥的都正常显示了,但是带有mp4的页面不显示,请问是什么原因,
android的webView支持看mp4文件吗?还是需要设置什么参数?
android的webView支持看mp4文件吗?还是需要设置什么参数?
解决方案 »
- error: Error retrieving parent for item: No resource found that matches the give
- android launcher2 sd卡操作问题
- 新手级问题
- 关于android中的数据库问题
- 为什么eclipse没有任何提示就关闭
- android surfaceview如何锁定长宽比
- 给actionBar添加tab有两种 一种是固定的 一种是滚动的 问下滚动的是怎么添加的
- 拍照得到的onPictureTaken怎么得到原始数据?
- Android开发中判断网络链接的问题
- Android开发中点击一张图片出现另一张图片,并且出现的图片停留在原图片的前面
- sqlite 如何及时从sqlserver 获取数据
- 请过来人支招
也是要装播放器的
浏览器没有自带播放器的播放flash,swf应该可以
@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.
//自己写播放器,如何通过start~
}