Documentation
¶
Index ¶
- Constants
- Variables
- func AddTrackToUserQueue(trackId string) error
- func AddTracklistToUserQueue(tracklist []tonearm.Track) error
- func CycleRepeatMode()
- func Next()
- func Pause()
- func Play()
- func PlayAlbum(albumId string, shuffle bool, position int) error
- func PlayArtistTopSongs(artistId string, shuffle bool, position int) error
- func PlayPause()
- func PlayPlaylist(playlistId string, shuffle bool, position int) error
- func PlayTrack(track tonearm.Track) error
- func PlayTrackID(trackId string) error
- func PlayTrackRadio(trackId string, skipSelf bool) error
- func PlayTracklist(source tonearm.PlaybackSource, tracklist []tonearm.Track, shuffle bool, ...) error
- func Previous()
- func SeekToPercent(percent float64)
- func SeekToPosition(position time.Duration, precise bool)
- func SeekToPositionRelative(delta time.Duration)
- func SetRepeatMode(m RepeatMode)
- func SetShuffle(enabled bool)
- func SetVolume(volume float64)
- func SkipThroughQueue(queue queue.Queue, to int)
- func Stop()
- func ToggleShuffle()
- type Codec
- type ControllableState
- type History
- type HistoryEntry
- type PlaybackState
- type PlaybackStatus
- type RepeatMode
- type StreamQuality
Constants ¶
const UpdateInterval = 250 * time.Millisecond
Variables ¶
var ( BaseQueue = queue.NewDurableQueue() UserQueue = queue.NewQueue() )
var AudioStreamQuality = signals.NewStatefulSignal[*StreamQuality](nil)
Holds the current audio stream quality.
var PlaybackQualityChanged = signals.NewStatefulSignal[v1.AudioQuality](v1.AudioQualityHighResLossless)
Holds the definitive playback quality of the currently playing or last played track This can be lower than the chosen quality depending on the tracks original quality or any other reason TIDAL's API may have for offering a lower quality.
The signal fires shortly after the new track information has been broadcasted on the TrackChanged signal. The signal may fire either before the track starts playing in case of a cold start or extremely shortly after a track has started playing in case of gapless playback.
var PlaybackStateChanged = signals.NewStatefulSignal[*PlaybackState](&PlaybackState{Status: PlaybackStatusStopped})
Holds the current playback state including the expected duration and playing position of the currently playing track, if any.
This signal fires when the player changes between playback states such as buffering, playing, paused, or stopped. This signal also fires whenever the expected track duration changes or at least every 250 milliseconds during playback.
var RepeatModeChanged = signals.NewStatefulSignal[RepeatMode](RepeatModeNone)
Holds the user-selected repeat mode.
The signal fires whenever the user changes the repeat mode.
var ShuffleStateChanged = signals.NewStatefulSignal[bool](false)
Holds the seed chosen when the user selects shuffle mode.
The signal fires whenever the user toggles the shuffle mode. The value is 0 if shuffle mode is disabled.
var SourceChanged = signals.NewStatefulSignal[tonearm.PlaybackSource](nil)
var TrackChanged = signals.NewStatefulSignal[tonearm.Track](nil)
Holds the relevant information about the currently playing or last played track. This can be nil if no track is currently playing. This is especially the case when the player has just been created.
The signal fires after the new track information has been retrieved from the TIDAL API but always before the track starts playing.
var VolumeChanged = signals.NewStatefulSignal[float64](settings.Player().GetVolume())
Holds the current volume of the player as reported by playbin
The signal fires whenever the volume changes. This could be either due to user input, external volume control or MPRIS.
Functions ¶
func AddTrackToUserQueue ¶
func AddTracklistToUserQueue ¶ added in v1.4.0
func CycleRepeatMode ¶
func CycleRepeatMode()
func PlayArtistTopSongs ¶ added in v1.1.0
func PlayTrackID ¶ added in v1.4.0
func PlayTrackRadio ¶
func PlayTracklist ¶
func SeekToPercent ¶
func SeekToPercent(percent float64)
func SeekToPosition ¶
func SeekToPositionRelative ¶
func SetRepeatMode ¶
func SetRepeatMode(m RepeatMode)
func SetShuffle ¶ added in v1.1.0
func SetShuffle(enabled bool)
func SkipThroughQueue ¶
func ToggleShuffle ¶
func ToggleShuffle()
Types ¶
type ControllableState ¶
func (*ControllableState) CanControl ¶
func (cs *ControllableState) CanControl() bool
type History ¶
type History struct {
sync.Mutex
Current *signals.StatefulSignal[*HistoryEntry]
Entries *signals.StatefulSignal[[]*HistoryEntry]
}
func (*History) Pop ¶
func (h *History) Pop() *HistoryEntry
func (*History) Push ¶
func (h *History) Push(entry *HistoryEntry)
type HistoryEntry ¶
type HistoryEntry struct {
TrackID string
}
type PlaybackState ¶
type PlaybackState struct {
// Expected duration of the currently playing stream as reported by playbin
Duration time.Duration
// Whether the position was changed by the user
IsSeeking bool
// Current position of the playback as reported by playbin
Position time.Duration
Status PlaybackStatus
Loading bool
}
type PlaybackStatus ¶
type PlaybackStatus string
const ( PlaybackStatusPlaying PlaybackStatus = "playing" PlaybackStatusPaused PlaybackStatus = "paused" PlaybackStatusStopped PlaybackStatus = "stopped" )
type RepeatMode ¶
type RepeatMode int
const ( RepeatModeNone RepeatMode = iota RepeatModeQueue RepeatModeTrack )