Auto play video in webview in Amlogic Media Boxes.

  • Replies:1
  • OpenNot stickiedUnanswered
  • Forum posts: 1

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() {
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
return true;

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.

  • Forum posts: 28

Sep 11, 2018, 2:40:34 PM via Website

you may try using js

        // autoplay when finished loading via javascript injection
        public void onPageFinished(WebView view, String url) { webview.loadUrl("javascript: ( function() { document.getElementsByTagName('video')[0].play(); })()"); }
Recommended articles