Throw NotAllowedError when autoplay fails on iOS / android low power modes #1107
aslamhus
started this conversation in
Feature requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there, first time posting here! I hope this feature request is clear.
The problem:
Currently, I can't find a way to handle autoplay failing when a mobile device is in low power / data saving mode. In situations where autoplay is blocked, programatically playing the Vimeo embed will throw a
NotAllowedError, which can be handled with some UI response to let the user know they need to press play again. But, there is no error or callback provided when an autoplay fails on low power mode. The player just stays stuck in a loading state.To reproduce, turn your low power mode on and try this fiddle
*Disclaimer: I have only tested this on iOS. I have not tested the data saving mode on Android.
Solutions I have tried:
Checking the paused status when the player is ready
I've tried checking the pause status of a player a half second after it's ready. The problem with this approach is that the video will remain paused until it has finished buffering – and there's no way to reliably know how long a video may take to buffer. Check the pause status too early and you might assume the video has failed to autoplay when it is actually just about to play. In this case, if you were to instruct the user to click play again you'd get a "play interrupted" error which can pause playback unnecessarily.
Detecting low power mode
Unfortunately, we can't detect whether the current device is in low power mode (on iOS, at least), as javascript's BatteryManager doesn't have cross browser support.
Feature suggestion:
Throw a NotAllowedError when autoplay fails on low power mode.
P.S. I love Vimeo's player.js! Thank you for all your work.
Beta Was this translation helpful? Give feedback.
All reactions