How can i return song duration in soundmanager with function ?
function item_duration(){
var song_item = soundManager.createSound({
id:'etc',
url:'etc',
onload: function() {
if(this.readyState == 'loaded' ||
this.readyState == 'complete' ||
this.readyState == 3){
return = this.duration;
}
}
});
song_item.load();
}
This is my try, but it’s not working
returnis a keyword, not a variable.return this.duration;is what you’d want; skip the=(which will just give you a syntax error)… but that won’t help much, because where are you returning it to? You’ll need to call another function, that does something with the duration. The
item_durationfunction returns immediately after callingcreateSound, which then loads the file asynchronouslyTry something like this