fix: stop stream on unmount and showCamera is false

This commit is contained in:
Shariq Ansari 2025-01-03 18:50:08 +05:30
parent d896d8e839
commit 04745fb5e7

View File

@ -13,7 +13,7 @@
</div>
<div v-else>
<div
class="flex flex-col items-center justify-center gap-4 rounded-lg border border-dashed min-h-64 text-ink-gray-5"
class="flex flex-col items-center justify-center gap-4 rounded-lg border border-dashed border-outline-gray-modals min-h-64 text-ink-gray-5"
@dragover.prevent="dragover"
@dragleave.prevent="dragleave"
@drop.prevent="dropfiles"
@ -128,7 +128,7 @@ import FileAudioIcon from '@/components/Icons/FileAudioIcon.vue'
import FileVideoIcon from '@/components/Icons/FileVideoIcon.vue'
import { createToast, formatDate, convertSize } from '@/utils'
import { FormControl, CircularProgressBar, createResource } from 'frappe-ui'
import { ref, onMounted } from 'vue'
import { ref, onMounted, watch, onUnmounted } from 'vue'
const props = defineProps({
doctype: {
@ -383,6 +383,12 @@ function fileIcon(type) {
return FileTextIcon
}
watch(showCamera, (value) => {
if (!value) stopStream()
})
onUnmounted(() => stopStream())
defineExpose({
showFileBrowser,
showWebLink,