Autoplay, go away!
By Bruce Lawsonbrucelawson. Friday, January 28, 2011 4:00:00 PM
HTML5 has an autoplay attribute on the audio and video elements. Ostensibly, this is a problem for those who work in shared offices and who aren’t expecting sound to blare out when following a link, and would be a huge problem for people who rely on sound for understanding the Web, such as those using a screenreader, because the sound in a video would drown out all other content on the page.
Paradoxically, however, this could be good for accessibility. Simon Pieters points out
Removing the attribute will not make pages stop autoplaying video. Instead they will use script to make videos autoplay, and then it becomes harder for the user to prevent videos from autoplaying. (You could have a pref in the UA to disable autoplay.)
The idea is that a simple attribute is easier to write than scripts that force autoplay, and therefore content providers will use it. It's also much easier to write user scripts that block the autoplay attribute. Until Opera has a "never autoplay media" option in the configuration settings (soon!), you may wish to use this tiny Opera Extension Autoplay, Go Away! by Daniel Davis, Philip Jägenstedt, Bruce Lawson and Simon Pieters.
Why so many authors? Because it wasn't completely simple to write. Originally, Bruce had written
var els = document.querySelectorAll('video, audio');
for (var i= els.length - 1; i >= 0; i--) {
els.removeAttribute('autoplay');
els.setAttribute('title', 'right-click to start media');
}
This simply loops through all media elements, removing the autoplay attribute if present, and adding an informative title. It worked perfectly on a test page in which linked to media stored locally, but failed on a test page that calls in media across the network.
Of all the HTML5 APIs, the media events are the subtlest and hardest to grasp to people not as brainy as Philip and Simon, with whom I consulted, who came up with the code that powers the extension:
window.addEventListener('loadstart', function(e)
{e.target.removeAttribute('autoplay') }, true);
which works pretty well on Mac and Linux, with some unduplicatable weirdnesses on Windows. It doesn't work for elements not in the document or for scripts that do play().
Anyway, please do any virus checking you feel you need to do (this isn't an official Opera extension) and download Autoplay, Go Away! beta 1.
And I'm available for freelance icon design, too.
Beta 2
I got some useful feedback from John Foliot who said
[the]title[attribute] is affected by the verbosity settings in screen readers, with the net result that for most power users of screen reader technology, the value oftitleis not read aloud more often than not …titleshould not be used to convey mission critical information, as many screen readers will miss it.
When planning how to do this, I had previously not used title, but instead had added the controls attribute but backed that out because it would disrupt the lovely design of someone's custom video player. But if they're so rude as to force autoplaying media, who cares about their design? So beta two dispenses with adding a title and adds controls instead.
Anyway, please do any virus checking you feel you need to do (this isn't an official Opera extension) and download Autoplay, Go Away! beta 2.

João EirasxErath # Friday, January 28, 2011 5:39:12 PM
b) like on demand plugins, there should be a very visible pref in the browser UI to disable auto-play of video, and to turn off sound.
Cutting Spoonhellspork # Friday, January 28, 2011 5:57:45 PM
Also I commend you for that awesome image in the sidebar of your blog.
Rafael Luikrafaelluik # Friday, January 28, 2011 7:50:46 PM
Originally posted by xErath:
Can't you see most people do want autoplay? It's great for 90% of people on YouTube... If they had to click play they'd become angry having to repeat the action of clicking play in every video.Robert MeijersRobert90 # Friday, January 28, 2011 8:04:35 PM
Originally posted by xErath:
"The idea is that a simple attribute is easier to write than scripts that force autoplay, and therefore content providers will use it. It's also much easier to write user scripts that block the autoplay attribute."
Originally posted by xErath:
"Until Opera has a "never autoplay media" option in the configuration settings (soon!)"
Both "answers" are quotes from Bruces articles. So if you had read the article carefully you didn't have to ask those questions
Laurentlsaplai # Saturday, January 29, 2011 6:43:46 AM
So thank you for providing this extension and for the upcoming option to disable Autoplay in the browser.
*check out: http://openmedia.ca/meter for more details
Cutting Spoonhellspork # Monday, January 31, 2011 6:41:08 PM
Originally posted by lsaplai:
I hear their law against prostitution was struck down by the court? Everybody's got their own priorities...
Martin RauscherHades32 # Tuesday, February 1, 2011 4:03:38 PM
While Philip and Simon's script might be cleverer, why not simply append a "els.stop()" (or whatever the call is named), in case the media did already start to buffer/play, to your script? Would "stop()" also stop the buffering?
Originally posted by hellspork:
It's more than obvious that you are an American
Bruce Lawsonbrucelawson # Thursday, February 3, 2011 11:32:46 AM
video.pause() sounds like a good idea. Will try it.
Jimtoyotabedzrock # Tuesday, February 15, 2011 9:55:19 PM