getActiveDevice method

Future<VIAudioDevice> getActiveDevice()

Returns active audio device during the call or audio device that will be used for a call if there is no call at this moment.

Active audio device can be later changed if a new device is connected. In this case VIAudioDeviceManager.onAudioDeviceChanged will be triggered.

Implementation

Future<VIAudioDevice> getActiveDevice() async {
  int? device =
      await _channel.invokeMethod<int>('AudioDevice.getActiveDevice');
  if (device == null) {
    _VILog._e('AudioDeviceManager: getActiveDevice: data was null, skipping');
    throw VIException(
      VIClientError.ERROR_INTERNAL,
      'AudioDeviceManager:getActiveDevice: data was null',
    );
  }
  VIAudioDevice audioDevice = VIAudioDevice.values[device];
  return audioDevice;
}