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

[whatwg] Help with HTML5 Audio

From: Ian Hickson <ian@hixie.ch>
Date: Sat, 4 Aug 2007 06:11:22 +0000 (UTC)
Message-ID: <Pine.LNX.4.64.0708040609460.9753@dhalsim.dreamhost.com>
On Sat, 23 Sep 2006, Jeff Schiller wrote:
> 
> Do load events bubble up?  If so, can I add a load even listener to the 
> document and then catch the load events there always?

They do not.


> If so, how can I distinguish the target is of type Audio and not of type 
> HTMLImageElement (or whatever), just look for e.target.play?

You can always look at the target attribute to determine exactly what the 
target was.


> If my understanding is not correct above (and I will test this later), 
> then it seems that the spec gives me no way to guarantee that I can 
> attach a load event listener to the Audio object prior to the song 
> loading (especially for cached sounds).

The intent is that no downloads begin until after the script has 
completed, so you can always set the event handlers before they fire.


> Although this doesn't help me for Opera 9, I would like to propose that 
> the Audio constructor's argument be OPTIONAL.  If there is no argument, 
> then the Audio object is created without any sound loaded and all 
> play(), loop(), etc would just return (or return an error or throw an 
> exception?).  Then, add a load() method to the interface (which would 
> produce a load event just as the construction with an argument would).  
> This also allows me to reuse the Audio object instead of creating an 
> Audio object for each different sound...

Done.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 3 August 2007 23:11:22 UTC

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