W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2007

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

From: Jonas Sicking <jonas@sicking.cc>
Date: Mon, 29 Oct 2007 12:10:25 -0700
Message-ID: <47263021.2070805@sicking.cc>
Ian Hickson wrote:
>> I believe this can happen in a number of ways, the simplest being that 
>> Page A calls a function on Page B. But I suspect there are also events 
>> that can fire in Page B even after it has closed.
> 
> Actually per spec, if I recall, you can't run script if you're not an 
> active document. (To start with, your Window object won't have your 
> properties any more, which makes things difficult if we allow script.)

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

/ Jonas
Received on Monday, 29 October 2007 12:10:25 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:37 UTC