搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

audioContext won't play until page unloads

  • 4 个回答
  • 2 人有此问题
  • 1 次查看
  • 最后回复者为 u9520107

more options

Hi, I am developing a website that uses audioContext as the main audio playback mechanism. While the site works with chrome/safari and opera, I have trouble making the audio playback smoothly in firefox 26 on the desktop and android. The issue is that the playback functions are fired (and all my logs shows up perfectly fine), but no audio would come out. Then when I navigate away from page, the audio suddenly starts playing when I am already in another page. Then after awhile the audio would halt. However, this does not happen every time. It seems that when the computer is under load, this happens more often. So I am suspecting a bug in Firefox. Unfortunately, under my corporate rules, I cannot give out details about the code I am developing.

Hi, I am developing a website that uses audioContext as the main audio playback mechanism. While the site works with chrome/safari and opera, I have trouble making the audio playback smoothly in firefox 26 on the desktop and android. The issue is that the playback functions are fired (and all my logs shows up perfectly fine), but no audio would come out. Then when I navigate away from page, the audio suddenly starts playing when I am already in another page. Then after awhile the audio would halt. However, this does not happen every time. It seems that when the computer is under load, this happens more often. So I am suspecting a bug in Firefox. Unfortunately, under my corporate rules, I cannot give out details about the code I am developing.

被采纳的解决方案

Ok... Got my hands full for the past few weeks. Turns out, if instead of putting audioContext to a variable, but put it in an object: var holder = { ctx: new AudioContext()};

Then set holder.ctx = null at window.beforeunload. The issue dissappears.

I noticed a pattern to the error that a freshly started firefox will be able to play the audio fine. Then after logging out of the page and logged back, the audio is gone. After logging out again, the audio suddenly started playing. So I thought perhaps the javascript engine isn't releasing it's resources properly when terminating it's current instance.

定位到答案原位置 👍 0

所有回复 (4)

more options

Hi u9520107,

Thank you for contacting support. To make sure we are on the same page, are the steps you are taking to diagnose the audio issue the same in Firefox for Android and Firefox for the desktop?

Currently this is only supported and turned on in Firefox Nightly versions. You can download nightly here: http://nightly.mozilla.org/ However I have tested the jsfiddle mentioned in the stackoverflow answer below and it plays the first 4 seconds in Firefox Beta version 27 on the desktop.

Also, stackoverflow.com is a good place to ask about development issues if you are finding that it works for other users.

MDN reference: https://developer.mozilla.org/en-US/d.../AudioContext Currently the issues I know of for audiocontext in firefox:

Firefox Stackoverflow question on http://stackoverflow.com/questions/19.../19710142#19710142

more options

Thanks for the response. The issue exists both in desktop firefox (26 and 27 nightly), and android firefox( android: 4.1.1 firefox 26.0, not yet tested on 27 nightly). I did not use mediaSourceNode in my code so the issue should be different. I followed the example using XMLHttpRequest to request a mp3 file setting the response type as arraybuffer. Then use decodeAudioData to get the buffer. Then createBufferSource() and connect to destination. With my supervisor's permission, I'll submit some code to stackoverflow as well. I'll also upload the source here after I get the permission. Hopefully that could be of some help. Thank you.

more options

Arg... when I extract the audio player code out and only run that code. Then firefox plays fine. It does seem that heavy load to the cpu is needed to cause such an issue.

more options

选择的解决方案

Ok... Got my hands full for the past few weeks. Turns out, if instead of putting audioContext to a variable, but put it in an object: var holder = { ctx: new AudioContext()};

Then set holder.ctx = null at window.beforeunload. The issue dissappears.

I noticed a pattern to the error that a freshly started firefox will be able to play the audio fine. Then after logging out of the page and logged back, the audio is gone. After logging out again, the audio suddenly started playing. So I thought perhaps the javascript engine isn't releasing it's resources properly when terminating it's current instance.