How to play audio byte array (not file!) with JavaScript in a browser

后端 未结 4 2063
终归单人心
终归单人心 2021-02-08 14:51

For mostly security reasons, I\'m not allowed to store a WAV file on the server to be accessed by a browser. What I have is a byte array contains audio data (the data portion of

4条回答
  •  悲哀的现实
    2021-02-08 15:48

    If you have the bytes on the server then I would suggest that you create some kind of handler on the server that will stream the bytes to the response as a wav file. This "file" would only be in memory on the server and not on disk. Then the browser can just handle it like a normal wav file. More details on the server stack would be needed to give more information on how this could be done in your environment.

提交回复
热议问题