webaudio-wav-stream-player
v1.0.11
Published
Instantly play wav streams in your browser using fetch streaming and web audio
Downloads
24
Readme
webaudio-wav-stream-player
No latency wav stream player using fetch streaming API and WebAudio (Chrome-only)
Example : http://revolunet.github.io/webaudio-wav-stream-player
Usage
import WavPlayer from 'webaudio-wav-stream-player';
let player = new WavPlayer();
player.play('http//domain/path/to/stream.wav');
player.stop();
FAQ
- you need CORS on the server streaming .wav
Example express proxy to add CORS header to some remote uri
// proxy /proxy/http://path/to/stream.wav
app.get('/proxy/*', function (req, res, next) {
let remoteReq = request.get(req.params[0]);
req.on("close", function() {
remoteReq.abort();
res.end();
});
req.pipe(remoteReq).pipe(res);
});
Inspiration : http://stackoverflow.com/questions/38589614/webaudio-streaming-with-fetch-domexception-unable-to-decode-audio-data/39988015#39988015