Skip to content Skip to sidebar Skip to footer

Problem With Duration Value Of Html5 Audio Element In Ios

I'm developing a web app for iOs device, but I have a problem with the html5 audio tag... I designed a custom audio player, and I control the song with javascript functions. With s

Solution 1:

This is a bug in iOS... even inside the function that gets called on the onloadedmetadata event, you MAY STILL get NaN.

In my case, this happens at random when the user selects a new mp3 and the code dynamically sets the src property. The audio plays fine, yet SOMETIMES, the duration returns NaN, screwing up any progress indicator that depends on that value.

Solution 2:

The medata is available after this event has fired:

 loadedmetadata

More info

https://developer.mozilla.org/en/Introducing_the_Audio_API_Extension

Post a Comment for "Problem With Duration Value Of Html5 Audio Element In Ios"