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

Re: [media] adding autoplay requirements to requirements doc

From: Philip Jägenstedt <philipj@opera.com>
Date: Tue, 19 Apr 2011 12:58:57 +0200
To: "Silvia Pfeiffer" <silviapfeiffer1@gmail.com>
Cc: public-html-a11y@w3.org
Message-ID: <op.vt6l4jk5sr6mfa@localhost.localdomain>
On Tue, 19 Apr 2011 12:00:38 +0200, Silvia Pfeiffer  
<silviapfeiffer1@gmail.com> wrote:

> On Tue, Apr 19, 2011 at 6:29 PM, Philip Jägenstedt <philipj@opera.com>  
> wrote:
>> Possible solutions here are:
>> 1. Requiring explicit approval for all media playback, with the  
>> possibility
>> of remembering approval per domain.
>> 2. Exposing a list of all media elements associated with a document to
>> scripts so that extensions could find and pause all media elements.
>> Currently this is not possible because elements can be created by  
>> scripts
>> and set to play without being inserted into a document, so e.g.
>> document.querySelector('audio,video') does not find them.
> These are both good ideas. Would it be possible to get them through
> plugins? Or do they need a JS API?

I think the first really needs to be a browser feature to be effective,  
similar to pop-up blockers. Extensions could emulate it to some extent,  
but could not create a UI to list all of the blocked sites, for example.

The second should be possible using scripts, but it takes some effort to  
intercept everything that could possibly create new media element. For  
createElement, one would have to do something like this:

(function() {
   var cE = document.createElement;
   document.createElement = function() {
     var elm = cE.apply(document, arguments);
     if (elm instanceof HTMLMediaElement) {
       /* keep track of this element */
     return elm;

Similar things would have to be done to innerHTML, outerHTML and any other  
properties that can create new elements.

A very serious downside of this approach is that just by keeping track of  
the elements, they can never be garbage collected, so all media elements  
would be kept alive as long as the creating document is alive. (ECMAScript  
doesn't have weak references.)

In summary, this is something best done as a browser feature.

Philip Jägenstedt
Core Developer
Opera Software
Received on Tuesday, 19 April 2011 10:59:27 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:55:54 UTC