HTML5 video.play returning Pending promises
<p>I'm trying to determine whether the browser supports autoplay on load.</p>

<p>I'm using the following code, and it works fine on Android chrome, but for Desktop Chrome none of the lines in .catch or .then get executed. The promise seems to just return Pending promises ad infinitum.</p>

<p>Is this an actual Chrome bug or am I not understanding how Promises work here?</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const promise = document.createElement('video').play();

if (promise instanceof Promise) {
 promise.catch((error) =&gt; {
  // Check if it is the right error
  if (error.name === 'NotAllowedError') {
   autoPlayAllowed = false;
  } else {
   throw error;
  }
 }).then(() =&gt; {
  if (autoPlayAllowed) {
   // Autoplay is allowed - continue with initialization
   console.log('autoplay allowed')
  } else {
   // Autoplay is not allowed - wait for the user to trigger the play button manually
   console.log('autoplay NOT allowed')
  }
 });

} else {
 // Unknown if allowed
 console.log('autoplay unknown')
}</code></pre>
</div>
</div>
</p>

<p>Thanks!</p>