WebAudio streaming with fetch : DOMException: Unable to decode audio data

后端 未结 2 1702
情深已故
情深已故 2021-01-14 18:03

I\'m trying to play an infinite stream coming from the fetch API using Chrome 51. (a webcam audio stream as Microsoft PCM, 16 bit, mono 11025 Hz)

The code works almo

相关标签:
2条回答
  • 2021-01-14 18:45

    Making the wav stream sound correctly implies to add WAV headers to the chunks as Raymond suggested, plus some webaudio magic and paquet ordering checks;

    Some cool guys helped me to setup that module to handle just that and it works beautifully on Chrome : https://github.com/revolunet/webaudio-wav-stream-player

    Now works on Firefox 57+ with some config flags on : https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/getReader#Browser_compatibility

    0 讨论(0)
  • 2021-01-14 19:01

    AudioContext.decodeAudioData just isn't designed to decode partial files; it's intended for "short" (but complete) files. Due to the chunking design of MP3, it sometimes works on MP3 streams, but wouldn't on WAV files. You'll need to implement your own decoder in this case.

    0 讨论(0)
提交回复
热议问题