How can you play a recorded audio blob on the client side using howler.js?

2.8k views Asked by At

The purpose is to record an audio file on the client and play it using the blob URL without using an HTTP GET.

The logic I have looks something like this:

var blob = "blob:null/5fa0fa6d-0b2a-4be6-a762-c81e4bf88f0d";
var url = (window.URL || window.webkitURL ).createObjectURL(blob);
var sound = new Howl({
  src: [url]
});
sound.play();

1

There are 1 answers

1
HandDot On

You can use URLs or base64 data URIs in Howl's src. https://github.com/goldfire/howler.js#options

and I created example using base64 src. https://stackblitz.com/edit/js-nylkdl?file=index.js

cheers