Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught (in Promise) DOMException: play() can only be initiated by a user gesture

I'm seeing the follow error in our HTML 5 JavaScript video player implementation, only on Android + Chrome Mobile:

Uncaught (in promise) DOMException: play() can only be initiated by a user gesture

What is the cause of this error and what is the right way to avoid it going forward?

like image 400
cjcamisa Avatar asked Nov 08 '22 13:11

cjcamisa


1 Answers

If you are using a webview this will work.

webviewSettings.setMediaPlaybackRequiresUserGesture(false);
like image 101
Aparna Avatar answered Nov 14 '22 21:11

Aparna