Rate this page:

VIAudioDeviceManager

Manages audio devices.

Limitations:

  • It is not possible to select an Earpiece while wired headset is connected.

Limitations for iOS:

  • Wired headsets without a microphone may be recognized and selected as Earpiece.
  • iOS 12 and AirPods: during an active call, Earpiece or Speaker selection may fail if AirPods are used as current active device.

Limitations for Android:

  • The plug in/out of a wired headset and bluetooth devices is monitored only if a connection to the Voximplant Cloud is active.

Methods

callKitConfigureAudioSession

Copy URL

Future<void>

callKitConfigureAudioSession()

iOS only. Initializes AVAudioSession for use with CallKit integration.

Required for the correct CallKIt integration only. Otherwise don't use this method.

Should be called in CXProviderDelegate.performStartCallAction and CXProviderDelegate.performAnswerCallAction.

Returns

  • type:

    Future<void>

callKitReleaseAudioSession

Copy URL

Future<void>

callKitReleaseAudioSession()

iOS only. Restores default AVAudioSession initialization routines.

Required for the correct CallKIt integration only. Otherwise don't use this method.

Must be called if CallKit becomes disabled.

Returns

  • type:

    Future<void>

callKitStartAudio

Copy URL

Future<void>

callKitStartAudio()

iOS only. Starts AVAudioSession.

Required for the correct CallKIt integration only. Otherwise don't use this method.

Should be called in CXProviderDelegate.didActivateAudioSession.

Returns

  • type:

    Future<void>

callKitStopAudio

Copy URL

Future<void>

callKitStopAudio()

iOS only. Stops AVAudioSession.

Required for the correct CallKIt integration only. Otherwise don't use this method.

Should be called in CXProviderDelegate.didDeactivateAudioSession.

Returns

  • type:

    Future<void>

getActiveDevice

Copy URL

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.

Returns

getAudioDevices

Copy URL

Future<List<VIAudioDevice>>

getAudioDevices()

Returns the list of available audio devices.

Returns

selectAudioDevice

Copy URL

Future<void>

selectAudioDevice(

VIAudioDevice

audioDevice
)

Changes selection of the current active audio device.

Before a call. This API does not activate [audioDevice], it just selects the audio device that will be activated.

During a call. If the [audioDevice] is available, the API activates [audioDevice].

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

For iOS. If the application uses CallKit, you should take into consideration:

  • In case if Bluetooth headset is connected, audio routing depends on where a call is answered (from the Bluetooth headset or from the phone screen). Bluetooth hedset will be activated only in case if a call is answered via Bluetooth hedset controls. In other cases the audio will be played via Earpiece.
  • Audio is always routed to Bluetooth headset only if the user selects "Bluetooth headset" as Call Audio Routing in the phone preferences.
  • If audio device is selected before CallKit activates the audio session, it is required to reselect this audio device after CXProviderDelegate.didActivateAudioSession is called. Otherwise audio routing may be reset to default.

Parameters

Returns

  • type:

    Future<void>

Props

onAudioDeviceChanged

Copy URL

VIAudioDeviceChanged?

onAudioDeviceChanged

Callback for getting notified about active audio device changes.

onAudioDeviceListChanged

Copy URL

VIAudioDeviceListChanged?

onAudioDeviceListChanged

Callback for getting notified about new connected or disconnected audio devices.