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

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

From: Anne van Kesteren <annevk@opera.com>
Date: Fri, 19 Oct 2007 10:03:57 +0200
Message-ID: <op.t0fp0vxu64w2qv@annevk-t60.oslo.opera.com>
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

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