[whatwg] When to stop <video> elements from playing

Ian Hickson ian at hixie.ch
Wed May 14 02:38:11 PDT 2008


On Mon, 29 Oct 2007, Jonas Sicking wrote:
> > > 
> > > I believe the best solution here is to say that step 5 should throw 
> > > an exception. I.e. you can't start playing a media element whose 
> > > .ownerDocument is not a displayed document.
> > 
> > What do you think of what the spec says at the moment?
> 
> Are you referring to "When a media element is actively playing and its 
> owner Document is an active document, its current playback position must 
> increase monotonically at playbackRate units of media time per unit time 
> of wall clock time"?
> 
> First of all, that'll mean that calling .play() on a 
> in-non-active-document element will silently fail. It'd probably be 
> better to throw an exception.
> 
> It's also something that's easier to miss for an implementor. Might be a 
> good idea to put it in the steps for play() and change the 
> removed-from-document paragraph to say:
> 
> When a media element is removed from a Document, or the .ownerDocument 
> stops being an active document, the user agent must act as if the 
> pause() method had been invoked.

Throwing an exception means that you can't start a video without first 
checking if the document is visible, and pausing when the document is made 
not active means that when you return to the document the video won't be 
playing. Neither of these seems desireable.

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



More information about the whatwg mailing list