How can I avoid the CORS restriction for web audio api?

I am trying to create some visualization for an audio stream. But I ran into a CORS problem when I try to access the original audio data using the createMediaElementSource() function.

Is there a way to avoid this limitation and get raw audio from a stream of a different origin? Perhaps using WebSockets?

+3
source share
1 answer

There are five ways to protect against cross-searching:

  • CORS headers are perfect, but you need third-party server collaboration.
  • JSONP is not suitable for streaming content, and you usually require third-party server collaboration.
  • IFrames and inter-window communication may not be suitable for streaming content, and you need third-party server collaboration.
  • Disabling browser protection - you must launch the browser in custom mode, and you should not use this browser for anything else.
  • Server proxy is a relatively slow but often the only option
+4
source

All Articles