play

suspend fun play(recording: AudioRecording, device: AudioDevice.Output? = null)

Plays an AudioRecording to completion.

Parameters

recording

The audio to play

device

Optional specific output device

Throws

if playback fails


suspend fun <T> play(recording: AudioRecording, device: AudioDevice.Output? = null, block: suspend (Player) -> T): T

Plays an AudioRecording with manual control via a lambda.

The player is automatically cleaned up when the block exits.

Return

The result from the block

Parameters

recording

The audio to play

device

Optional specific output device

block

The playback control logic

Throws

if playback fails


suspend fun play(audioFlow: AudioFlow, device: AudioDevice.Output? = null)

Plays an AudioFlow to completion (legacy compatibility).

Parameters

audioFlow

The audio flow to play

device

Optional specific output device

Throws

if playback fails