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

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

From: Geoffrey Garen <ggaren@apple.com>
Date: Thu, 18 Oct 2007 15:55:22 -0700
Message-ID: <A11E6CBB-46DB-4C64-A4C3-5E26F74C5886@apple.com>
> Suppose a script creates a <video> element, adds it to the document,  
> starts it playing, then removes the element from the document and  
> drops all references to it. When should the element stop playing?

> -- when the element leaves the document?

Probably. Since you can't see the video any more, it would be really  
weird to hear audio from it, or waste computer resources on a mute and  
invisible video. Moreover, there's a lot of precedent for DOM elements  
not loading when they're not in the document. This is true of iframe,  
script, img, etc.

> -- when all JS references to the element have been dropped (and  
> garbage collection runs)?

No. The time at which garbage collection will reclaim an object is  
unpredictable, so relying on garbage collection for behavior is a bad  
idea.

> -- when the user leaves the page?

Certainly. But you might want to stop the video sooner.

> -- when the end of the stream is reached? (which could be "never")

Certainly. (How can you play past the end of the stream?) But you  
might want to stop the video sooner.

Geoff
Received on Thursday, 18 October 2007 15:55:22 UTC

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