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

RESOLVED INVALID

Status

()

P3
normal
RESOLVED INVALID
a year ago
a year ago

People

(Reporter: MekliCZ, Unassigned)

Tracking

(Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

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.

Updated

a year ago
Component: General → Audio/Video: Playback
Product: Firefox → Core
Blocks: 1376321
Priority: -- → P3

Comment 1

a year ago
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
Last Resolved: a year ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.