[whatwg] AudioTrack enabling - missing behaviour in the specification

Aleksander Wabik awabik at opera.com
Tue Dec 18 04:39:20 PST 2012


Current AudioTrack spec says:

"The AudioTrack.enabled attribute, on getting, must return true if the  
track is currently enabled, and false otherwise. On setting, it must  
enable the track if the new value is true, and disable it otherwise. (If  
the track is no longer in an AudioTrackList object, then the track being  
enabled or disabled has no effect beyond changing the value of the  
attribute on the AudioTrack object.)"

and (non-normative section):

"audioTrack . enabled [ = value ]
Returns true if the given track is active, and false otherwise.
Can be set, to change whether the track is enabled or not. If multiple  
audio tracks are enabled simultaneously, they are mixed."

This leaves us no place for disabling tracks by the player. Tracks can  
only be enabled by the web application, and when enabling multiple audio  
tracks at once, they all have to be played. The specification does not  
define in any way what should happen when there are not sufficient  
resources to enable all requested tracks, and it's especially important on  
embedded systems ([smart]phones, TVs, etc).

The spec says only:

"User agents may impose implementation-specific limits on otherwise  
unconstrained inputs, e.g. to prevent denial of service attacks, to guard  
against running out of memory, or to work around platform-specific  

This is unfortunately not enough. The spec should require a certain  
behavior when running out of audio tracks, so that we don't end up with  
one browser enabling the newest track while another browser rejects the  
newest track, for instance.

To me the most natural behaviour would be to always enable the track which  
was requested to enable and, if needed, disable the least recently enabled  
track. I'd add something like this to AudioTrack.enabled attribute  

"If the track is enabled and there exist other tracks enabled at that  
time, but the user agent has insufficient resources to play all of them  
mixed, the user agent must disable one or more of the previously enabled  
audio tracks and must queue a task to fire a simple event named change at  
the AudioTrackList object."

best regards,

Aleksander Wabik
Opera Software

More information about the whatwg mailing list