android - Can not play video through webView -
people, tell me, try play video on url in webview, not play on devices, on working, @ not. use simple code:
webviewshow = (webview)findviewbyid(r.id.webview); string linkshow = getintent().getextras().getstring(param_link_show); webviewshow.getsettings().setjavascriptenabled(true); webviewshow.getsettings().setmediaplaybackrequiresusergesture(false); webviewshow.loadurl(linkshow);
we note not working, can not played, , through regular browser.
i added android:hardwareaccelerated="true" in androidmanifest
make sure add android:hardwareaccelerated="true"
app in manifest.
how play video url inside android webview
in answer show:
webview webview = (webview) findviewbyid(r.id.webview1); webview.setwebviewclient(new webviewclient()); webview.getsettings().setjavascriptenabled(true); webview.getsettings().setjavascriptcanopenwindowsautomatically(true); webview.getsettings().setpluginstate(websettings.pluginstate.on); webview.setwebchromeclient(new webchromeclient()); webview.loadurl("https://www.youtube.com");
and in manifest:
<application android:allowbackup="true" android:hardwareaccelerated="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name=".mainactivity" 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>
Comments
Post a Comment