Home > Web Front-end > JS Tutorial > How to Fix the \'Uncaught (in promise) DOMException: play() failed...\' Error in Chrome 66 on Desktop?

How to Fix the \'Uncaught (in promise) DOMException: play() failed...\' Error in Chrome 66 on Desktop?

Mary-Kate Olsen
Release: 2024-11-26 01:24:11
Original
989 people have browsed it

How to Fix the

Handling "Uncaught (in promise) DOMException: play() failed..." Error on Desktop with Chrome 66

Upon attempting to play videos on desktop using Chrome version 66, you may encounter an error message stating "Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first." This occurs due to Chrome's updated autoplay blocking policy.

While a solution may seem to lie in adding "webkit-playsinline="true", "playsinline="true", and "autoplay="" attributes to the

The proper solution is to include the "muted" property in the video element. By muting the video automatically, you meet Chrome's requirement for user interaction without compromising the user experience. Your updated video HTML should look like this:

<video
    title="Advertisement"
    webkit-playsinline="true"
    playsinline="true"
   >
Copy after login

By implementing this modification, you can successfully autoplay videos on desktop without triggering the aforementioned error message.

The above is the detailed content of How to Fix the \'Uncaught (in promise) DOMException: play() failed...\' Error in Chrome 66 on Desktop?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template