2 min read

While clicking on a link or opening a new browser tab, sometimes, audible video or audio starts playing automatically which is a distraction for many users. Mozilla is trying to solve this problem by introducing an autoplay blocking feature in Firefox 66 for desktop and Android. Firefox 66, expected to roll out on 19th March 2019, will now block audible audio and video by default.

Lately, Mozilla has been working towards blocking all auto-playing content. Last year, Mozilla announced that Firefox will no longer allow auto-playing audio in order to cut down on annoying advertisements. Microsoft’s Edge, Google’s Chrome and, Apple’s Safari browser also have taken steps in order to limit auto-playing media.

Firefox 66 will allow a site to play audio or video aloud only via the HTMLMediaElement API, once a web page has some kind of user interaction (such as mouse click on the play button) to initiate the audio. In this case, any playback that happens before the user has interacted with a page via a mouse click, printable key press, or touch event, will be counted as autoplay and will be blocked if it is audible. Firefox expresses a blocked play() call to JavaScript by rejecting HTMLMediaElement.play() with a NotAllowedError. This is how most browsers function to express a block.

Muted autoplay is still allowed as the script can set the “muted” attribute on HTMLMediaElement to true, and autoplay will work. The existing block autoplay implementation in Android and desktop will be replaced with this new feature.

According to Mozilla’s official blog post, “In general, the advice for web authors when calling HTMLMediaElement.play(), is to not assume that calls to play() will always succeed, and to always handle the promise returned by play() being rejected.”

Users can still opt out of this blocker, for sites that they don’t mind playing media by default. There will be an icon which will pop up in the URL bar to indicate that auto-playing media has been blocked, and clicking on it will bring up a menu that will allow users to change the settings. In order to avoid having the audible playback blocked, website owners should only play media inside a click or keyboard event handler, or on mobile in a touchend event.

Firefox 66 will also automatically allow autoplaying video on sites that the user has granted access to their cameras and microphones. Since these sites are typically for video conferencing, it would make sense allow if they work uninterrupted.

Mozilla is also working on blocking autoplay for Web Audio content, but have not yet finalized the implementation. The autoplay Web Audio content blocking is expected to be shipped some time this year.

Read Next

Mozilla releases Firefox 65 with support for AV1, enhanced tracking protection, and more!

Firefox now comes with a Facebook Container extension to prevent Facebook from tracking user’s web activity

Mozilla disables the by default Adobe Flash plugin support in Firefox Nightly 69

 


Subscribe to the weekly Packt Hub newsletter. We'll send you the results of our AI Now Survey, featuring data and insights from across the tech landscape.