JavaPlayer

class JavaPlayer(suspendingPlayer: Player) : CoroutineScope, JavaEventSource<Event>

Wrapper class for Player which replaces suspending functions by using CompletableFuture.

See also

Constructors

Link copied to clipboard
constructor(suspendingPlayer: Player)

Properties

Link copied to clipboard
Link copied to clipboard

All events received using a Flow.Publisher

Link copied to clipboard

whether the playback is currently paused or not

Link copied to clipboard
val playingTrack: Track?

the currently playing Track

Link copied to clipboard

the position of the current song the player is at (-1 if playingTrack is null)

Link copied to clipboard

the underlying delegate EventSource

Link copied to clipboard
val volume: Int

the current volume of this player

Functions

Link copied to clipboard
open fun <E : Event> on(eventType: Class<E>, handler: Consumer<E>)

Creates an event handler which executes Consumer for every event of eventType.

Link copied to clipboard
fun pause(doPause: Boolean = true): CompletableFuture<Void>

Pauses/unpauses playback of the current track.

Link copied to clipboard
fun playTrack(track: Track): CompletableFuture<Void>

Changes the currently playing track to track.

Link copied to clipboard

Seeks to a specific position in the current playback.

Link copied to clipboard

Stops playback of the currently playing track.

Link copied to clipboard

Unpauses the playback

Link copied to clipboard

Creates an EqualizerBuilder to update equalizer config. This does not update the equalizers. To update equalizers please call EqualizerBuilder.apply