【发布时间】:2012-08-18 19:59:46
【问题描述】:
在网页中,我尝试打开以下 html 并且它可以工作。如您所见,它包含一个视频列表。当我在浏览器中打开这些视频时,所有这些视频都能完美运行,但我无法从我的设备打开它们。 Practically they don't play!!!!
这是我的网页......每个项目都是一个视频链接......
单击其中一项后,我来到这里,这是视频……但它只是无法播放。
重要提示即使我点击视频也无法播放,无论我做什么......它就是无法播放。
这是我的代码:
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
// ToDo add your GUI initialization code here
setContentView(R.layout.second);
WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView.setWebViewClient(new HelloWebViewClient());
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.getSettings().setAllowFileAccess(true);
myWebView.getSettings().setPluginsEnabled(true);
myWebView.loadUrl("Here is set the link");
}
private class HelloWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (Uri.parse(url).getHost().equals("Here is set the link")) {
// This is my web site, so do not override; let my WebView load the page
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
intent.setDataAndType(Uri.parse(url), "video/*");
view.getContext().startActivity(intent);
return true;
}
else{
return super.shouldOverrideUrlLoading(view, url);
}
}
}
重要提示视频可在浏览器中运行。任何人都可以给我一个解决方案以播放我的视频吗?谢谢
【问题讨论】:
-
如果你解决了我也面临同样的问题,然后请分享。