- Forum posts: 1
Sep 11, 2018, 10:21:49 AM via Website
Sep 11, 2018 10:21:49 AM via Website
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({Any youtube video url link});
Tested on Devices :
1) Amlogic Android Media Boxes(Android 6.0.1) -> Not working.
2) Nexus 5 (Android 6.0) -> Working.
Recommended editorial content
With your consent, external content is loaded here.
By clicking on the button above, you agree that external content may be displayed to you. Personal data may be transmitted to third-party providers in the process. You can find more information about this in our Privacy Policy.