javascript - How can I avoid CORS restriction for web audio api? - Stack Overflow

I trying to create some visualization for audio-stream. But I run into CORS trouble when I try get acce

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
Add a ment  | 

1 Answer 1

Reset to default 8

There are five ways to deal with the protections against cross-origin retrieval:

  1. CORS headers -- this is ideal, but you need the cooperation of the third-party server
  2. JSONP -- not appropriate for streaming content and you typically need the cooperation of the third-party server
  3. Iframes and inter-window munication -- probably not appropriate for streaming content and you need the cooperation of the third-party server
  4. 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
  5. Server-side proxy -- paratively slow but often the only feasible option

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744298244a4567369.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信