Vasanth
Vasanth

Reputation: 39

Video auto play without muted

How to handle “Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first.” on Desktop with Chrome 66? my code is

<video
    title="Advertisement"
    style="background-color: rgb(0, 0, 0); position: absolute; width: 640px; height: 360px;"
    src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
    autoplay="true"
    muted="muted"></video>

It should work without muted.

Upvotes: 3

Views: 375

Answers (1)

John M.
John M.

Reputation: 307

It is working in the sandbox. https://codesandbox.io/s/wonderful-blackburn-wrple?file=/src/App.js

It's generally bad practice to play a video with sound on page load as it's often unwanted by the user, unless they are on a video centric site or are expecting a video to play.

Upvotes: 1

Related Questions