Skip to content

AudioDeviceEventListener

Lejla Solak edited this page Jun 7, 2023 · 2 revisions



onActiveAudioDeviceChanged(activeAudioDeviceChangedEvent)

Description

Method that is triggered when the currently active audio device has changed.

Arguments

Returns

  • N/A

Example

AudioDeviceEventListener audioDeviceEventListener = new DefaultAudioDeviceEventListener() {
    @Override
    public void onActiveAudioDeviceChanged(@NonNull ActiveAudioDeviceChangedEvent activeAudioDeviceChangedEvent) {
        String name = activeAudioDeviceChangedEvent.getActiveAudioDevice().getName();
        Log.d("WebRTC", String.format("Active audio device changed, now using %s", name));
    }
});



onAvailableAudioDevicesChanged(availableAudioDevicesChangedEvent)

Description

Method that is triggered when the currently available audio devices have changed i.e. when a new audio device is connected or previously connected audio device is disconnected.

Arguments

Returns

  • N/A

Example

AudioDeviceEventListener audioDeviceEventListener = new DefaultAudioDeviceEventListener() {
    @Override
    public void onAvailableAudioDevicesChanged(@NonNull AvailableAudioDevicesChangedEvent availableAudioDevicesChangedEvent) {
        Log.d("WebRTC", "Available audio devices have changed.");
        updateListOfAvailableAudioDevices(availableAudioDevicesChangedEvent.getAvailableAudioDevices());
    }
});

Tutorials

Migration guides

Reference documentation

Clone this wiki locally