close

[Fixed] Uncaught (in promise) DOMException: play() failed because the user didn’t interact with the document first

Today We are Going To Solve Uncaught (in promise) DOMException: play() failed because the user didn’t interact with the document first in javascript. Here we will Discuss All Possible Solutions and How this error Occurs So let’s get started with this Article.

How to Fix Uncaught (in promise) DOMException: play() failed because the user didn’t interact with the document first Error?

  1. How to Fix Uncaught (in promise) DOMException: play() failed because the user didn’t interact with the document first Error?

    To Fix Uncaught (in promise) DOMException: play() failed because the user didn’t interact with the document first Error just add autoplay muted in HTML. First of all You have to add autoplay muted in HTML And after it just try this: playVideo() { const media = this.videoplayer.nativeElement; media.muted = true; // without this line it's not working although I have "muted" in HTML media.play(); } By using this you will solve your error. I hope this will help you.

  2. Uncaught (in promise) DOMException: play() failed because the user didn’t interact with the document first

    To Fix Uncaught (in promise) DOMException: play() failed because the user didn’t interact with the document first Error just Mute the video. You have to just mute the video and it will solve itself. <video loop muted autoplay id="videomain"> <source src="videoname.mp4" type="video/mp4"> </video>

Solution 1 : add autoplay muted in HTML

First of all You have to add autoplay muted in HTML

And after it just try this:

playVideo() {
    const media = this.videoplayer.nativeElement;
    media.muted = true; // without this line it's not working although I have "muted" in HTML
    media.play();
}

By using this you will solve your error. I hope this will help you.

Solution 2 : Mute the video

You have to just mute the video and it will solve itself.

<video loop muted autoplay id="videomain">
  <source src="videoname.mp4" type="video/mp4">
</video>

Solution 3 : Follow this steps

First of all open your chrome and open chrome://settings/content/sound. Then go to the setting and set No user gesture is required. and after doing this just relaunch your chrome. It will remove your error completely. Thank you!

Conclusion

So these were all possible solutions to this error. I hope your error has been solved by this article. In the comments, tell us which solution worked? If you liked our article, please share it on your social media and comment on your suggestions. Thank you.

Also Read This Solutions

Leave a Comment