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.
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
Do the following to block HTML5 video autoplay in the browser:
- Type about:config in the browser's address bar and hit enter.
- Confirm that you will be careful if the notification comes up.
- Use the search at the top to find the preference media.autoplay.enabled.
- 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.