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


To make the autoplay on html 5 elements work after the chrome 66 update you just need to add the muted property to the video element.

So your current video HTML

    style="background-color: rgb(0, 0, 0); position: absolute; width: 640px; height: 360px;"

Just needs muted="muted"

    style="background-color: rgb(0, 0, 0); position: absolute; width: 640px; height: 360px;"

I believe the chrome 66 update is trying to stop tabs creating random noise on the users tabs. That's why the muted property make the autoplay work again.

  1. Open chrome://flags/#autoplay-policy
  2. Setting No user gesture is required
  3. Relaunch Chrome

The best solution i found out is to mute the video


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

Answering the question at hand...
No it's not enough to have these attributes, to be able to autoplay a media with audio you need to have an user-gesture registered on your document.

But, this limitation is very weak: if you did receive this user-gesture on the parent document, and your video got loaded from an iframe, then you could play it...

So take for instance this fiddle, which is only

<video src="myvidwithsound.webm" autoplay=""></video>

At first load, and if you don't click anywhere, it will not run, because we don't have any event registered yet.
But once you click the "Run" button, then the parent document ( did receive an user-gesture, and now the video plays, even though it is technically loaded in a different document.

But the following snippet, since it requires you to actually click the Run code snippet button, will autoplay.

<video src="" autoplay=""></video>

This means that your ad was probably able to play because you did provide an user-gesture to the main page.

Now, note that Safari and Mobile Chrome have stricter rules than that, and will require you to actually trigger at least once the play() method programmatically on the <video> or <audio> element from the user-event handler itself.

btn.onclick = e => {
  // mark our MediaElement as user-approved>vid.pause());
  // now we can do whatever we want at any time with this MediaElement
  setTimeout(()=>, 3000);
<button id="btn">play in 3s</button>
  src="" id="vid"></video>

And if you don't need the audio, then simply don't attach it to your media, a video with only a video track is also allowed to autoplay, and will reduce your user's bandwidth usage.

Try to use mousemove event lisentner

var audio = document.createElement("AUDIO")
audio.src = "./audio/rain.m4a"

document.body.addEventListener("mousemove", function () {

For me (in Angular project) this code helped:

In HTML you should add autoplay muted


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


If this technique does not work any more - there is another option. You can include a short and very quiet (-60db) audio and play it inside the click handler of the hidden button. After that, all other audio/video files will be allowed to play without a direct user interaction. You can take a silent audio from and cut it to half a second (or less).

There is a very easy solution - just add a BUTTON to your page, style it to be invisible and then call method before the play()

Runs like a charm in Chromium Version 70.0.3538.67 (Official Build) (64-bit)

var btn = document.getElementById('btn');

function myPlay()
    title="Advertisement" id="movie"
    style="background-color: rgb(0, 0, 0); position: absolute; width: 640px; height: 360px;"
    <button type="button" style="z-index:-1;opacity:0;position: absolute;left:-1000px;" id="btn"></button>

I had some issues playing on Android Phone. After few tries I found out that when Data Saver is on there is no auto play:

There is no autoplay if Data Saver mode is enabled. If Data Saver mode is enabled, autoplay is disabled in Media settings.


Chrome needs a user interaction for the video to be autoplayed or played via js ( But the interaction can be of any kind, in any moment. If you just click random on the page, the video will autoplay. I resolved then, adding a button (only on chrome browsers) that says "enable video autoplay". The button does nothing, but just clicking it, is the required user interaction for any further video.

I encountered a similar error with while attempting to play an audio file. At first, it was working, then it stopped working when I started using ChangeDetector's markForCheck method in the same function to trigger a re-render when a promise resolves (I had an issue with view rendering).

When I changed the markForCheck to detectChanges it started working again. I really can't explain what happened, I just thought of dropping this here, perhaps it would help someone.

Extend the DOM Element, Handle the Error, and Degrade Gracefully

Below I use the prototype function to wrap the native DOM play function, grab its promise, and then degrade to a play button if the browser throws an exception. This extension addresses the shortcoming of the browser and is plug-n-play in any page with knowledge of the target element(s).

// JavaScript
// Wrap the native DOM audio element play function and handle any autoplay errors = (function(play) {
return function () {
  var audio = this,
      args = arguments,
      promise = play.apply(audio, args);
  if (promise !== undefined) {
    promise.catch(_ => {
      // Autoplay was prevented. This is optional, but add a button to start playing.
      var el = document.createElement("button");
      el.innerHTML = "Play";
      el.addEventListener("click", function(){play.apply(audio, args);});
      this.parentNode.insertBefore(el, this.nextSibling)

// Try automatically playing our audio via script. This would normally trigger and error.

<!-- HTML -->
<audio id="MyAudioElement" autoplay>
  <source src="" type="audio/ogg">
  <source src="" type="audio/mpeg">
  Your browser does not support the audio element.

You should have added muted attribute inside your videoElement for your code work as expected. Look bellow ..

<video id="IPcamerastream" muted="muted" autoplay src="videoplayback%20(1).mp4" width="960" height="540"></video>

Don' t forget to add a valid video link as source

Type Chrome://flags in the address-bar

Search: Autoplay

Autoplay Policy

Policy used when deciding if audio or video is allowed to autoplay.

– Mac, Windows, Linux, Chrome OS, Android

Set this to "No user gesture is required"

Relaunch Chrome and you don't have to change any code