checkMicrophonePermissionWeb method
Implementation
Future<String> checkMicrophonePermissionWeb() async {
try {
// Check if mediaDevices API is available
final mediaDevices = web.window.navigator.mediaDevices;
// Try to enumerate devices to check microphone availability
final devices = await mediaDevices.enumerateDevices().toDart;
bool hasMicrophone = false;
for (int i = 0; i < devices.length; i++) {
final device = devices[i];
if (device.kind == 'audioinput') {
hasMicrophone = true;
break;
}
}
if (!hasMicrophone) {
return 'unsupported';
}
// For web, we return 'denied' as default state since we can't check
// permission status without requesting it first
return 'denied';
} catch (e) {
return 'error';
}
}