Player

class Player(eventListener: EventListener)

The central component to start playing audio

The player uses load() to get a Track that can be played with play(). The player supports other basic operations like pausing and stopping. Getting audio is by using provide(). Whether it can provide can be gotten from canProvide().

See also

Parameters

eventListener

The EventListener called when the playback's state is changed

Constructors

Link copied to clipboard
fun Player(eventListener: EventListener, passedConfig: Config)
Link copied to clipboard
fun Player(eventListener: EventListener)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun canProvide(): Boolean

Whether the player has audio to provide with provide

Link copied to clipboard
fun getExtractor(url: String): Extractor
Link copied to clipboard
fun load(query: String, loadId: String)

Load a Track from a query

Link copied to clipboard
fun pause()

Pauses the current Track

Link copied to clipboard
fun play(track: Track)

Play a Track and stops the current Track if there is one

Link copied to clipboard
fun provide(): ByteArray

Provides 20ms of audio

Link copied to clipboard
fun resume()

Resumes the current Track

Link copied to clipboard
fun stop()

Stops the current Track

Properties

Link copied to clipboard
var currentTrack: Track? = null

The active Track

Link copied to clipboard
val eventListener: EventListener
Link copied to clipboard
var paused: Boolean = false