Home >Web Front-end >JS Tutorial >How to Fix the \'Uncaught (in promise) DOMException: play() failed...\' Error in Chrome 66 on Desktop?
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" >
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!