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) <noreply@anthropic.com>main
parent
55cde08790
commit
f7d4834bb6
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue