[whatwg] audio and video: volume and muted as content attributes?
Silvia Pfeiffer
silviapfeiffer1 at gmail.com
Tue Jun 1 04:41:38 PDT 2010
On Tue, Jun 1, 2010 at 9:09 PM, Bjartur Thorlacius <svartman95 at gmail.com> wrote:
> On 5/31/10, Silvia Pfeiffer <silviapfeiffer1 at gmail.com> wrote:
>> 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?
>
> Well, http://www.w3.org/TR/CSS2/aural.html defines volume and
> play-during.
Interesting.
> Play-during can stop, autoplay and repeat sounds.
> It's not obvious to me how this will apply to elements that represent
> audiovisual content but volume: silent; unambiguously mutes content.
> Decorating audio (such as background music in games or videos)
> seem to be even more easily styled for some reason. Multiple
> soundtracks can be muxed and assigned different loudness.
> Also @media aural {display: none;} can be used on audio elements
> but I haven't read the specs properly so I don't know if that would hide
> an <video> element when inside of an @media aural clause.
>
> CSS 3 aural is still to be done so more capabilities may be suggested.
>
>>> 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.
> Not necessarily, just pointing out that it would be a good idea to fix the
> soundtrack if it's broken. CSS is perfect for these kind of things so I
> recommend extending that rather than HTML.
Has there been any discussion about implementing support for CSS2
aural in Web browsers? Until such a time - and in fact independently
of that - I still think turning the existing volume and muted IDL
attributes into content attributes would be a nice and simple
solution. Introducing a whole CSS aural control section will take lots
longer IMHO. Also, it won't hurt to have both - we do that for width
and height, too.
Cheers,
Silvia.
More information about the whatwg
mailing list