Closed Bug 1395171 Opened 7 years ago Closed 7 years ago

When media.autoplay.enabled is set to false, HTML5 video can't be started with JavaScript

Categories

(Core :: Audio/Video: Playback, defect, P3)

defect

Tracking

()

RESOLVED INVALID

People

(Reporter: mivasi, Unassigned)

References

Details

Even if about:config isn't intended to be used by 'classic' users, toggling this preference is advised on SUMO when somebody wants to disable autoplay. However when you set this preference to false, it's impossible to start the video by JavaScript, which breaks a lot of sites, for example Vimeo. But when you start the video using native controls and then try to pause/play it using JS, it works. Example: https://jsfiddle.net/efw4avL4/ JS tries to play the video 5 seconds after page is loaded. If you do nothing, the play promise is rejected, if you play and stop the video within 5 seconds from page load, the play promise is resolved and everything works properly.
Component: General → Audio/Video: Playback
Product: Firefox → Core
Priority: -- → P3
Same problem with the Audio class. If you want to play a sound using HTML5 Audio with JavaScript, it doesn't work at all if media.autoplay.enabled is false.
This pref is used to stop any play() invocation from script, the rejected promise [1] is intended. [1] http://searchfox.org/mozilla-central/rev/b52285fffc13f36eca6b47de735d4e4403b3859e/dom/html/HTMLMediaElement.cpp#4014
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.