• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Auto play video in webview

aprateek

Lurker
I am displaying a youtube link in a webview. I want to autoplay the link.
Problem is that, After opening a link i have to click on video then video is playing but i want that video should be play automatically.

Thanks in Advance.

My Code :
-------------------------------------------------------------------------------------------------------------------
myWebView.setWebViewClient(new WebViewClient() {
@override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
view.loadUrl(request.getUrl().toString());
return true;
}
}
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.getSettings().setMediaPlaybackRequiresUserGesture(false);

myWebView.loadUrl("
");
-------------------------------------------------------------------------------------------------------------------

Tested on Devices :
1) Amlogic Android Media Boxes(Android 6.0.1) -> Not working.
2) Nexus 5 (Android 6.0) -> Working.
 
Back
Top Bottom