The Firefox web browser will soon block autoplaying media on webpages visited in the web browser more reliable.
Mozilla added options to control HMTL5 video autoplay in 2015 in Firefox and while the functionality worked fine on many sites, it did not work on others.
Work began to improve the functionality, fix bugs and issues. Firefox may soon block autoplaying media with sound by default in the browser similarly to how Google Chrome handles this.
Mozilla Firefox will block autoplaying media in background tabs if the tabs have never been activated by the user. Autoplaying media may be blocked even if the tab is the active one, e.g. when autoplay is disabled in the preferences or if the media is audible and the user has not interacted with the tab.
Firefox will display a prompt to the user in the user interface by default when autoplay is blocked to allow playback. Keeping “Remember this decision” checked will store the user preference for the site to whitelist (allow) or blacklist (don’t allow) it.
A new setting was added to the Firefox preferences in Firefox Nightly currently that gives users options to set default autoplay behavior and manage the list of exceptions.
- Load about:preferences#privacy in the browser’s address bar and scroll down to the Permissions section.
- Locate “For websites that autoplay sound” under Permissions.
- Set the default autoplay behavior to “allow autoplay”, “always ask”, or “don’t autoplay”.
- Select Exceptions and add sites the whitelist or blocklist to allow them to autoplay media with sound or deny them the right.
New Autoplay Preferences in Firefox
Mozilla added several new preferences to Firefox that determine autoplay blocking rules in the browser. Note that these are included as of Firefox 63 but that the functionality won’t make it into Firefox 63 Stable. The earliest stable release is Firefox 64 but that depends on a number of factors.
- media.autoplay.default — Defines Autoplay behavior of the browser. Default value is 2.
- Value of 0: Autoplay allowed.
- Value of 1: Autoplay blocked.
- Value of 2: Prompt the user.
- media.autoplay.ask-permission — Defines whether prompts to ask the user for permission to play media set to autoplay (with sound). Default is True.
- Value of True: Prompt is displayed in the user interface.
- Value of False: The Prompt is not displayed.
- media.autoplay.enabled.user-gestures-needed — Defines whether user interaction with a page with autoplaying media with sound is required. Default is True.
- Value of True: The user needs to have interacted with the page.
- Value of False: Interaction is not a requirement.
- media.autoplay.allow-muted — Defines whether autoplay of media without sound or sound muted is allowed. Default is true.
- Value of True: Autoplay of muted media and media without sound is allowed.
- Value of False: Autoplay of muted media or media without sound is not allowed.
- media.autoplay.block-webaudio — Defines whether autoplay should block webaudio as well. Default is set to false.
- Value of True: Webaudio is blocked as well.
- Value of False: Webaudio is not blocked.
Note: The preference media.autoplay.enabled is not listed anymore and it seems to have been removed as of Firefox 63. If you set it and right-click on it to reset it, you will notice that it is removed automatically on restart; that’s a clear indicator that the preference is no longer supported.
The current implementation blocks audible audio and video in Firefox on the desktop and on mobile but won’t block WebAudio at this time. Plans are underway to add WebAudio blocking in future releases.
When the change goes live, Firefox will block autoplaying media in tabs that did not have user interaction by default. Firefox users can change the behavior using the preference listed above to better address specific needs.
Interested users and developers can follow the development here.
Now You: How do you handle autoplaying media?
Ghacks needs you. You can find out how to support us here or support the site directly by becoming a Patreon. Thank you for being a Ghacks reader. The post Firefox gets improved autoplay blocking soon appeared first on gHacks Technology News.