[whatwg] Help with HTML5 Audio

Ian Hickson ian at hixie.ch
Fri Aug 3 23:11:22 PDT 2007


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.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list