Re: <video> toggling video rendering (and muting of <video hidden>)

On Mon, 22 Jun 2009, Michael A. Puls II wrote:
>
> If you load <video> on some site and just want to hear the audio, is 
> there a way to turn off the video output so you can save some cpu and 
> just listen to the audio?

If you mean for the user: the browser should be able to offer you that 
choice, if they think that's something users will want. It's up to the 
browser vendor.

If you mean for the author: just use <audio>, or display:none the <video> 
element (or remove it from the document). Browsers can then optimise the 
case of the video not showing.


On Tue, 23 Jun 2009, Simon Pieters wrote:
> >
> > If not, I think that would be totally awesome if you could do that 
> > (wish youtube and all the other video sites did that).
> > 
> > Something like video.toggleVideoOutput() so the site can provide a 
> > button.
> 
> The page can set video.hidden to do this.

<video hidden> means the video isn't relevant, so that's probably not 
really the right semantic if the audio is still wanted.


On Tue, 23 Jun 2009, Michael A. Puls II wrote:
> 
> display: none in Firefox seems to cut the cpu usage. But, I'm not sure 
> if it cuts all activity with the video renderer or not. visibility: 
> hidden doesn't seem to work for cutting the cpu usage much, but probably 
> should.

I recommend reporting such issues directly to your browser vendor.


> You just mean a class selector that sets display: none for example?

That would work, yes.


On Tue, 23 Jun 2009, Simon Pieters wrote:
>
> <Hixie> zcorpan_: technically <video hidden> means "this isn't relevant" 
> and so we should probably make it mute the audio as well
> 
> The spec does not currently say this at the moment.
> 
> I haven't thought about this enough to have an opinion on whether it 
> would be a good thing or not to mute the audio.

I don't think we should do this (the same as we don't actually prevent 
form controls marked as hidden="" from submitting).


On Tue, 23 Jun 2009, Jonas Sicking wrote:
> 
> We'd also have to mute if any ancestor was hidden.

Yeah, it could get complicated. It would also mean hidden="" was more 
complicated to implement than just one line of CSS.


On Wed, 24 Jun 2009, Robin Berjon wrote:
> 
> The way I see it, semantically, <video> has an implied <audio> component 
> (for lack of a better word) since it plays both in AV. Based on that, it 
> would IMHO make sense to mute the audio when hidden (I would assume 
> audio would be muted for <audio hidden>). If you want audio only, use 
> <audio>.

I think it would make sense, but isn't worth the extra complexity. It's 
one of those trade-offs between the theoretically correct pure model and 
the pragmatic easy-to-understand model.

(Note that none of this affects display:none or completely removing the 
element from the tree, which should not affect audio playback.)

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Tuesday, 7 July 2009 07:55:48 UTC