A promise that resolves to the emitter.
Obtains the playback position in milliseconds.
If no track is currently loaded / playing, the function returns 0.
A promise with the playback position.
Pauses playback.
If no track is currently loaded / playing, this function does nothing.
A promise that resolves when the playback has been paused.
Plays a track by its URI.
When positionMs
is < 0, this function immediately throws an error
instead of returning a rejected promise.
auth
may change freely during runtime. The plugin will handle the
required login / logout processes automatically when a new track is played.
The URI of the track to play.
Valid authorization data.
The position (in millseconds) to start playing from. Must be >= 0.
A promise that resolves when the track starts playing.
Resumes playback.
If no track is currently loaded / playing, this function returns
a rejected Promise with an error of type not_playing
.
A promise that resolves when the playback has been resumed.
Seeks to the given position in the current track.
If no track is currently loaded / playing, this function returns
a rejected Promise with an error of type not_playing
.
When positionMs
is < 0, this function immediately throws an error
instead of returning a rejected promise.
The position (in millseconds) to seek to. Must be >= 0.
A promise that resolves when the seek has been done.
Generated using TypeDoc
Obtains an event emitter that relays the events fired by the native SDKs.
The emitter will be created once and then returned on subsequent invocations. The emitter implementation comes from eventemitter3.
The emitted events are the following:
In the case of
loginfailed
,playbackevent
andplaybackerror
, the event contains a payload that describes what happened exactly. The payload is simply the name of the discriminant of the enum in the native SDK without the prefix (usuallykSp
orkSpError
). See the offical documentation here and here for all variants.