2012-08-23 152 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