Skip to content

Commit

Permalink
Try to prevent user from closing Cockpit during video record
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaellehmkuhl committed Oct 24, 2023
1 parent 545779c commit e764158
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/components/mini-widgets/MiniVideoRecorder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,21 @@ watch(externalStreams, () => {
updateCurrentStream(savedStream)
}
})
// Try to prevent user from closing Cockpit when a stream is being recorded
watch(isRecording, () => {
if (isRecording.value) {
window.onbeforeunload = () => {
Swal.fire({
text: 'You have a video recording ongoing. Remember to stop it before closing Cockpit, or the record will be lost.',
icon: 'warning',
})
return 'bad idea'
}
} else {
window.onbeforeunload = null
}
})
</script>

<style scoped>
Expand Down

0 comments on commit e764158

Please sign in to comment.