@@ -57,7 +57,6 @@ import { useMouseInElement, useTimestamp } from '@vueuse/core'
5757import { format , intervalToDuration } from ' date-fns'
5858import { saveAs } from ' file-saver'
5959import fixWebmDuration from ' fix-webm-duration'
60- import localforage from ' localforage'
6160import { storeToRefs } from ' pinia'
6261import Swal , { type SweetAlertResult } from ' sweetalert2'
6362import { computed , onBeforeMount , onBeforeUnmount , ref , toRefs , watch } from ' vue'
@@ -103,14 +102,6 @@ const isRecording = computed(() => {
103102 return mediaRecorder .value !== undefined && mediaRecorder .value .state === ' recording'
104103})
105104
106- const cockpitVideoDB = localforage .createInstance ({
107- driver: localforage .INDEXEDDB ,
108- name: ' CockpitVideoDB' ,
109- storeName: ' cockpit-video-db' ,
110- version: 1.0 ,
111- description: ' Local backups of Cockpit video recordings to be retrieved in case of failure.' ,
112- })
113-
114105onBeforeMount (async () => {
115106 // Set initial widget options if they don't exist
116107 if (Object .keys (miniWidget .value .options ).length === 0 ) {
@@ -205,7 +196,7 @@ const startRecording = async (): Promise<SweetAlertResult | void> => {
205196 let chunks: Blob [] = []
206197 mediaRecorder .value .ondataavailable = async (e ) => {
207198 chunks .push (e .data )
208- await cockpitVideoDB .setItem (fileName , chunks )
199+ await videoStore . videoRecoveryDB .setItem (fileName , chunks )
209200 }
210201
211202 mediaRecorder .value .onstop = () => {
@@ -216,7 +207,7 @@ const startRecording = async (): Promise<SweetAlertResult | void> => {
216207 fixWebmDuration (blob , Date .now () - timeRecordingStart .value .getTime ()).then ((fixedBlob ) => {
217208 saveAs (fixedBlob , ` ${fileName }.webm ` )
218209 saveAs (logBlob , ` ${fileName }.ass ` )
219- cockpitVideoDB .removeItem (fileName )
210+ videoStore . videoRecoveryDB .removeItem (fileName )
220211 })
221212 chunks = []
222213 mediaRecorder .value = undefined
0 commit comments