2
Are you returning Nan, does anyone have a solution? Follows the code:
<html>
<head>
<title>teste</title>
<meta charset="utf-8"/>
</head>
<body>
<audio id="mytrack" controls>
<source src="Jinxed.mp3" type="audio/mp3">
</audio>
<script type="text/javascript">
alert(mytrack.duration);
</script>
</body>
</html>
Did Nan return both here in my code and yours in Jsfiddle? Is it the browser?
– Asura Khan
@Asurakhan tested again and is returning
NaN
, more is because for some reason the mp3 file I put as an example in fiddle is not being located. :/– abfurlan
in my case it locates the audio, but it does not work and the codes are identical. Are 2 lines after all.
– Asura Khan
@Asurakhan see the issue, if this way works for your case.
– abfurlan
Now it worked, but I didn’t understand anything. I know the eventlistener and his use with callback, but this one there.. I’m kind of dumb with "this" . I’d be grateful if you could explain it to me. Including why the other method doesn’t work.
– Asura Khan
@Asurakhan see the issue with the explanation.
– abfurlan
Thank you very much.
– Asura Khan