[whatwg] When to stop <video> elements from playing
Jonas Sicking
jonas at sicking.cc
Mon Oct 29 12:10:25 PDT 2007
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
More information about the whatwg
mailing list