Hey im getting the error shown in the image on 1 l...
# helpdesk
w
Hey im getting the error shown in the image on 1 linux device. For some reason
Hardware.instance.enumerateDevices
returns those devices even if none of them are connected. Thats why the if checks fail and the audioTrack.start will be called.
List<MediaDevice> devices = await Hardware.instance.enumerateDevices();
List<MediaDevice> audioInputs = devices
.where((d) => d.kind == 'audioinput' && d.deviceId.isNotEmpty)
.toList();
List<MediaDevice> videoInputs = devices
.where((d) => d.kind == 'videoinput' && d.deviceId.isNotEmpty)
.toList();
LocalAudioTrack? audioTrack;
LocalVideoTrack? videoTrack;
//Audio part //Need to handle cases at some point where user doesent have camera.
if (audioInputs.isNotEmpty) {
_selectedAudioDevice = audioInputs.first;
audioTrack = await LocalAudioTrack.create(AudioCaptureOptions(
deviceId: _selectedAudioDevice!.deviceId,
));
await audioTrack.start();
}