W3C home > Mailing lists > Public > whatwg@whatwg.org > January 2012

[whatwg] HTML Audio Element removal from DOM

From: Eric Carlson <eric.carlson@apple.com>
Date: Tue, 17 Jan 2012 13:38:07 -0800
Message-ID: <76F1A601-2F05-4D75-A67F-D7DAFEFEF609@apple.com>

On Jan 17, 2012, at 1:32 PM, Andrew Scherkus wrote:

> On Tue, Jan 17, 2012 at 1:19 PM, Charles Pritchard <chuck at jumis.com> wrote:
> 
>> When an <audio> element is removed from the DOM while playing, is that
>> element paused?
>> That seems to be the behavior in Chrome. I'm looking for clarification.
> 
> 
> I was able to repro this in both Safari 5.1.1 and Chrome 17.0.963.26 dev so
> perhaps it's a bug in WebKit as the spec states the following:
> """
> Media elements that are potentially playing while not in a Document must
> not play any video, but should play any audio component. Media elements
> must not stop playing just because all references to them have been
> removed; only once a media element is in a state where no further audio
> could ever be played by that element may the element be garbage collected.
> """
> 

  That is for an element that is playing when it is not in the document. Look at the end of http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#playing-the-media-resource for the definition of what to do when an element is removed from the DOM:

When a media element is removed from a Document, the user agent must run the following steps:
	1. Asynchronously await a stable state, allowing the task that removed the media element from the 
		Document to continue. The synchronous section consists of all the remaining steps of this algorithm.
		(Steps in the synchronous section are marked with.)
	2. If the media element is in a Document, abort these steps.
	3. If the media element's networkState attribute has the value NETWORK_EMPTY, abort these steps.
	4. Pause the media element.

eric
Received on Tuesday, 17 January 2012 13:38:07 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:10 UTC