Answer the question
In order to leave comments, you need to log in
Why is audio.duration different in FF and chrome?
var audio = document.getElementById("player");
...
$('#player').attr('src', 'path/to/audio.mp3');
...
audio.addEventListener("loadeddata", function () {
var duration = audio.duration;
console.log (duration );
});
Answer the question
In order to leave comments, you need to log in
Better use "canplaythrough". Usually "loadeddata" fires too soon.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question