I’m working on a HTML5 video player automation(test page is a html page). I tried to call
Failed to execute ‘play’ on ‘HTMLMediaElement’: API can only be
initiated by a user gesture.
after sending a
autoplay is disabled on lots of devices on purpose to save users bandwidth. But the first time
Play() seems also needed the user gesture. What is the workaround for this so that I can automate testing for the player device?
You can disable this security function. For example:
WebView mWebView = (WebView) findViewById(R.id.web_view); mWebView.getSettings().setMediaPlaybackRequiresUserGesture(false);
Available in API versions 17 and above