player

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2026 License: GPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const UpdateInterval = 250 * time.Millisecond

Variables

View Source
var (
	BaseQueue = queue.NewDurableQueue()
	UserQueue = queue.NewQueue()
)
View Source
var AudioStreamQuality = signals.NewStatefulSignal[*StreamQuality](nil)

Holds the current audio stream quality.

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.

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.

Holds the user-selected repeat mode.

The signal fires whenever the user changes the repeat mode.

View Source
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.

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.

View Source
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 AddTrackToUserQueue(trackId string) error

func AddTracklistToUserQueue added in v1.4.0

func AddTracklistToUserQueue(tracklist []tonearm.Track) error

func CycleRepeatMode

func CycleRepeatMode()

func Next

func Next()

func Pause

func Pause()

func Play

func Play()

func PlayAlbum

func PlayAlbum(albumId string, shuffle bool, position int) error

func PlayArtistTopSongs added in v1.1.0

func PlayArtistTopSongs(artistId string, shuffle bool, position int) error

func PlayPause

func PlayPause()

func PlayPlaylist

func PlayPlaylist(playlistId string, shuffle bool, position int) error

func PlayTrack

func PlayTrack(track tonearm.Track) error

func PlayTrackID added in v1.4.0

func PlayTrackID(trackId string) error

func PlayTrackRadio

func PlayTrackRadio(trackId string, skipSelf bool) error

func PlayTracklist

func PlayTracklist(source tonearm.PlaybackSource, tracklist []tonearm.Track, shuffle bool, position int) error

func Previous

func Previous()

func SeekToPercent

func SeekToPercent(percent float64)

func SeekToPosition

func SeekToPosition(position time.Duration, precise bool)

func SeekToPositionRelative

func SeekToPositionRelative(delta time.Duration)

func SetRepeatMode

func SetRepeatMode(m RepeatMode)

func SetShuffle added in v1.1.0

func SetShuffle(enabled bool)

func SetVolume

func SetVolume(volume float64)

func SkipThroughQueue

func SkipThroughQueue(queue queue.Queue, to int)

func Stop

func Stop()

func ToggleShuffle

func ToggleShuffle()

Types

type Codec added in v1.4.0

type Codec string
const (
	CodecFLAC Codec = "Free Lossless Audio Codec (FLAC)"
	CodecAAC  Codec = "MPEG-4 AAC"
)

func (Codec) String added in v1.4.0

func (c Codec) String() string

type ControllableState

type ControllableState struct {
	HasTrack    bool
	PlayerReady bool
}

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
)

type StreamQuality added in v1.4.0

type StreamQuality struct {
	Codec    Codec
	BitDepth int

	// BitRate is the bitrate in bps if the codec is AAC, otherwise 0.
	BitRate uint32

	// SampleRate is the sample rate in Hz if the codec is FLAC, otherwise 0.
	SampleRate int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL