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.58k stars 1.76k forks source link

How to save the recorded video to a path on the disk without dialog? #604

Open Ramin-Bateni opened 4 years ago

Ramin-Bateni commented 4 years ago

I want to save the recorded video to a file in a special path without dialog when I call STOP function.

stopRecording() {
        this.recRTC.stopRecording(this.processVideo.bind(this));
        this.isRecording = false;
        // What should I write here?!...
}
codev0 commented 4 years ago

You can't. It's browser a security policy. https://stackoverflow.com/questions/13348013/download-file-without-opening-download-dialog

Ramin-Bateni commented 4 years ago

@codev0 Thank you for your reply.

Because I'm using the library in a Electron project I could save the blob as a file with fs/fs-extra libraries in node.js.

throttlehead commented 4 years ago

You cannot save a file to the disk, but you can save the blobs to IndexedDB. I'm currently doing this to prevent video loss if the user refreshes mid recording or upload. I recommend using localforage.