简体   繁体   English

Internet Explorer 11 HTML5音频持续时间=无限期问题

[英]Internet Explorer 11 HTML5 audio duration = infinity issue

Today I've met an unpleasant issue. 今天我遇到了一个不愉快的问题。 There is a website with a custom HTML5 audio player. 有一个带有自定义HTML5音频播放器的网站。 After the page loads, I try to echo document.getElementById("myAudioId").duration , it is needed in order to make navigation possible. 页面加载后,我尝试回显document.getElementById("myAudioId").duration ,这是使导航成为可能所必需的。 In every other browser it works just fine, the duration is showed, but IE11 works differently - it shows that duration equals Infinity . 在其他所有浏览器中,它都可以正常工作,显示了持续时间,但是IE11却以不同的方式工作-它显示持续时间等于Infinity But as I noticed, when the song is buffered to the end, the duration magically appers and the navigation works. 但正如我注意到的那样,当歌曲被缓冲到最后时,持续时间就神奇地消失了,导航也开始了。 In other browsers everything works from the start. 在其他浏览器中,一切从一开始就可以运行。 The content-length headers are set up. 设置了内容长度标头。 What could it be? 会是什么呢?

UPD: Other sites with HTML5 audio let me see the duration from the very start. UPD:其他带有HTML5音频的网站让我从一开始就看到了持续时间。 The duration, I guess, is part of metadata and could be loaded even without preloading the audio file using preload="metadata" , but it also doesn't work. 我猜,持续时间是元数据的一部分,即使不使用preload="metadata"预加载音频文件也可以加载持续时间,但是它也不起作用。

UPD2: I've also tried playing around with jsfiddle and created the same audio tag there with same MP3 audio - there was the same situation. UPD2:我也尝试过使用jsfiddle并在其中创建具有相同MP3音频的相同音频标签-情况相同。 But then I've inserted link to another MP3 there, from another site - and it worked! 但是,然后我从另一个站点插入了到另一个MP3的链接- 并且它起作用了! . More than that, I've uploaded this second song to the first problematic website and after that the song that worked perfectly couldn't also show me its duration and stuff. 更重要的是,我已将第二首歌曲上传到第一个有问题的网站,此后,完美播放的歌曲也无法向我显示其持续时间和内容。 So now I think it's something on server side. 所以现在我认为这是服务器端的东西。 But don't know what it is. 但是不知道那是什么。

UPD3: Finally, I've been told that files are converted using FFMPEG to MP3 128bit, then they stop being OK. UPD3:最后,有人告诉我,文件是使用FFMPEG转换为MP3 128位的,然后不再正常。 Now I need to find how should I convert MP3s so they are OK. 现在,我需要找到如何转换MP3的方法,这样它们就可以了。

It works for me locally, but when uploaded to server, it does not. 它在本地对我有效,但是当上传到服务器时却无效。 It seems that player.duration do not work in IE 11: https://msdn.microsoft.com/en-us/library/dn254962(v=vs.85).aspx 似乎player.duration在IE 11中不起作用: https ://msdn.microsoft.com/zh-cn/library/dn254962(v=vs.85).aspx

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

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