7

We have a blog, each post of which contains an iframe which in turn should play a sound using Web Audio when clicked Play.

Problem is, after a certain number of posts is on the page, the next frame throws an error: Uncaught SyntaxError: Failed to construct 'AudioContext': number of hardware contexts reached maximum (6).

It is not possible to reuse the single AudioContext between frames - window.top is verboten because of same-origin policy.

Here's a simplified example: http://jsfiddle.net/aobpv7kg/ (click Add frame until you get an error - 7th frame in my case).

Can an arbitrary number of frames in a page use Web Audio? Or is lowering the post per page count to 5 all we can do?

mcm69
  • 670
  • 6
  • 14

1 Answers1

10

That's currently all you could do. (Or use postMessage to communicate across window boundaries, doing all the real audio work in one window.) We're looking at this problem, both in Chrome and in the spec.

cwilso
  • 13,610
  • 1
  • 30
  • 35
  • Really glad to see your answer. This is PITA kind of a problem 'cause obviously there is no way to be sure the user doesn't have something using AudioContext in more than 6 tabs/windows. – Nek Oct 09 '14 at 21:48
  • 2
    @cwilso, thanks for responding. re: "We're looking at this problem, both in Chrome and in the spec.", is there an issue tracker / discussion thread one could use to follow this? – Brian Jordan Oct 28 '14 at 17:52