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

Anne van Kesteren annevk at opera.com
Fri Oct 19 01:03:57 PDT 2007

On Fri, 19 Oct 2007 07:12:03 +0200, Robert O'Callahan  
<robert at ocallahan.org> wrote:
> My current opinion is that <audio> and <video> elements should behave  
> like <img> and load/play whether or not they're in a document, but they  
> should
> only emit sound if they're in a document with a presentation and are not  
> in a display:none subtree. Then to play a sound you'd have to insert the
> element into your document somewhere with size 0x0 (which should be the
> default for <audio>).

I think you want to do:

   var soundeffect = new Audio("sound.wav")
   soundeffect.onload = function() { this.play() }

which is what was possible with the old Audio API (became <audio>) Opera  

Anne van Kesteren

More information about the whatwg mailing list