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

Silvia Pfeiffer silviapfeiffer1 at gmail.com
Mon May 31 15:40:49 PDT 2010


On Tue, Jun 1, 2010 at 6:48 AM, bjartur <svartman95 at gmail.com> wrote:
>>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.

I am not aware of a CSS property for media elements that lets you
control the muted state. Can you link me to a specification?


>>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.

Are you saying that a Web author needs to edit the media resource in
order to change the default volume setting for the resource? I think
that's a bit of a stretch. Also, if you have a pointer to how this can
be done in CSS, that would be highly appreciated.

Thanks,
Silvia.



More information about the whatwg mailing list