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

On Mon, 29 Oct 2007, Jonas Sicking wrote:
>
> Scripts can actually still run fine even if you navigate away from a 
> page. But there are definitely weird things happening (such as global 
> scope being different from 'window').
> 
> This isn't the thread to discuss this though.

I've saved your mail to the "scripts" pile for future examination.


> > > 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"?

Yes.


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

If it throws an exception, how do you switch it to the "play" mode? You 
might well want to do this, e.g. if it is possible the document in 
question will once against become an active document.


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

But that makes it possible to have the problem you mentioned, with 
elements that never stop playing.

I've put a note in the text near the pause() method that points out the 
active document thing.

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

Received on Monday, 29 October 2007 13:01:34 UTC