setAudioOutputDevice

open suspend fun setAudioOutputDevice(deviceId: String): Boolean

Sets the audio output device for playback (speaker, Bluetooth, headphones).

On Android API 31+, this uses AudioManager.setCommunicationDevice(). On older Android versions, it uses isSpeakerphoneOn or Bluetooth SCO.

Return

true if the device was successfully set, false otherwise

Parameters

deviceId

The device ID to route audio to (e.g., "audio_output_123")