AudioPlayer

interface AudioPlayer

Audio player used to play audio messages.

Properties

Link copied to clipboard
abstract val currentState: AudioState

Current state of the current audio.

Functions

Link copied to clipboard
abstract fun changeSpeed()

Changes the speed of reproduction. Options are 1x, 1.5x and 2x

Link copied to clipboard
abstract fun clearTracks()
Link copied to clipboard
abstract fun currentSpeed(): Float

Current speed of reproduction. Options are 1x, 1.5x and 2x

Link copied to clipboard
abstract fun dispose()

Disposes the MediaPlayer and remove all audios.

Link copied to clipboard
abstract fun pause()

Pauses the current song.

Link copied to clipboard
abstract fun play(sourceUrl: String, audioHash: Int)

Plays an audio track with sourceUrl.

Link copied to clipboard
abstract fun prepare(sourceUrl: String, audioHash: Int)
Link copied to clipboard
abstract fun registerOnAudioStateChange(audioHash: Int, onAudioStateChange: (AudioState) -> Unit)

Subscribing for audio state changes for the audio of the hash

Link copied to clipboard
abstract fun registerOnProgressStateChange(audioHash: Int, onProgressDataChange: (ProgressData) -> Unit)

Subscribing for progress changes for the audio of the hash. The progress is updated every 50ms

Link copied to clipboard
abstract fun registerOnSpeedChange(audioHash: Int, onSpeedChange: (Float) -> Unit)

Subscribing for speed changes for the audio of the hash.

Link copied to clipboard
abstract fun registerTrack(sourceUrl: String, audioHash: Int, position: Int)
Link copied to clipboard
abstract fun removeAudio(audioHash: Int)

Removes the current audio form the reproduction queue and removes the listeners

Link copied to clipboard
abstract fun removeAudios(audioHashList: List<Int>)

Removes the current audios form the reproduction queue and removes the listeners

Link copied to clipboard
abstract fun resetAudio(audioHash: Int)
Link copied to clipboard
abstract fun resume(audioHash: Int)
Link copied to clipboard
abstract fun seekTo(positionInMs: Int, audioHash: Int)

Seeks the audio track of the audio hash to the millisecond position. If the hash is the same of the current playing audio track, the current audio track pauses.

Link copied to clipboard
abstract fun startSeek(audioHash: Int)

Informs the player that seek has started. This can be used to pause the current audio track when seek starts.