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");

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?


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

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:16:08 UTC