I have an audio stream. I'm sending that audio stream to Angular via API. Angular converts stream to URL and it plays. That works perfectly fine.Now I have a requirement of converting stream to URL from Node.js(v16.13.x) side itself. I have referred to some of the documentation, but it doesn't work.
How I convert Stream to URL (Angular)
byteArray = new Uint8Array(byteArray);
const blob = new Blob([byteArray], { type: 'audio/mpeg' });
const url = URL.createObjectURL(blob); //blob:http://localhost:4200/13cc5a20-4910-4d98-9e8c-c18751549dd2
What I tried on Nodejs
const { Blob } = require('node:buffer');
var byteArray = new Uint8Array(data.audioStream.data);
const blob = new Blob([byteArray], { type: 'audio/mpeg' });
const url = URL.createObjectURL(blob); //blob:nodedata:5c331f08-cc3b-4913-a054-1a5b7f65c625
I couldn't play blob:nodedata:5c331f08-cc3b-4913-a054-1a5b7f65c625
this. Am I missing something ? please help me out.