[whatwg] When to stop <video> elements from playing
Robert O'Callahan
robert at ocallahan.org
Fri Oct 19 16:31:46 PDT 2007
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>
More information about the whatwg
mailing list