fix(camera-recorder): stop camera on navigation (#782)

* Stopping camera when user switches to another page

* Missing ;
This commit is contained in:
Isaiah 2023-11-29 07:58:07 -05:00 committed by GitHub
parent 7a70dbbe0c
commit 80e46c9292
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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();