2014-03-19 145 views
1

爲什麼我不能正常播放該網站的視頻。我正在嘗試Webview。什麼時候在VideoView,視頻的作品,但不是我所需要的(沒有滾動條)。所以我試着用WebView。此代碼顯示我的視頻,但不播放它。當我插入一個鏈接到我需要的網站時,我看到一個白色屏幕。也在電話上測試過。在manifest.xml我給了互聯網許可。真的需要WebView的一些幫助

wv = (WebView) findViewById(R.id.webView); 
     wv.setWebChromeClient(new WebChromeClient()); 
     wv.getSettings().setAllowFileAccess(true); 
     wv.getSettings().setJavaScriptEnabled(true); 
     wv.getSettings().setPluginState(WebSettings.PluginState.ON); 
     wv.setWebViewClient(new WebViewClient()); 
     wv.setBackgroundColor(0x00000000); 
     wv.getSettings().setBuiltInZoomControls(true); 
     String html = "<iframe width='420' height='345' src='http://m.ochepyatki.ru/video.php?vkey=be38112&f=11395221100' frameborder='0' allowfullscreen></iframe>"; 
     wv.loadDataWithBaseURL(null, html, "text/html", "UTF-8", null); 



<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
      package="com.example.MyParserIP" 
      android:versionCode="1" 
      android:versionName="1.0"> 
    <uses-sdk android:minSdkVersion="12"/> 
    <uses-permission android:name="android.permission.INTERNET"/> 
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> 
    <application android:label="@string/app_name" android:icon="@drawable/ic_launcher" android:hardwareAccelerated="true"> 
     <activity android:name="MyActivity" 
        android:label="@string/app_name"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN"/> 
       <category android:name="android.intent.category.LAUNCHER"/> 
      </intent-filter> 
     </activity> 
    </application> 
</manifest> 

不起作用

回答

1

可以檢查您在應用程序代碼新增

android:hardwareAccelerated="true"機器人Manifest.xml。如果你沒有添加,那麼在android manifest.xml中添加這個。

您可以在活動中執行此操作。

if(Build.VERSION.SDK_INT >= 11) 
     webview.setLayerType(View.LAYER_TYPE_SOFTWARE, null);