useDevicePermissionStatus initial value
See original GitHub issueWhat happened and what did you expect to happen?
useDevicePermissionStatus hook does not reflect initial value correctly. It always sets the initial value to DevicePermissionStatus.UNSET
and value is updated only when observers detect change in device permissions.
This means that if my let’s say Chrome browser remembers my permissions and does not ask me again, useDevicePermissionStatus is going to return DevicePermissionStatus.UNSET
instead of DevicePermissionStatus.GRANTED
until I change permissions manually again. I cannot even force users to confirm manually each time because meetingManager.invokeDeviceProvider(DeviceLabels.AudioAndVideo)
does nothing when called on Chrome with permissions already granted.
Can the hook be changed to return initial values depending on the outcomes of navigator.mediaDevices.getUserMedia
?
Have you reviewed our existing documentation?
- Amazon Chime SDK for JavaScript GitHub issues
- Amazon Chime SDK React Components Library GitHub issues
- Storybook documentation
- README page
- How-to documentation
- React SDK meeting demo
Reproduction steps
- Log in to meeting using Chrome
- Make sure both audio and video is allowed in the browser
import { useDevicePermissionStatus } from 'amazon-chime-sdk-component-library-react'
const permissionStatus = useDevicePermissionStatus();
- permissionStatus will always be
DevicePermissionStatus.UNSET
until you change the permissions in the browser
Amazon Chime SDK React Components Library version
2.14.0
What browsers are you seeing the problem on?
Chrome
Browser version
97.0.4692.71
Device Information
macOS Big Sur 11.6.2
Meeting and Attendee ID Information.
No response
Browser console logs
Add any other context about the problem here.
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
So this is not convenience but you can follow our logic and call
await navigator.mediaDevices.enumerateDevices();
and check whether the device has label. If they don’t then it means there is no permission given yet.We have renamed the following interfaces in the V3 version to avoid confusion:
DevicePermissionStatus
DeviceLabelTriggerStatus
DevicePermissionStatus.UNSET
DevicePermissionStatus.UNTRIGGERED
useDevicePermissionStatus
useDeviceLabelTriggerStatus
MeetingManager.devicePermissionStatus
MeetingManager.deviceLabelTriggerStatus
MeetingManager.devicePermissionsObserver
MeetingManager.deviceLabelTriggerStatusObservers
MeetingManager.subscribeToDevicePermissionStatus()
MeetingManager.subscribeToDeviceLabelTriggerStatus()
MeetingManager.unsubscribeFromDevicePermissionStatus()
MeetingManager.unsubscribeFromDeviceLabelTriggerStatus()
MeetingManager.deviceLabelTriggerChangeObservers
MeetingManager.deviceLabelTriggerObservers
MeetingManager.subscribeToDeviceLabelTriggerChange()
MeetingManager.subscribeToDeviceLabelTrigger()
MeetingManager.unsubscribeFromDeviceLabelTriggerChange()
MeetingManager.unsubscribeFromDeviceLabelTrigger()
And we have documented the limitation of this hook in the storybook: https://aws.github.io/amazon-chime-sdk-component-library-react/?path=/story/sdk-hooks-usedevicelabeltriggerstatus--page
Once the above API is well supported by major browsers, we can update this hook.
Close the issue for now.