Finally: Mozilla adds working HTML5 Video autoplay blocking to Firefox

Martin Brinkmann
Jun 11, 2015
Firefox
|
40

I just wrote a tutorial on disabling auto-playing Flash and HTML5 videos in Firefox and Chrome in which I mentioned Firefox's media.autoplay.enabled preference to disable some -- but not all -- HTML5 videos from playing automatically.

The reason why this works only on some sites but not on others is because of how sites implement the player and play() calls. Sites may call play() directly without using autoplay, and if that is the case, they are not blocked by Firefox's current implementation of the feature as it only blocks videos if autoplay is explicitly used.

This is for instance the case on YouTube which you can test easily by setting the preference to false in Firefox before you play a video on YouTube afterwards. You will notice that the video plays automatically when you open the site.

At least, that is the case if you run a version of the browser prior to 41. If you run the latest Nightly build of the browser, you will notice that Mozilla fixed the issue.

Setting the preference to false and visiting YouTube afterwards will stop all videos from playing automatically on the site.

firefox stop autoplay videos

The bug listing, opened back in 2011 had to be reopened multiple times as Mozilla, for varying reasons, did not implement the change in the browser.

Work on it began just a couple of days ago and the final patch that resolves the issue landed for Firefox 41 versions quickly afterwards.

Firefox 41 is currently available in the Nightly channel. This means that Stable users will have to wait a couple of months before it lands in their version of the browser (it takes six weeks to move to a new version with the next update to version 39 being released on June 30, 2015).

Mozilla aims to release Firefox 41 on September 22 to the stable channel of the web browser.

Instructions to enable the blocking of HTML5 video in Firefox

firefox media autoplay enabled

Do the following to block HTML5 video autoplay in the browser:

  1. Type about:config in the browser's address bar and hit enter.
  2. Confirm that you will be careful if the notification comes up.
  3. Use the search at the top to find the preference media.autoplay.enabled.
  4. Double-click on it.

Doing so once sets the preference to false which turns autoplay off for HTML elements in Firefox. You can reverse that at any time by double-clicking again, or by right-clicking on the preference and selecting the reset option from the context menu.

Summary
Finally: Mozilla adds working HTML5 Video autoplay blocking to Firefox
Article Name
Finally: Mozilla adds working HTML5 Video autoplay blocking to Firefox
Description
Mozilla improved Firefox's blocking of HTML5 video autoplay in Firefox 41 to block auto-playing videos on all sites.
Author
Advertisement

Tutorials & Tips


Previous Post: «
Next Post: «

Comments

  1. Anonymouse said on July 20, 2018 at 1:09 pm
    Reply

    Nope. Doesn’t work. The blue autoplay next slider control is still there. Firefox 61.0.1. Tested on 20 July 2018.

  2. Ad beleagured said on July 12, 2018 at 10:46 pm
    Reply

    SWEET JESUS THANK YOU FOR THIS!!!!

    1. Anonymouse said on July 20, 2018 at 1:10 pm
      Reply

      Thanks for what, it doesn’t actually do anything.

  3. Truth said on August 22, 2017 at 5:38 am
    Reply

    Chrome and firefox are owned by google. google bought adblock. Google owns adsense.

    The problem is the browsers themselves. Don’t let wolves guard the chicken coop.

  4. Laura said on July 19, 2017 at 10:18 pm
    Reply

    If this suggestion works, I’ll be forever indebted to you.

  5. Li-An said on June 8, 2017 at 3:34 pm
    Reply

    The YouTubeâ„¢ No Buffer (Stop Auto-playing) plugin does a good job.

  6. Ed said on June 8, 2017 at 3:02 pm
    Reply

    This firefox autoplay setting works so poorly it’s unusable. Youtube videos won’t play unless you manually touch the video position slider, and other types of videos such as Vimeo won’t play at all.

  7. Anonymous said on December 1, 2016 at 6:43 pm
    Reply

    I used this for a couple of months, and finally removed it. I was more trouble than it’s worth. Youtube videos required clicking the start button multiple time to get the video to play. Vimeo vids would not play at all. I’d have to open them in a different browser. Maybe they’ll get the kinks worked out someday, but right now it’s too hinky to bother with.

  8. Anonymous said on July 4, 2016 at 4:11 pm
    Reply

    Did not work for me…already set to false, yet videos still autoplay…

  9. Shirou said on June 29, 2016 at 1:24 pm
    Reply

    This solution is sh as it breaks youtube player and it auto buffers but doesnt stop anything, clicking on the player or pause and then play button doesn’t play the video.

  10. Li-An said on May 18, 2016 at 10:40 am
    Reply

    The tip works for me FF46.01

    1. Laura said on July 19, 2017 at 10:21 pm
      Reply

      I’m using FF54.0.1. I pray this tip will also work for me.

  11. DiesLaughing said on October 5, 2015 at 12:02 am
    Reply

    The solution in the article doesn’t actually work. I opened Firefox and set medi.autoplay.enabled to false and it kept videos form autoplaying FOR THAT SESSION. When I closed and re-opened Firefox videos were autplaying again, even with the setting still at false. I double-checked to make sure I was running Firefox 41 and I am. Thanks Pete for your solution. It seems to work much better.

  12. Petar said on June 17, 2015 at 9:59 pm
    Reply

    Is the Firefox the first browser to implement this HTML5 blocking feature or is this also possible with other browsers?

  13. Inderjeet said on June 17, 2015 at 8:13 pm
    Reply

    They added this feature very late. Its a important thing for any browser user. I’m waiting for this update from many days. Anyways, thanks for informing Martin

  14. Dave said on June 12, 2015 at 12:08 pm
    Reply

    This feature of HTML5 caused me to go over my mobile data allowance for the first time now that it’s built into IE11 on Windows Phone. It’s awful. Shitty ads now play outloud wherever you are, meaning I’ve had to increase my data cap by £2 a month just to accommodate this new feature that I don’t want.

  15. Uhtred said on June 12, 2015 at 12:00 am
    Reply

    if you click outside of a loading element the right click context menu has a stop loading page icon, that should kill background loads, not an elegant solution but may be useful?

    (not sure if this left over from tinkering with former splitting reload and stop buttons on addressbar, which sadly no longer works in 38.0.5)

  16. ZzzZombi said on June 11, 2015 at 7:52 pm
    Reply

    I was just testing my custom stylish code for youtube and I had to search something. I searched “Taylor Swift” too. What is this?

    1. abcdef said on June 12, 2015 at 12:20 am
      Reply

      You and Mr. Martin are Swifties

  17. IgHive said on June 11, 2015 at 1:59 pm
    Reply

    Wow…4 years for this shitty solution.

    1. Dieu said on June 12, 2015 at 5:51 am
      Reply

      Yeah but they have to develop Pocket it’s lot more important to put resources on pocket than critical 4-5 years old… /S

  18. Jay-Z said on June 11, 2015 at 1:52 pm
    Reply

    Hey Martin,

    will you cover the new Thunderbird-Release? I think that’s the Version with Lightning-Integration. I would like to read your opinion as a Thunderbird-User on this step.

    1. Erick said on June 11, 2015 at 6:58 pm
      Reply

      There seems to be a lot of changes: https://www.mozilla.org/en-US/thunderbird/38.0.1/releasenotes/

      I like it :)

  19. not_black said on June 11, 2015 at 12:50 pm
    Reply

    Praise the lord.

  20. Dwight Stegall said on June 11, 2015 at 11:53 am
    Reply

    Chrome is disabling auto play on Flash ads. I bet some clever devil will find a way around it all before long.

  21. Pete said on June 11, 2015 at 11:38 am
    Reply

    Personally I don’t like this “solution” at all. The video still gets loaded. Some time ago when I was still using a flash blocking addon (then it stopped working and I moved to other better solution) it was the same thing, the flash video got loaded but paused. This caused some CPU & memory usage and flash plugin started an instance. I fear that the same resource hogging happens with this mozilla “pause solution”.

    1. John said on February 23, 2016 at 2:12 am
      Reply

      I’ve also discovered that turning this autoplay to false amkes google timer no longer produce audio. I use google timers all the time, so not a good solution for me.

    2. GunGunGun said on June 11, 2015 at 11:39 pm
      Reply

      You re right, the way web browser in generall like FIrefox, Chrome, Opera, all of them still load plugin then stop download, that way of implementing is bad because they still leak our IP.

      I’m using web filtering software to cover this problem, but I think only advanced user can do like me, override native javascript to achieve a better plugin blocking feature.

    3. AJ North said on June 11, 2015 at 7:38 pm
      Reply

      Greetings Pete,

      Does your “other better solution” prevent the plugin-container from being loaded, and if so, could you post your solution? I’ve got the Flash Control add-on installed (updated 2015.06.07), but the plugin-container still loads.

      Thanks,

      AJN

      1. Pete said on June 11, 2015 at 10:49 pm
        Reply

        http://jjacky.com/2013-10-24-restore-click-to-activate-per-element-in-firefox/

        1) Put flash plugin to “ask to activate”.
        2) Install “Click to Play per-element” addon: https://addons.mozilla.org/en-US/firefox/addon/click-to-play-per-element/
        3) Open about:config and set these to 0 (zero):
        plugin.persistentPermissionAlways.intervalInDays
        plugin.sessionPermissionNow.intervalInMinutes

        Optional:
        – plugins.hideMissingPluginsNotification;true
        – plugins.notifyMissingFlash;false
        – “Click to Play per-element” addon options -> “hide plugin notifications” enabled.

        Now firefox never “remembers” enabled flash for a site. Also you can activate individual plugins per page (otherwise all would be activated once you click one).

        Flash & plugin-container processes wont start until you click to activate an element.

    4. Guest said on June 11, 2015 at 7:19 pm
      Reply

      Who cares about CPU and memory? Generally you’re using less than 5% CPU, and less than 40% memory anyway. The real, highly critical issue is that it drains Internet bandwidth. As someone who has had a 5GB cap until very recently, this is an enormous cause for concern.

      Unrelated note, regarding the Firefox devs…
      Martin’s words here perfectly describe them. The bug is reported in 2011. It’s a fairly critical bug due to the bandwidth hogging it can cause (and still does! Clearly the idiots didn’t fix the bug properly) and it took them FOUR years to act on it. Once they did act on it, it was finished and implemented very quickly.

      So Mozilla, why the hell not implement it “very quickly” back in 2011? Yeah, they have this attitude about a lot of things; it makes me mad sometimes, and sad too, to see the potential of Firefox wasted in delays and stupid decisions.

      1. billy said on August 15, 2017 at 10:30 pm
        Reply

        Do you even know anything at all besides where your mom keeps the pizza rolls?

      2. Carol said on March 17, 2016 at 2:16 am
        Reply

        I very much care about CPU useage. Everything grinds to a halt while I wait for the video to load, then I have to turn it off after it starts playing. Pain. Stops productivity.

        What got me searching was those news sites. I go there for a specific story and most often I do not care to sit through a video, just want to read the article. And then it starts playing ANOTHER video on a DIFFERENT story that I don’t care about. I’m way down the page reading, now have to go to the top, stop it, go back and find my place again.

        I want the next video to NEVER play.

        P.S. YOUR computer is not the same as everyone else’s as to CPU resources.

      3. Joanna Wakesmith said on November 13, 2015 at 10:18 pm
        Reply

        Battery life, dear boy. The longer your CPU can stay idle, the longer your battery lasts.

      4. Pete said on June 14, 2015 at 12:56 pm
        Reply

        At first I was annoyed by the trolling, but now I just feel a bit sad for you.

      5. Guest said on June 13, 2015 at 5:29 pm
        Reply

        I’m trolling because I claim you have 2GB memory? Why are you whining about Firefox leaking then? Yes it may leak a bit, but things will improve with e10s, because when you close a process, it can release a lot more memory.

      6. Dave said on June 13, 2015 at 1:48 pm
        Reply

        A very small-minded response regarding computer resources.

      7. Pete said on June 13, 2015 at 11:27 am
        Reply

        Trolls just keep on trolling. Pathetic.

      8. Guest said on June 12, 2015 at 10:52 pm
        Reply

        @Pete – my Nightly is using 311MB atm, and 113MBx2 for plugin containers (multi process)

        Yeah time to upgrade from that 2GB memory entry-level laptop, eh? Or maybe just restart Firefox once a day like any normal person.

      9. Pete said on June 11, 2015 at 10:28 pm
        Reply

        Who cares? Well I do. You know why? Firefox is a memory leak deluxe already, do we need more things that could add to it?

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.