HTML5音频从Firefox中的错误位置开始 [英] HTML5 audio starts from the wrong position in Firefox

查看:111
本文介绍了HTML5音频从Firefox中的错误位置开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试播放mp3文件,我想跳转到文件中的特定位置。在Windows上的Chrome 33中,文件跳转到正确的位置(与在本地播放mp3的VLC相比),但在Windows上的Firefox 28中,它播放得太远了,在Internet Explorer 11中它播放得太远了。

I'm trying to play an mp3 file and I want to jump to specific location in the file. In Chrome 33 on Windows, the file jumps the correct position (as compared with VLC playing the mp3 locally) but in Firefox 28 on Windows it plays too far forward and in Internet Explorer 11 it plays too far behind.

它曾经在Firefox 27及更早版本中正常工作。

It used to work correctly in Firefox 27 and earlier.

有更好的方法吗?

编辑:问题甚至不需要SoundManager2。您只需使用Firefox中的< audio> 标记即可复制相同的问题。这两行是重现它所需的所有代码:

The problem doesn't even require SoundManager2. You can replicate the same issue with just the <audio> tag in Firefox. These two lines are all the code you need to reproduce it:

<audio autoplay id="audio" src="http://ivdemo.chaseits.co.uk/enron/20050204-4026(7550490)a.mp3" controls preload></audio>
<button onclick="javascript:document.getElementById('audio').currentTime = 10;">Jump to 10 secs "...be with us in, er, 1 minute...  ok" </button>

在此尝试: http://jsfiddle.net/cpickard/29Gt3/

编辑:尝试使用Firefox Nightly,没有任何改进。我在bugzilla中将其报告为错误994561 。现在仍在寻找解决方法。

Tried with Firefox Nightly, no improvement. I have reported it as bug 994561 in bugzilla. Still looking for a workaround for now.

推荐答案

我在 SoundJS 和实现音频精灵最近遇到了类似的问题。根据规范,设置html音频播放头的位置可能不准确达300ms。所以这可以解释你所看到的一些问题。

I work on SoundJS and while implementing audio sprites recently ran into similar issues. According to the spec, setting the position of html audio playhead can be inaccurate by up to 300ms. So that could explain some of the issues you are seeing.

有趣的是,你的小提琴在FF 28中在胜利8.1中正确播放,如果我只是让它从开始。

Interestingly, your fiddle plays correctly for me in FF 28 on win 8.1 if I just let it play through from the start.

还有一些已知的音频长度准确性问题也可能产生影响,您可以阅读这里

There are also some known issues with audio length accuracy that may also have an effect, which you can read about here.

如果你想要精确,我肯定会建议尽可能使用网络音频或像SoundJS这样的库。

If you want precision, I would definitely recommend using Web Audio where possible or a library like SoundJS.

希望有所帮助。

这篇关于HTML5音频从Firefox中的错误位置开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆