Recording the audio stream

Joined
Sep 12, 2022
Messages
2
Reaction score
0
async function record(stream, ms) {
const rec = new MediaRecorder(stream), data = [];
rec.ondataavailable = e => data.push(e.data);
rec.start();
const stopped = new Promise((resolve, reject) => {
rec.onstop = resolve;
rec.onerror = e => reject(e.error);
});
await Promise.all([stopped, wait(ms).then(() => rec.stop())]);
return new Blob(data, { type: data[0].type });
}
The above code, is not recording the audio stream. someone help is great
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top