Closed Bug 1477477 Opened Last year Closed Last year

Add pref to disable autoplaying of muted/silent media

Categories

(Core :: Audio/Video: Playback, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: evilpie, Assigned: evilpie)

Details

Attachments

(1 file)

Some people want the old behavior, I think this might be enough to justify this pref. It does cause the permission prompt message to be wrong: "... media with sound"
Attachment #8993901 - Flags: review?(cpearce)
Oh btw, kind of weird how some media.autoplay prefs are in all.js and some in firefox.js.
Comment on attachment 8993901 [details] [diff] [review]
Add pref to block muted autoplay media

Review of attachment 8993901 [details] [diff] [review]:
-----------------------------------------------------------------

If you want the old behaviour, you may also want to search for "autoplay" in about:preferences and change the combobox from "ask" to "block", so that you're not prompted.

Please address the review comments before landing.

Note Chrome shipped with inaudible autoplay blocked on mobile by default, and the result was video ads switched to rendering to Canvas via video decoders implemented in JavaScript. Which caused severe battery drain on mobile. Which is why they stopped trying to block inaudible video, and why we don't either.

::: dom/media/AutoplayPolicy.cpp
@@ +116,4 @@
>  
>    // Muted content
>    if (aElement.Volume() == 0.0 || aElement.Muted()) {
> +    if (Preferences::GetBool("media.autoplay.muted", true)) {

Can you please make that:
if ((aElement.Volume() == 0.0 || aElement.Muted()) &&
    Preferences::GetBool("media.autoplay.allow-muted", true)) {
 //...

::: modules/libpref/init/all.js
@@ +570,5 @@
>  // By default, don't block WebAudio from playing automatically.
>  pref("media.autoplay.block-webaudio", false);
>  
> +// By default, don't block muted media from playing automatically.
> +pref("media.autoplay.muted", true);

Can you name this "media.autoplay.allow-muted", default true. Thanks.
Attachment #8993901 - Flags: review?(cpearce) → review+
(In reply to Tom Schuster [:evilpie] from comment #1)
> Oh btw, kind of weird how some media.autoplay prefs are in all.js and some
> in firefox.js.

The prefs that apply to both desktop & Fennec are in all.js.

The prefs that apply to desktop Firefox are in firefox.js.

The prefs that apply to Fennec are in mobile.js.
Awesome, thanks for the quick review.

> Note Chrome shipped with inaudible autoplay blocked on mobile by default,
> and the result was video ads switched to rendering to Canvas via video
> decoders implemented in JavaScript. Which caused severe battery drain on
> mobile. Which is why they stopped trying to block inaudible video, and why
> we don't either.

Interesting, I assumed we wanted to prevent people from being incentivized to use GIFs instead of videos.

media.autoplay.enabled.user-gestures-needed seems to be in all pref.js files.
Pushed by evilpies@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/e384aedb30b6
Add preference for autoplaying muted media. r=cpearce
https://hg.mozilla.org/mozilla-central/rev/e384aedb30b6
Status: NEW → RESOLVED
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.