Skip to content

Commit

Permalink
feat(webcam): keep showing webcam after refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Sep 14, 2022
1 parent 5997718 commit 1f79d77
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/client/internals/RecordingControls.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<script setup lang="ts">
import { useLocalStorage } from '@vueuse/core'
import { onMounted, watch } from 'vue'
import { recorder } from '../logic/recording'
import { currentCamera, showRecordingDialog } from '../state'
import DevicesList from './DevicesList.vue'
Expand All @@ -12,12 +14,22 @@ const {
toggleAvatar,
} = recorder
const previousAvatar = useLocalStorage('slidev-webcam-show', false)
watch(showAvatar, () => {
previousAvatar.value = showAvatar.value
})
function toggleRecording() {
if (recording.value)
stopRecording()
else
showRecordingDialog.value = true
}
onMounted(() => {
if (previousAvatar.value && !showAvatar.value)
toggleAvatar()
})
</script>

<template>
Expand Down

0 comments on commit 1f79d77

Please sign in to comment.