From 7c1dfda7549ae3df581bc105c33d2121ba26af45 Mon Sep 17 00:00:00 2001 From: Rafael Araujo Lehmkuhl Date: Tue, 21 Nov 2023 17:22:05 -0300 Subject: [PATCH] Offer download of video recording backups if they are available Remove them, independently if they were downloaded or not. --- src/components/mini-widgets/MiniVideoRecorder.vue | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/mini-widgets/MiniVideoRecorder.vue b/src/components/mini-widgets/MiniVideoRecorder.vue index f06607f33..aeb8569cc 100644 --- a/src/components/mini-widgets/MiniVideoRecorder.vue +++ b/src/components/mini-widgets/MiniVideoRecorder.vue @@ -118,6 +118,16 @@ onBeforeMount(async () => { } } addScreenStream() + + const videoKeys = await cockpitVideoDB.keys() + videoKeys.forEach(async (savedVideoName) => { + const videoBlobArray: Blob[] = (await cockpitVideoDB.getItem(savedVideoName)) as Blob[] + const blob = videoBlobArray.reduce((a, b) => new Blob([a, b], { type: 'video/webm' })) + fixWebmDuration(blob, Date.now() - timeRecordingStart.value.getTime()).then((fixedBlob) => { + saveAs(fixedBlob, savedVideoName) + }) + await cockpitVideoDB.removeItem(savedVideoName) + }) }) const toggleRecording = async (): Promise => {