2012-09-15 157 views
2

我正在開發一個應用程序,需要流式傳輸在vimeo網站上傳的視頻。當我從我的一項活動中啓動webview時,vimeo網站會成功加載到webview上,但問題從這裏開始。當我點擊播放圖標時,它不會進一步移動。加載的vimeo視頻頁面不會播放視頻。無法在WebView上從視頻流式傳輸視頻

我試圖檢查它是否是Android本身的問題,但證明是錯誤的。如果我單獨將網址複製到Android瀏覽器並播放,則播放成功。這是我無能爲力的地方,無論我在配置的WebView中的任何東西中缺少什麼。

我在這裏的代碼:

private void getWebPage(final String webpage, final String param2, String param3) { 
    // TODO Auto-generated method stub 

    final FrameLayout.LayoutParams ZOOM_PARAMS = 
      new FrameLayout.LayoutParams(
      ViewGroup.LayoutParams.WRAP_CONTENT, 
      ViewGroup.LayoutParams.WRAP_CONTENT, 
      Gravity.BOTTOM); 
      final Activity activity = this; 
      getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON); 
      mWebView = (WebView) findViewById(R.id.webview); 


      mWebView.setWebChromeClient(new WebChromeClient() { 
      public void onProgressChanged(WebView view, int progress) { 

      activity.setTitle(" Loading the content for... "+param2); 
      activity.setProgress(progress * 100);//Make the bar disappear after URL is loaded 

      // Return the app name after finish loading 
      if(progress == 100) 
       // activity.setTitle(R.string.app_name); 
       activity.setTitle("You are now viewing "+param2); 

      } 
     }); 

     mWebView.setWebViewClient(new WebViewClient()); 
     mWebView.getSettings().setJavaScriptEnabled(true); 
     mWebView.getSettings().setAppCacheEnabled(true); 
     mWebView.getSettings().setDomStorageEnabled(true); 
     mWebView.getSettings().setPluginState(WebSettings.PluginState.ON_DEMAND); 
     mWebView.getSettings().setLoadWithOverviewMode(true); 

     FrameLayout mContentView = (FrameLayout) getWindow(). 
     getDecorView().findViewById(android.R.id.content); 

     mWebView.loadUrl(webpage); 
    //Intent newIntent = new Intent(Intent.ACTION_VIEW).setData(Uri.parse("http://vimeo.com/m/45057923")); 
    /*Intent newIntent = new Intent(Intent.ACTION_VIEW).setData(Uri.parse(webpage)); 
    startActivity(newIntent);*/ 

} 

回答

-1

它與

mWebView.getSettings().setPluginsEnabled(true); 
+0

我已經試過這一個,但它不會 – Bytecode

+0

是的,它didn't..and它棄用。請參閱更新的語法mWebView.getSettings()。setPluginState(WebSettings.PluginState.ON); – kittu