audioContext won't play until page unloads
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)
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
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.
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.
Одабрано решење
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.