| > The API has _zero_ provision for streaming MP3. Did you look into Media Source Extensions[0,1]? Fetching and playing the various audio formats is a bit outside the purview of Web Audio. But you can feed streaming MSE into Web Audio. If I recall, you use Web Audio's `AudioContext.createMediaElementSource()` to use a (potentially chunked) MSE source with web audio, but it's been a while since I did this. That said, Media Source Extensions (MSE) is only supported on relatively modern browsers (IE11+) but you should be able to use it to stream mp3 to the Web Audio API on supported browsers. There's also a way to do this without using MSE for older browsers. See the 72lions repo below for an example[2]. It's a bit convoluted, but not as much work as your workaround. As described in the README of the 72lions proof-of-concept: "The moment the first part is loaded then the playback starts immediately and it loads the second part. When the second part is loaded then then I create a new AudioBuffer by combining the old and the new, and I change the buffer of the AudioSourceNode with the new one. At that point I start playing again from the new AudioBuffer." 0. https://developer.mozilla.org/en-US/docs/Web/API/Media_Sourc... 1. http://dalecurtis.github.io/llama-demo/index.html 2. https://github.com/72lions/PlayingChunkedMP3-WebAudioAPI |
Just looking at that clause makes me think perhaps the Web Audio API should have been called something else.
Can you imagine writing "fetching and displaying various image formats is a bit outside the purview of HTML"?
(I realize that's a bit apples 'n oranges.)