FCE-2803: Add permissions helpers#481
Conversation
There was a problem hiding this comment.
Pull request overview
Adds permission-related helpers to the React Native mobile client, including runtime warnings around getUserMedia permission state and new exported hooks for querying/requesting camera/microphone access. Updates the example app to request permissions up front and route users to OS settings when denied.
Changes:
- Patch
navigator.mediaDevices.getUserMediato log warnings when camera/mic permissions aren’t granted. - Add
useCameraPermissions/useMicrophonePermissionshooks to the mobile-client public API. - Update the
fishjam-chatexample preview flow to request permissions and show an “Open Settings” fallback.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/mobile-client/src/webrtc-polyfill.ts | Registers a new getUserMedia patch during globals setup. |
| packages/mobile-client/src/overrides/getUserMedia.ts | Implements the permission-status warning wrapper around getUserMedia. |
| packages/mobile-client/src/index.ts | Exports new permission hooks from the package entrypoint. |
| packages/mobile-client/src/hooks/usePermissions.ts | Adds hooks for querying/requesting camera/microphone permissions. |
| examples/mobile-client/fishjam-chat/hooks/useMediaPermissions.ts | New example hook to request media permissions and expose settings navigation. |
| examples/mobile-client/fishjam-chat/app/room/preview.tsx | Integrates the new permissions flow into the preview screen UI/initialization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
examples/mobile-client/fishjam-chat/hooks/useMediaPermissions.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
Add
useCameraPermissionsanduseMicrophonePermissionshooks to@fishjam-cloud/react-native-clientfor querying and requesting camera/microphone permissions. PatchgetUserMediato log warnings when called without granted permissions.Update the example app (fishjam-chat) to request permissions before initializing devices and show an "Open Settings" fallback when permissions are denied.
Motivation and Context
There was no built-in way for consumers of the mobile SDK to check or request media permissions. Developers had to wire up platform-specific permission logic themselves. This also meant
getUserMediacould silently fail when permissions were missing.Documentation impact
Types of changes
not work as expected)