SoundPlayer

A sound player that plays audio from a given URL.

This is a platform-agnostic implementation for the Kotlin Multiplatform SDK. Platform-specific implementations are provided via expect/actual.

Example usage:

SoundPlayer.play(SoundPlayerOptions(soundUrl = "https://example.com/sound.mp3"))

Functions

Link copied to clipboard

Attaches listeners for playback events.

Link copied to clipboard
suspend fun play(options: SoundPlayerOptions)

Plays the sound from the provided options.

Link copied to clipboard
suspend fun preload(options: SoundPlayerOptions)

Preloads the sound for faster playback.

Link copied to clipboard
suspend fun stop()

Stops the currently playing sound.

Link copied to clipboard
suspend fun stopAndReinitialize()

Stops and reinitializes the audio player.