[Sugar-devel] [karma] when does an audio element created w/ new Audio() emit the onload event?

Bryan Berry bryan at olenepal.org
Wed Nov 18 17:13:18 EST 2009


I was just playing around w/ it and I found the media.load() method

loading audio remotely still doesn't work on chromium -- argh but works
fine on FF 3.5. I need to go complain about that.

http://karma-testing.sugarlabs.org/tests/index.html

I add to put this code here 
http://git.sugarlabs.org/projects/karma/repos/mainline/blobs/jkjs-refactor/js/karma.js#line324

after I added the event handlers

	if (this._type === "sound"){
	    this.media.load();
	}



On Wed, 2009-11-18 at 14:21 -0600, Felipe López Toledo wrote:
> hi man
> 
> 
>         It doesn't emit that event at the same time that a new Image()
>         does. I
>         need a way to throw an error to the user if the audio file
>         isn't
>         accessible. I do this for the images and it works quite well.
> I have used "load" and "error" and others events for new Image and new
> Audio and it seems that work fine, could you explain the event that
> you want to catch?
> 
> 
> I think audio.addEventListener("error", function(e) {....}, false ); 
> will do the work.
> 
> 
> btw. here is the list of events for media elements, section 4.8.10.12:
> http://dev.w3.org/html5/spec/Overview.html
> 
> 
> greetings! 
> 
> 2009/11/18 Bryan Berry <bryan at olenepal.org>
>         Hey subzero,
>         
>         Do you know when does an audio element created w/ new Audio()
>         emit the
>         onload event?
>         
>         It doesn't emit that event at the same time that a new Image()
>         does. I
>         need a way to throw an error to the user if the audio file
>         isn't
>         accessible. I do this for the images and it works quite well.
>         
>         I also need to this for svgs but haven't figured out the
>         mechanism
>         
>         --
>         Bryan W. Berry
>         Senior Engineer
>         OLE Nepal, http://www.olenepal.org
>         
> 
> 
> 
> -- 
> Felipe López Toledo
> 
-- 
Bryan W. Berry
Senior Engineer
OLE Nepal, http://www.olenepal.org



More information about the Sugar-devel mailing list