muaz-khan / RecordRTC

RecordRTC is WebRTC JavaScript library for audio/video as well as screen activity recording. It supports Chrome, Firefox, Opera, Android, and Microsoft Edge. Platforms: Linux, Mac and Windows.
https://www.webrtc-experiment.com/RecordRTC/
MIT License
6.52k stars 1.75k forks source link

Save each ondataavailable blob to disk storage? #685

Open trackedsupport opened 3 years ago

trackedsupport commented 3 years ago

I am trying to save the blobs from the ondataavailable callback to local disk storage (indexeddb) so then I can later grab and upload.

ondataavailable: function(blob) {
      RecordRTC.writeToDisk({video: blob});
}

So then I can later retrieve and update to the server (hopefully looping over the blobs)...

DiskStorage.Fetch('video', function(dataURL) {
      upload(dataURL)
});

Is there a way to do this? It looks like you can only store the complete blob and retrieve only that.

germanoroettgers commented 3 years ago

I have exactly the same question. I need to sync the recording with the indexDb to later upload it to the server. So even if the user closes the app window the recording will not be lost

dinceremre commented 3 years ago

I have exactly the same question. I need to sync the recording with the indexDb to later upload it to the server. So even if the user closes the app window the recording will not be lost

Hi , any progress so far? stuck with the same issue. regards

trackedsupport commented 3 years ago

I ended up making my own solution.

dengshicheng1996 commented 3 years ago

I ended up making my own solution. Could you please provide a simple demo for me to learn

trackedsupport commented 3 years ago

I used https://dexie.org/. Something like this should work.

var db = new Dexie("Recordings");
db.version(1).stores({  blobs: "++id" });
recorder = new MediaRecorder(media_stream);
recorder.ondataavailable = function(e) { db.blobs.put({ blob_data: e.data }) }
recorder.start(5000)