@@ -64,27 +64,24 @@ export function SourcePickerDialog({ open, onOpenChange, onSelect }: SourcePicke
6464
6565 const fetchDevices = useCallback ( async ( ) => {
6666 try {
67- // Request permissions explicitly before enumerating devices
68- // This ensures the OS permission prompt is triggered if not already granted
69- // and that device labels are populated correctly
67+ // Use a “test stream” to trigger permission prompt if not already granted
7068 let permissionStream : MediaStream | null = null ;
7169 try {
7270 permissionStream = await navigator . mediaDevices . getUserMedia ( {
7371 video : true ,
7472 audio : true ,
7573 } ) ;
7674 } catch ( permissionError ) {
77- // If permission is denied, show a helpful error message
78- // NotAllowedError is the standard DOMException for permission denials per Media Capture API spec
7975 if ( permissionError instanceof DOMException && permissionError . name === "NotAllowedError" ) {
80- toast . error ( "Camera and microphone permissions are required. Please grant permissions in your system settings." ) ;
76+ toast . error (
77+ "Camera and microphone permissions are required. Please grant permissions in your system settings." ,
78+ ) ;
8179 }
82- // Continue with enumeration - devices will be listed but with generic labels (e.g., 'Camera 1')
83- // Users can still attempt to select devices, which will trigger another permission prompt
8480 } finally {
85- // Stop the permission stream immediately - we only needed it to trigger permissions
8681 if ( permissionStream ) {
87- permissionStream . getTracks ( ) . forEach ( ( track ) => track . stop ( ) ) ;
82+ permissionStream . getTracks ( ) . forEach ( ( track ) => {
83+ track . stop ( ) ;
84+ } ) ;
8885 }
8986 }
9087
@@ -389,7 +386,7 @@ function CameraOnlyTile({ onClick }: { onClick: () => void }) {
389386 < span className = "w-full max-w-full text-center text-sm font-medium" >
390387 No Screen / Camera Only
391388 </ span >
392- < span className = "w-full max-w-full text-center text-xs text-neutral-500 whitespace-normal break-words " >
389+ < span className = "w-full max-w-full text-center text-xs text-neutral-500 whitespace-normal wrap- break-word " >
393390 Record camera feed without screen capture
394391 </ span >
395392 </ div >
0 commit comments