question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Play() promise should be rejected when Chrome does not allow autoplay

See original GitHub issue

The promise returned by vimeo’s play() should get rejected when Google chrome rejects the HTML5 video element’s play().

Currently Vimeo resolves its promise, but it should be rejected with error.

Example code: https://gist.github.com/nextend/245243c297abcdd75cdd3d58bacc4149

Chrome docs: https://developers.google.com/web/updates/2017/09/autoplay-policy-changes

var promise = document.querySelector('video').play();
if (promise !== undefined) {
  promise.then(_ => {
    // Autoplay started!
  }).catch(error => {
    // Autoplay was prevented.
    // Show a "Play" button so that user can start playback.
  });
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ThatGuySamcommented, Dec 11, 2018

Seems like that jsfiddle references a local domain vimeo.dev. Here’s a working version with the current live script. https://jsfiddle.net/thatguysam/4ombuyvL/

0reactions
luwescommented, Dec 11, 2018

This is added in the latest release. Please take a look at the below link to verify. https://jsfiddle.net/luwes/6cpzoqst/

Thanks for your patience.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML5 plugin fails to resolve/reject play-promise when in ...
When trying to run an ad in a player that uses your plugin in secure mode -- which returns a proxy object instead...
Read more >
HTML5 video.play returning Pending promises - Stack Overflow
The Chrome team have released a test page to check whether your own browser supports Promisified MediaElement.play() . If supported, the logging box...
Read more >
Autoplay policy in Chrome - Chrome Developers
When the permissions policy for autoplay is disabled, calls to play() without a user gesture will reject the promise with a NotAllowedError ...
Read more >
728294 - Please silence play() Promise errors - Monorail
Currently, only Firefox and Chrome return a Promise from play() [2]. This uncaught Promise error happens much less than it used to, but...
Read more >
Initial video play promise rejects in Chrome - Bugs - Babylon.js
When loading a scene with a video texture, a video.play() promise is rejected in Chrome due to their policy on autoplay (autoplay is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found