Search code examples
javascripthtmlfirefoxhtml5-audiofirefox6

Firefox 6 HTML audio.duration = NaN problem


I just found a possible bug in Firefox 6 for Windows. When I try to get the audio.duration value in a function that triggered by audio "loadeddata" event, in Firefox 6 for Windows, the value is NaN. And the audio.duration value updates with the audio.currentTime value while audio starts playing (audio.duration == audio.currentTime).

This only happens in Firefox 6 for Windows. I tried the same javascript code in Safari, Chrome, Firefox 6 (on Mac OS X 10.7) and Chrome, IE 9 (on Windows 7), it works fine. So it seems the problem only occurs on Firefox 6 for Windows. The audio for Firefox is ogg format. Does anyone else find this problem?


Solution

  • I have sorted out this problem by providing audios with CBR encoding. For VBR encoded audios, audio.duration always get NaN in Firefox 6/7/8 for Windows.