webaudio-wav-stream-player

1.0.11 • Public • Published

webaudio-wav-stream-player

No latency wav stream player using fetch streaming API and WebAudio (Chrome-only)

npm license github-issues

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

Package Sidebar

Install

npm i webaudio-wav-stream-player

Weekly Downloads

11

Version

1.0.11

License

MIT

Last publish

Collaborators

  • revolunet