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

On Thu, 27 Jan 2011 17:56:07 +0100, Jim Allan <jimallan@tsbvi.edu> wrote:

> Gentlemen,
>
> The UAWG was discussing how to override autoplay in the browser in
> response to a topic in HTML-A11Y telecon [1] last week
>
> We have a success criteria:
> 2.9.2 Time-Based Media Load-Only:
> The user can load time-based media content such that the first frame
> is displayed (if video), but the content is not played until explicit
> user request. (Level A)
>
> Essentially, autoplay is off, until the user activates 'play'
>
> The question is, a user agent has implemented the ability to turn off
> autoplay (as required by UAAG20), but if a script implements autoplay
> directly, whose responsibility is it to make sure that autoplay
> doesn't happen?
>
> Greg Lowney suggested that whether autoplay is enabled or disabled in
> browser, user preferences should be made programmatically available to
> scripts as well as extensions and plug-ins, so that they can follow
> the user preference.
>
> Is this possible? If possible, will it ever be done?
>
> Jim Allan asked if the browser could simply refuse to play media when
> a script attempts to start it on load. This is assuming that the
> browser plays the video natively, and the script calls a UA function
> that starts the video. But, Greg's not sure that the user agent can
> distinguish scripted autostart from attempts to start the media in
> response to some explicit user request.
>
> Providing a way for the script to follow the browser's user preference
> settings also has the benefit of (if implemented correctly) stopping
> autoplay when done using media other than the HTML5 native media (e.g.
> flash).
>
> Are our assumptions/musings correct? Please enlighten us as to how
> this really works in a user agent.
>
> 1. http://www.w3.org/2011/01/19-html-a11y-minutes.html
>

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.

-- 
Philip Jägenstedt
Core Developer
Opera Software

Received on Thursday, 27 January 2011 18:41:47 UTC