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

NEW
Unassigned

Status

()

Core
Audio/Video: Playback
P3
normal
2 months ago
2 days ago

People

(Reporter: Michal Vašíček (Mozilla.cz), Unassigned)

Tracking

(Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

2 months ago
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

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

Comment 1

17 days 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.
You need to log in before you can comment on or make changes to this bug.