File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,14 +39,15 @@ export const CameraSelector = ({
3939} : CameraSelectorProps ) => {
4040 const cameraEnabled = selectedCameraId !== null ;
4141 const triggerRef = useRef < HTMLButtonElement > ( null ) ;
42- const { state : permissionState , requestPermission } =
43- useMediaPermission ( "camera" ) ;
44-
45- const permissionSupported = permissionState !== "unsupported" ;
46- const hasDeviceAccess = availableCameras . length > 0 ;
47- const hasAccess = permissionGranted || hasDeviceAccess || cameraEnabled ;
48- const shouldRequestPermission =
49- permissionSupported && permissionState !== "granted" && ! hasAccess ;
42+ const { requestPermission } = useMediaPermission ( "camera" ) ;
43+
44+ // "Has access" tracks only the real browser grant — a live device or the
45+ // authoritative permission flag the offscreen document reports — never a
46+ // remembered device selection. A remembered camera must not hide that
47+ // Chrome has reset the grant, otherwise the panel shows an empty picker
48+ // with no way to recover from here.
49+ const hasAccess = permissionGranted || availableCameras . length > 0 ;
50+ const shouldRequestPermission = ! hasAccess ;
5051
5152 const statusPillDisabled = ! shouldRequestPermission && ! cameraEnabled ;
5253
Original file line number Diff line number Diff line change @@ -39,14 +39,14 @@ export const MicrophoneSelector = ({
3939} : MicrophoneSelectorProps ) => {
4040 const micEnabled = selectedMicId !== null ;
4141 const triggerRef = useRef < HTMLButtonElement > ( null ) ;
42- const { state : permissionState , requestPermission } =
43- useMediaPermission ( "microphone" ) ;
44-
45- const permissionSupported = permissionState !== "unsupported" ;
46- const hasDeviceAccess = availableMics . length > 0 ;
47- const hasAccess = permissionGranted || hasDeviceAccess || micEnabled ;
48- const shouldRequestPermission =
49- permissionSupported && permissionState !== "granted" && ! hasAccess ;
42+ const { requestPermission } = useMediaPermission ( "microphone" ) ;
43+
44+ // "Has access" tracks only the real browser grant — a live device or the
45+ // authoritative permission flag the offscreen document reports — never a
46+ // remembered/default mic selection. The mic defaults to on, so keying off
47+ // the selection would permanently hide a reset grant behind an "On" pill.
48+ const hasAccess = permissionGranted || availableMics . length > 0 ;
49+ const shouldRequestPermission = ! hasAccess ;
5050
5151 const statusPillDisabled =
5252 disabled || ( ! shouldRequestPermission && ! micEnabled ) ;
You can’t perform that action at this time.
0 commit comments