简体   繁体   English

Firefox 6 HTML audio.duration = NaN问题

[英]Firefox 6 HTML audio.duration = NaN problem

I just found a possible bug in Firefox 6 for Windows. 我刚刚在Windows版Firefox 6中发现了一个可能的错误。 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. 当我尝试在由音频“ loadeddata”事件触发的函数中获取audio.duration值时,在Windows的Firefox 6中,该值为NaN。 And the audio.duration value updates with the audio.currentTime value while audio starts playing (audio.duration == audio.currentTime). 在音频开始播放时,audio.duration值将用audio.currentTime值更新(audio.duration == audio.currentTime)。

This only happens in Firefox 6 for Windows. 这仅在适用于Windows的Firefox 6中发生。 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. 我在Safari,Chrome,Firefox 6(在Mac OS X 10.7上)和Chrome,IE 9(在Windows 7上)中尝试了相同的javascript代码,效果很好。 So it seems the problem only occurs on Firefox 6 for Windows. 因此,似乎该问题仅发生在Windows的Firefox 6上。 The audio for Firefox is ogg format. Firefox的音频为ogg格式。 Does anyone else find this problem? 还有其他人发现这个问题吗?

I have sorted out this problem by providing audios with CBR encoding. 我通过为音频提供CBR编码来解决此问题。 For VBR encoded audios, audio.duration always get NaN in Firefox 6/7/8 for Windows. 对于VBR编码的音频,在Windows的Firefox 6/7/8中,audio.duration始终为NaN。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM