hasMicAccess method
Queries current window for microphone permission. Returns true if permission is granted, false otherwise. Documentation: https://developer.mozilla.org/en-US/docs/Web/API/Permissions/query
Implementation
@override
Future<bool> hasMicAccess() async {
logLocalEvent("checkPermissionForMicrophone");
try {
final descriptor = {"name": "microphone"}.jsify() as JSObject;
final perm = await _webPermissionsDelegate.query(descriptor).toDart;
if (perm.state == "granted") {
return true;
} else if (perm.state == "prompt") {
return false;
} else {
return false;
}
} catch (e) {
printDebug("Failed to query microphone permission");
printDebug(e);
return false;
}
}