W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2010

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

From: Alex Bishop <alexbishop@gmail.com>
Date: Tue, 01 Jun 2010 02:26:39 +0100
Message-ID: <4C0461CF.8070609@gmail.com>
On 31/05/2010 12:33, Silvia Pfeiffer wrote:
> 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.

A less esoteric use case is videos in advertisements, which often begin 
to play as soon as the ad loads but remain silent until the user 
explicitly chooses to enable sound (the theory being that the motion of 
the video will pique the user's interest and compel them to switch on 
the audio).

If there were a muted content attribute, such a video could be inserted 
into an ad using code as simple as this:

<video src="buystuff" autoplay loop muted></video>

(In most cases, script would probably be used to allow the user to 
enable sound but it's possible that the ad might rely on the 
user-agent's own controls for this.)

Without a muted content attribute, scripting would be required to ensure 
the video is muted when it starts playing. In cases where the author has 
not fully considered situations where scripting is not enabled, it is 
possible that some users may be unintentionally subjected to video that 
starts playing automatically (because the video element has an autoplay 
content attribute) at full volume (because the muting is done using 
script). I also wonder if less-than-bulletproof script solutions might 
lead to circumstances where the video begins playing before the muting 
script has executed, causing unwanted sound to be heard briefly.

Furthermore, while the lack of a muted content attribute can be 
alleviated using scripting, the same could be said of the autoplay 
content attribute. However, such an attribute is specified and has been 
implemented.

Alex

-- 
Alex Bishop
alexbishop at gmail.com
Received on Monday, 31 May 2010 18:26:39 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:23 UTC