Stopping camera when user switches to another page

This commit is contained in:
Isaiah 2023-11-28 10:18:31 -05:00
parent 7a70dbbe0c
commit f22b1c0ec8

View file

@ -28,6 +28,7 @@ const permissionCannotBePrompted = ref(false);
const {
stream,
start,
stop,
enabled: isMediaStreamAvailable,
} = useUserMedia({
constraints: computed(() => ({
@ -83,6 +84,8 @@ watchEffect(() => {
}
});
onBeforeUnmount(() => stop())
async function requestPermissions() {
try {
await ensurePermissions();