The code below is working properly in the chrome browser:
For microphone:
navigator.permissions.query({name: 'microphone'})
.then((permission) => {
console.log("microphone state", permission.state);
}).catch((error) => {
console.log('Got error :', error);
})
For camera:
navigator.permissions.query({name: 'camera'})
.then((permission) => {
console.log("camera state", permission.state);
}).catch((error) => {
console.log('Got error :', error);
})
The same code above is not working in the Firefox browser where I am getting the following errors:
For microphone: Got error:
TypeError: "'name' member of PermissionDescriptor 'microphone' is not a valid value for enumeration PermissionName."
For camera: Got error:
TypeError: "'name' member of PermissionDescriptor 'camera' is not a valid value for enumeration PermissionName."
Anyone having an idea how to get the user media permission state for camera and microphone in the Firefox browser?
Thanks.