[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 22:43:04 EST 2009


On Wed, 2009-11-18 at 20:53 -0600, Felipe López Toledo wrote:
> 2009/11/18 Bryan Berry <bryan at olenepal.org>
>         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.
> mmm, interesting, what version/os are u using?

chromium daily on linux, maybe that's the problem

off-topic: here is the source of chromeOS
http://src.chromium.org/viewvc/chrome/releases/4.0.246.0/src/

> I have tested loading audio files (ogg files) from remote and it
> works. 
> The html, the js and the ogg files are in the same domain (localhost)
yes

> 
> tested with ff 3.5.5 and google chrome 4.0.223.16 both under windows
> 
> 
>         
>         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();
>         
>                }
>         
> yeah, I had the same "problem", but believe it or not.. it is the
> default behavior (as the standard draft says)
> here is the KSound code (with the little fix)
> http://git.sugarlabs.org/projects/karma/repos/mainline/blobs/master/js/jquery.karma.js#line1041
>  
> btw. chrome does not need that line
>         
>         
>         
>         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
>         
>         
> 
> 
> -- 
> Felipe López Toledo
-- 
Bryan W. Berry
Senior Engineer
OLE Nepal, http://www.olenepal.org



More information about the Sugar-devel mailing list