Skip to content

Collection of handy online tools for developers, with great UX.

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

Isaiah80e46c92922c
diff --git a/src/tools/camera-recorder/camera-recorder.vue b/src/tools/camera-recorder/camera-recorder.vue
index 34ce39aa..23fedd8c 100644
--- a/src/tools/camera-recorder/camera-recorder.vue
+++ b/src/tools/camera-recorder/camera-recorder.vue
@@ -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();