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

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

From: Robert O'Callahan <robert@ocallahan.org>
Date: Sat, 20 Oct 2007 12:31:46 +1300
Message-ID: <11e306600710191631o77cdcf0bvfc3acd317b42c1de@mail.gmail.com>
After some discussion on IRC, I think Jonas, Hixie and I agreed that we're
OK with the following approach:
-- sound is produced for display:none elements and elements not in the DOM
-- removing an element from the DOM automatically calls stop() on that
element
-- tearing down the owner document always stops the element playing (so
navigating away from the page always stops sound)

Therefore
myAudio = new Audio("foo.wav");
myAudio.onload = function () {
  this.play();
  myAudio = null;
}
will work, and will play until the sound ends or the user leaves the page.

Rob
-- 
"Two men owed money to a certain moneylender. One owed him five hundred
denarii, and the other fifty. Neither of them had the money to pay him back,
so he canceled the debts of both. Now which of them will love him more?"
Simon replied, "I suppose the one who had the bigger debt canceled." "You
have judged correctly," Jesus said. [Luke 7:41-43]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20071020/0a3bfb06/attachment.htm>
Received on Friday, 19 October 2007 16:31:46 UTC

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