play() failed because the user didn't interact with the document first - on click event using Vimeo API

froggomad picture froggomad · Feb 14, 2019 · Viewed 18.5k times · Source

I'm assuming an onclick event counts as interacting with the document, so not sure why an autoplay error is being thrown

Uncaught (in promise) NotAllowedError: play() failed because the user didn't interact with the document first.

Answer

froggomad picture froggomad · Feb 14, 2019

I was missing allow="autoplay" in iframe's attributes

<iframe id="video-player" class="video" width="560" height="315" src="https://player.vimeo.com/video/309741585" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen allow="autoplay"></iframe>