admin管理员组文章数量:1401632
I trying to create some visualization for audio-stream. But I run into CORS trouble when I try get access to raw audio data with createMediaElementSource()
function.
Is there a way to avoid this restriction and get raw audio data from stream on other origins? Perhaps using WebSockets?
I trying to create some visualization for audio-stream. But I run into CORS trouble when I try get access to raw audio data with createMediaElementSource()
function.
Is there a way to avoid this restriction and get raw audio data from stream on other origins? Perhaps using WebSockets?
Share Improve this question edited Jun 2, 2015 at 21:46 user1693593 asked Jun 2, 2015 at 18:32 Alexey NikiforovAlexey Nikiforov 3771 gold badge6 silver badges14 bronze badges 2- 1 Use a server-side proxy script to download and server the file. Host JS and proxy on the same server. – Mikko Ohtamaa Commented Jun 2, 2015 at 18:34
- possible duplicate of Ways to circumvent the same-origin policy – Dave Commented Jun 2, 2015 at 21:49
1 Answer
Reset to default 8There are five ways to deal with the protections against cross-origin retrieval:
- CORS headers -- this is ideal, but you need the cooperation of the third-party server
- JSONP -- not appropriate for streaming content and you typically need the cooperation of the third-party server
- Iframes and inter-window munication -- probably not appropriate for streaming content and you need the cooperation of the third-party server
- Turning off browser protections -- you need to be running the browser in a custom mode, and you should not use that browser for anything else
- Server-side proxy -- paratively slow but often the only feasible option
本文标签: javascriptHow can I avoid CORS restriction for web audio apiStack Overflow
版权声明:本文标题:javascript - How can I avoid CORS restriction for web audio api? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744298243a2599450.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论