最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Using AudioContext in multiple iframes - Stack Overflow

programmeradmin3浏览0评论

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: / (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?

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/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?

Share Improve this question edited Sep 23, 2014 at 16:59 mcm69 asked Sep 22, 2014 at 15:02 mcm69mcm69 7406 silver badges14 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 10

That's currently all you could do. (Or use postMessage to municate 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.

发布评论

评论列表(0)

  1. 暂无评论