On Chrome 81, the
deviceId field that the
getDevices method returns is empty.
As of Chrome 81, device IDs are not exposed if permission to use devices has not been granted. This change is to protect user privacy.
For the Agora Web SDK, if you get device information before the method call of
Stream.init succeeds, the returned
deviceId may be empty.
You can create temporary streams for media capture to trigger the device permission request and get the device information.
Based on your requirements, create temporary streams for audio or video capture to trigger requests for microphone or camera permissions.
After the streams are initialized, call
getDevicesto get the complete device information.
The capture may fail if no microphone or camera exists, or if the user has disabled these devices. The capture is a workaround and you only need to ensure that the failure does not stop the code execution.
If the capture fails, you may still get empty
labelfields in the returned device list.