DOMException: play() can only be initiated by a user gesture
This might help.
webView.getSettings().setMediaPlaybackRequiresUserGesture(false);
This probably has to do with the trusted security model. Certain operations are only allowed if they're initiated by the user. This is for instance how a lot of popup blockers work. Likewise Chrome may want to protect users against auto-playing videos.
Make sure you call videoElement.play()
in an event handler that is associated to a gesture.
// this should be ok
videoElement.addEventListener("click", function () {
videoElement.play();
});
// this is not ok
setTimeout(function () {
videoElement.play();
});
Since your function is called in navigator.getUserMedia
it would seem strange to ask for user input again. Have you tried using autoplay
on the video
element?