W3C home > Mailing lists > Public > public-html@w3.org > January 2011

Lifetime of new Audio()

From: Adrian Bateman <adrianba@microsoft.com>
Date: Mon, 31 Jan 2011 01:52:55 +0000
To: "HTML WG (public-html@w3.org)" <public-html@w3.org>
Message-ID: <104E6B5B6535E849970CDFBB1C5216EB3CEFFFCA@TK5EX14MBXC138.redmond.corp.microsoft.com>
I have a question about an audio element created using the constructor. Consider the following function:

function playAudio() {
  var a = new Audio("http://www.example.com/music");
  a.play();
}

Ignoring for now the timing issue of how quickly the play() actually has enough content to start playing, after the function returns there is no reference to the Audio object. Is the fact that the object is playing enough to pin it in memory? Otherwise the GC could collect the object and stop the playing. I scanned the media section of the spec but couldn't see where it defines this behaviour one way or the other.

Any thoughts?

Thanks,

Adrian.
Received on Monday, 31 January 2011 01:53:39 UTC

This archive was generated by hypermail 2.3.1 : Monday, 29 September 2014 09:39:22 UTC