I'm trying to have a load progress bar in my game, and I have a function assigned to the onloadeddata
attribute on my audio, but it is not triggering in Chrome. It works in other browsers. I also tried many other events such as oncanplay
, oncanplaythrough
, onloadedmetadata
, etc. None of them trigger.
I think it might have to do with the caching. Tried looking around and there was some reports of this from 2-3 years ago but nothing recent.
Is there any other way I could detect if the audio is loaded, or make these events work?
EDIT: Here's a quick example: http://jsfiddle.net/3vxCu/1/
Works in Opera and Firefox, but not in Chrome. It should give an alert when sound if finished loading.
Best Answer
It seems that the
onloadeddata
property does not work for some reason. But attaching an event handler throughaddEventListener
(or via jQuery) works: http://jsfiddle.net/3vxCu/4/