W3C home > Mailing lists > Public > public-html-a11y@w3.org > January 2011

Re: Media: Question about autoplay (video in browsers)

From: Philip Jägenstedt <philipj@opera.com>
Date: Thu, 27 Jan 2011 23:17:49 +0100
To: "Jim Allan" <jimallan@tsbvi.edu>, "Eric Carlson" <eric.carlson@apple.com>
Cc: david.bolter@gmail.com, "Charles McCathieNevile" <chaals@opera.com>, "Sean Hayes" <Sean.Hayes@microsoft.com>, "WAI-UA list" <w3c-wai-ua@w3.org>, "HTML Accessibility Task Force" <public-html-a11y@w3.org>
Message-ID: <op.vpzmvzqssr6mfa@nog>
On Thu, 27 Jan 2011 23:12:43 +0100, Eric Carlson <eric.carlson@apple.com>  

> On Jan 27, 2011, at 12:06 PM, Eric Carlson wrote:
>> On Jan 27, 2011, at 10:39 AM, Philip Jägenstedt wrote:
>>> Short answer: Yes, it's possible.
>>> I've recently added a user preference to Opera to disable autoplay,  
>>> and this should be in a not too distant release of our desktop  
>>> browser. If it turns out that it's common with sites that use script  
>>> to force autoplay, then it's possible to go further. Specifically, one  
>>> could use the same techniques that are used for pop-up blockers to see  
>>> if the play() request was from user interaction or a background  
>>> script. If isn't from direct user interaction, one could ask the user  
>>> to explicitly allow the media to play, perhaps remembering the choice  
>>> for the site.
>>> However, this kind of thing would be an opt-in setting, since we don't  
>>> want to bother users with lots of dialogs by default.
>>  iOS devices have this restriction - playback of a <video> or <audio>  
>> element can only be triggered in response to a user gesture (like  
>> pop-up blockers). This has caused no end of bug reports because it is  
>> impossible to differentiate script originated "auto play" from playback  
>> triggered by a script after a delay, eg.
>> 	onclick= "setTimeout(function(){ video.play() }, 200)"
>> or in response to another event, eg. to start playback after something  
>> else happens:
>> 	button.addEventListener('webkitAnimationEnd', function (){ video.play)  
>> }, false);
>>  Neither of these is a much of an edge case as you might think, I get  
>> bug reports all the time about web sites where <video> "doesn't work on  
>> the iPhone" because they use script to trigger playback.
>   I meant to add that one real danger with this kind of change is that  
> many (most?) developers won't test with the setting enabled, so audio  
> and video on their pages won't just not auto-play - it won't play at all.
> eric

Indeed, this is another reason why we wouldn't want to make that behavior  
the default. A solution that might perhaps be less prone to breaking sites  
would be to just do what the spec calls "paused for user interaction",  
which would fire a waiting event and behave similarly to a network stall.

Philip Jägenstedt
Core Developer
Opera Software
Received on Thursday, 27 January 2011 22:19:47 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:05:17 UTC