In association with this audio element:
<audio controls id="testTone" preload="metadata">
<source src="autoharp/tone0.ogg" type="audio/ogg">
</audio>
This code logs the duration of the element:
var au = document.getElementById("testTone");
au.onloadedmetadata = function() {
console.log(au.duration)
};
What I'd like is to get that au.duration number into a variable.
One thing I tried was having the function return au.duration
and then:
var hmmm = au.onloadedmetadata();
console.log(hmmm);
Which just gave me NaN. Alas. Any suggestions?