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

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  
implemented.


-- 
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>

Received on Friday, 19 October 2007 01:03:57 UTC