All Classes

com.voximplant.sdk.hardware

Interface IAudioDeviceManager



  • public interface IAudioDeviceManager
    Interface that may be used to manage audio devices, i.e. see current active device, select another active device and get the list of available devices.
    Voximplant Android SDK supports the following devices:
    • - earpiece
    • - speaker
    • - wired headset
    • - bluetooth headset

    Default audio device.

    The earpiece is the default audio device for devices that supports telephony feature (android phones). The speaker is the default audio device for android tablets.

    Before a call.

    In case if the audio device was not selected via selectAudioDevice(AudioDevice), it will be selected according to the following priority order:
    • - bluetooth (if connected)
    • - wired headset (if connected)
    • - earpiece (if available)
    • - speaker
    In case if audio device was selected via selectAudioDevice(AudioDevice) and then a higher priority device is connected, the new device will be used for a call. For example, speaker was selected and then bluetooth headset is connected, in this case bluetooth device will be used for a call.

    During the call.

    In case if new audio device (wired headset or bluetooth headset) is connected, active audio device is switched to the new connected audio device.
    In case if active audio device is disconnected (wired or bluetooth headset), active audio device will be selected according to the priority order.
    In case if active audio device is selected via selectAudioDevice(AudioDevice), active audio device is switched to the selected device.
    In case if active audio device is selected via selectAudioDevice(AudioDevice) and then new audio device is connected (wired or bluetooth headset), active audio device is switched to the new audio device. If wired or bluetooth headset will be disconnected during the same call, previously selected audio device becomes active.
    For example:
    1. wired headset is connected
    2. call is started -> wired headset is active device
    3. speaker is selected as active device -> speaker is active device
    4. bluetooth headset is connected -> bluetooth is active device
    5. bluetooth headset is disconnected -> speaker is active device

    Limits:

    1. IAudioDeviceManager should be used only after IClient initialization via Voximplant.getClientInstance(Executor, Context, ClientConfig)
    2. The plug in/out of a wired headset and bluetooth devices is monitored only if a connection to the Voximplant Cloud is active
    3. It is not possible to select an earpiece while wired headset is connected
    • Method Detail

      • enableLoudspeaker

        boolean enableLoudspeaker(boolean useLoudspeaker)
        Deprecated. Since 2.3.4, use selectAudioDevice(AudioDevice)
        Enable/disable loudspeaker. Disabled by default. It is highly recommended to enable loudspeaker after the call is connected.
        Parameters:
        useLoudspeaker - Enable/disable loudspeaker
        Returns:
        true on success, false otherwise
      • getAudioDevices

        java.util.List<AudioDevice> getAudioDevices()
        Returns the list of available audio devices.
        Returns:
        Current list of available audio devices
        Since:
        2.3.4
      • getActiveDevice

        AudioDevice getActiveDevice()
        Returns active audio device during the call or audio device that will be used for a call if there is no calls at this moment.
        Please note that active audio device can be later changed if new device is connected. In this case IAudioDeviceEventsListener.onAudioDeviceChanged(AudioDevice) will be triggered to notify about new active device.
        Returns:
        Selected active audio device
        Since:
        2.3.4
      • selectAudioDevice

        void selectAudioDevice(AudioDevice audioDevice)
        Changes selection of the current active audio device. There are two cases:
        • 1) before a call. The method doesn't activate an audio device, it just selects (i.e. points to) the audio device that will be activated
        • 2) during a call. If the selected audio device is available, the method activates this audio device.
        When the call is ended, selected audio device is reset to the default one.
        Please note that active audio device can be later changed if new device is connected. In this case IAudioDeviceEventsListener.onAudioDeviceChanged(AudioDevice) will be triggered to notify about new active device.
        Parameters:
        audioDevice - Audio device to be set active
        Since:
        2.3.4