我正在尝试在 android webview 中播放 youtube 视频。以下是我所做的事情
VideoWebview.java:
String URL = "http://www.youtube.com/results";
WebSettings settings = volWebview.getSettings();
settings.setPluginState(PluginState.ON);
settings.setJavaScriptEnabled(true);
volWebview.setWebViewClient(new WebViewClient());
volWebview.setInitialScale(1);
volWebview.setWebChromeClient(new WebChromeClient());
settings.setLoadWithOverviewMode(true);
settings.setUseWideViewPort(true);
volWebview.loadUrl(URL);
webview_file.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<WebView
android:id="@+id/web_webview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
我已添加android:hardwareAccelerated="true"
到清单文件
该网址正在加载..但是当尝试播放视频时,它没有播放。任何有关相同的帮助将不胜感激..谢谢..