Some more notes on Firefox 63 and perhaps later media autoplay settings

August 5, 2018

A few months ago I wrote some notes on Firefox's current media autoplay settings, which described the then state of affairs of Firefox Nightly and Firefox (and I then followed it up by discovering that Firefox needed some degree of autoplay support). It's perhaps not surprising that Mozilla has kept evolving this (given the general publicity around how people are unhappy about auto-playing videos), so things have changed around a bit in Firefox Nightly and thus presumably in Firefox 63 and later (until they change again). The current state of affairs has fixed some of my irritations but not all of them, and Mozilla has now made things more accessible in general.

First, Firefox now exposes a preference for media autoplay, and can have per-site settings for it. You find this in Preference → Privacy & Security, down in the 'Permissions' section, in a new setting that is (in English) 'For websites that autoplay sound'. Your options are allow, ask (or 'prompt'), and deny, and you also have an 'Exceptions' list. This preference corresponds to the media.autoplay.default setting. If set to 'ask', ever time you visit a new site that wants to autoplay something Firefox will pop up a little note about it, and then remember whatever you answer. If you block a site (or block all sites), you can still start video autoplay by hand.

(The old media.autoplay.enabled setting is now no longer used by anything. Also, it turns out that surfacing the preferences stuff is controlled by the media.autoplay.ask-permission setting, which Firefox Nightly defaults to true. It's possible that this means that some of this won't be visible and enabled in Firefox 63, but you can turn it on manually.)

As before, Firefox defaults to auto-playing silent or muted video. However, you can now control this through a setting, media.autoplay.allow-muted. Because this is an un-exposed setting, the 'can I play this' questions from Firefox always refer to 'media with sound' even if the video in question is silent or muted. This can be a little bit confusing. Unlike before, Firefox now always allows autoplay for bare video content such as directly linked .mp4s (these appear to be called 'video documents'), regardless of your settings (although they seem to start playing only when you switch to their tab). This is hard-coded in IsMediaElementAllowedToPlay() in AutoplayPolicy.cpp. Since I don't like this behavior, I hope that Mozilla adds a setting that allows us to control it, as they have for silent and muted video.

(Conveniently, the code in AutoplayPolicy.cpp now has log messages to record why something was allowed to autoplay; these are very helpful in understanding the code itself. One of the interesting new cases this exposes is that apparently addons can always autoplay things on their own internal pages.)

There is also now a separate check and setting for audio. Based on the code, setting media.autoplay.block-webaudio to true will more or less completely block web audio, possibly without any user override at all. Probably you don't want to do this unless you never, ever want your Firefox to play web audio under any circumstances at all.

The new setting media.autoplay.block-event.enabled appears to control whether JavaScript gets some sort of 'your autoplay is blocked' error when the autoplay is blocked by your settings. Firefox defaults it to off and I would leave it that way; presumably Mozilla knows what they're doing here.

So, the short version of what you want to do on Firefox Nightly and likely Firefox 63 if you want as little autoplay as possible is now:

  • go to Preferences → Privacy & Security and the Permissions area, and set 'For websites that autoplay sound' to 'Don't Autoplay'. Equivalently, set media.autoplay.default to 1, but I'd use the Preferences version just to be slightly safer.
  • in about:config, set media.autoplay.allow-muted to false.

Other relevant settings are now already at the values that you want. In particular, media.autoplay.enabled.user-gestures-needed now defaults to true, and probably will get removed some day in the future.

Written on 05 August 2018.
« Why email is often not as good as modern communication protocols
Linux's /dev/disk/by-path names for disks change over time »

Page tools: View Source, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Sun Aug 5 23:08:19 2018
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.