Open cjambrosi opened 1 year ago
Yes this is possible using timeSlice to make data available on a certain interval. see this link for more info on this API.
Create a recorder the following options:
recorderType: MediaStreamRecorder, // need to set this recorderType to pass the timeSlice option.
timeSlice: 1000, // or another value that you want to make the recording available on.
i.e.:
var myRecorder = new RecordRTC(stream, {
type: "audio",
recorderType: MediaStreamRecorder,
mimeType: "audio/webm;codecs=opus",
timeSlice: 1000,
});
Since a blob is now created for every second, we have to create one big blob when you pause the recorder:
myRecorder.pauseRecording();
var internal = myRecorder.getInternalRecorder();
if (internal && internal.getArrayOfBlobs) {
var blob = new Blob(internal.getArrayOfBlobs(), {
type: "audio",
});
}
const myUrl = URL.createObjectURL(blob));
Based on this great example on handling onDataAvailable with recordRTC.
Excellent! Thank you very much @damiaanh. I'll try here
Is it possible to pause and resume like WhatsApp Web? For example, when I click on the pause button, get the audio recorded so far?
If not, can someone give me an idea how to do it?