[whatwg] audio and video: volume and muted as content attributes?

>I just came across a curious situation in the spec: IIUC, it seems the
>@volume and @muted attributes are only IDL attributes and not content
>attributes. This means that an author who is creating an audio-visual
>Webpage has to use JavaScript to turn down (or up) the loudness of
>their media elements or mute them rather than just being able to
>specify this through content attributes.
>If you want to control the volume for the user after the page loads
>then yes, you'll need JavaScript.
>I've searched the archives and didn't find a discussion or reasons for
>this. Apologies if this has been discussed before.
>
>I am guessing the reasons for not having them as content attributes is
>that anything that requires muting of audio-visual content is assumed
to need JavaScript anyway.
Exactly.
>However, if I have multiple videos on a page, all on autoplay, it
>would be nice to turn off the sound of all of them without JavaScript.
>With all the new CSS3 functionality, I can, for example, build a
>spinning cube of video elements that are on autoplay or a marquee of
>videos on autoplay - all of which would require muting the videos to
>be bearable. If we added @muted to the content attributes, it would be
>easy to set the muted state without having to write any JavaScript.
If you need the audio to be muted you should use CSS. If you need to
control volume dynamically you need scripting.

>As for the @volume attribute, I think it would be similarly useful if
>an author could control the loudness at which a video or audio file
>starts playing back, in particular if he/she knows it is actually a
>fairly loud/quiet file.
Well, you have a point. That can be done by increasing the volume
of the soundtrack itself, metedata (like embedded volume metadata in
MPEG files) and should be possible in CSS. Adding it to HTML as well
seems redundant.

Received on Monday, 31 May 2010 13:48:59 UTC