From f7d4834bb6c3a749da05291f992e947ec54647e4 Mon Sep 17 00:00:00 2001 From: name Date: Sat, 11 Apr 2026 20:14:33 -0700 Subject: [PATCH] request camera permission on intro page load Prompt for webcam access early so the permission dialog appears before the user reaches the game. Stream is immediately stopped after permission is granted. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/pages/IntroPage.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pages/IntroPage.tsx b/src/pages/IntroPage.tsx index 18cb02d..0624296 100644 --- a/src/pages/IntroPage.tsx +++ b/src/pages/IntroPage.tsx @@ -1,3 +1,4 @@ +import { useEffect } from 'react' import { useNavigate } from 'react-router-dom' import { ROUTE_PATHS } from '../app/route-paths' import { playSound, SFX_BUTTON_DEFAULT } from '../lib/sounds' @@ -16,6 +17,12 @@ const UNR_URL = 'https://www.unr.edu' export function IntroPage() { const navigate = useNavigate() + useEffect(() => { + navigator.mediaDevices.getUserMedia({ video: true }) + .then((stream) => stream.getTracks().forEach((t) => t.stop())) + .catch(() => {}) + }, []) + const goFullscreen = () => { document.documentElement.requestFullscreen().catch(() => {}) navigate(ROUTE_PATHS.home)