Skip to content

Commit

Permalink
video: Wan users when videos are being processed in background
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaellehmkuhl committed Mar 6, 2024
1 parent 5df3160 commit cd3ed0e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/stores/video.ts
Expand Up @@ -425,6 +425,17 @@ export const useVideoStore = defineStore('video', () => {
})
})

const areThereVideosProcessing = computed(() => {
const dateNow = new Date(timeNow.value)

return keysAllUnprocessedVideos.value.some((recordingHash) => {
const info = unprocessedVideos.value[recordingHash]
const dateLastProcessingUpdate = new Date(info.dateLastProcessignUpdate ?? 0)
const secondsSinceLastProcessingUpdate = differenceInSeconds(dateNow, dateLastProcessingUpdate)
return info.dateFinish !== undefined && secondsSinceLastProcessingUpdate < 10
})
})

// Process videos that were being recorded when the app was closed
const processUnprocessedVideos = async (): Promise<void> => {
if (keysFailedUnprocessedVideos.value.isEmpty()) return
Expand Down Expand Up @@ -595,6 +606,7 @@ export const useVideoStore = defineStore('video', () => {
downloadTempVideoDB,
keysAllUnprocessedVideos,
keysFailedUnprocessedVideos,
areThereVideosProcessing,
processUnprocessedVideos,
discardUnprocessedVideos,
temporaryVideoDBSize,
Expand Down
10 changes: 10 additions & 0 deletions src/views/ConfigurationVideoView.vue
Expand Up @@ -50,6 +50,16 @@
</div>
</div>

<div v-if="videoStore.areThereVideosProcessing" class="max-w-[50%] bg-slate-100 rounded-md p-6 border mb-8">
<div class="flex justify-center w-full mb-4 text-2xl font-semibold text-center align-center text-slate-500">
<span>Processing videos</span>
<span class="ml-2 mdi mdi-loading animate-spin" />
</div>
<p class="text-center text-slate-400">
There are videos being processed in background. Please wait until they are finished to download or discard.
</p>
</div>

<div v-if="availableVideosAndLogs.isEmpty()" class="max-w-[50%] bg-slate-100 rounded-md p-6 border">
<p class="mb-4 text-2xl font-semibold text-center text-slate-500">No videos available.</p>
<p class="text-center text-slate-400">
Expand Down

0 comments on commit cd3ed0e

Please sign in to comment.