You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Overview
Previously there was no way to track if the SDK is currently prompting
browser for a device permission. For example:
1. Call has camera enabled by default. User visits the call page for the
first time. Browser permission prompt is displayed, but in the meanwhile
camera toggle is showing that camera is enabled (because
`hasBrowserPermission` is true for `prompt` state, and
`optimisticStatus` is `enabled`).
2. Permissions have been reset, and user tries to enable camera. Once
again, browser permission prompt is displayed, but in the meanwhile
camera toggle is showing that camera is enabled.
We now introduce another permission state apart from `prompt`, `granted`
and `denied`: **`prompting`**. This state is in effect while browser
prompt is visible, i.e. when permission state is `prompt` and
`getUserMedia` promise is pending.
### Implementation notes
New browser permission state `prompting` is added to `BrowserPermission`
class.
This state is exposed via the `isPermissionPending$` observable in input
media device manager state.
State hooks for camera and microphone state also return this flag.
Default device toggles support this flag and display the new "?" badge
while permission is pending:

Docs are to follow.
---
There are also two other minor changes in this PR.
The `settled()` check in concurrency.ts is fixed to prevent possible
race conditions. Previously, it was possible to check for `settled()`,
then add more promises to the queue, and `settled()` will resolve
_before_ these newly added promises are resolved.
`isTogglePending` flag is returned from device-related call state hooks.
It can be used to display a loader while camera/microphone are
enabled/disabled. It's not used by our default toggle buttons, but it's
nice to have.
0 commit comments