2012-08-23 60 views
1

在网页里面我尝试打开下面的html,它可以工作。正如你可以看到它包含一个视频列表。当我在浏览器中打开它们时,所有这些视频都能很好地工作,但我无法从我的设备上打开它们。 Practically they don't play!!!! 这是我的网页....每个项目是一个视频的链接... here is my image http://i48.tinypic.com/nl66vm.png无法在webView内播放视频

后,我点击的这个项目我来到这里之一,这是视频......但它只是没有按”不玩。

重要即使我点击它,无论我做什么,视频都不会播放......它只是不会播放。 here is my image http://i47.tinypic.com/2cs728o.png

这里是我的代码:

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); 
     } 
    } 
} 

重要的视频浏览器的内部工作。任何人都可以给我一个解决方案,以便我的视频播放?谢谢

+0

我米面临同样的问题,如果你解决它然后PLZ分享它。 –

回答

0

请考虑使用WebChromeClient来代替。

private class HelloWebViewClient extends WebChromeClient { 
    //Code here 
} 
+0

好吧,让我试试 – adrian

+0

对不起,我编辑了答案 –

+0

这没有帮助。 WebChromeClient与WebViewClient一起用于显示进度更新! – adrian