CreateJS / SoundJS

A Javascript library for working with Audio. It provides a consistent API for loading and playing audio on different browsers and devices. Currently supports WebAudio, HTML5 Audio, Cordova / PhoneGap, and a Flash fallback.
http://createjs.com/
MIT License
4.42k stars 838 forks source link

I can't getDuration() after createInstance() ? #248

Open PhamVanTung opened 7 years ago

PhamVanTung commented 7 years ago
createjs.Sound.registerSound(scope.src, "soundId")
scope.soundInstance = createjs.Sound.createInstance("soundId")
console.log(scope.soundInstance.getDuration()) // log value = 0

How to getDuration()? Sorry by convention. :bow:

lannymcnie commented 7 years ago

What browser are you using? It is possible you don't have a duration immediately because the audio is not loaded yet.

lannymcnie commented 7 years ago

We should verify where this might not work. It is a known issue on Cordova, where we have to wait to get the value,