playback

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2025 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlbumSource

type AlbumSource struct {
	ID   unification.ID
	Disc int
}

type EnqueueOpt

type EnqueueOpt struct {
	Clear bool
	Next  bool
	From  int
	Limit int

	Album     *AlbumSource
	Playlist  *unification.ID
	Popular   *unification.ID
	PageEntry *string
}

type Library

type Library interface {
	GetTrack(ctx context.Context, id uuid.UUID) (library.Track, error)
	AddPlayedAlbum(ctx context.Context, album unification.AlbumFull) error
}

type NewStateCB

type NewStateCB func(id uuid.UUID, state *PlayerState)

type Opts

type Opts struct {
	Streaming     *streaming.Client
	Playback      *Playback
	Lib           Library
	Files         *files.Files
	LookupService *lookup.Service
}

type Playback

type Playback struct {
	// contains filtered or unexported fields
}

func Init

func Init(logger *slog.Logger, address string, port int, apiURL string, baseOpts ...basepb.PlaybackOption) (*Playback, error)

func (*Playback) Run

func (p *Playback) Run(ctx context.Context) error

func (*Playback) SetNewStateCB

func (p *Playback) SetNewStateCB(cb NewStateCB)

type Player

type Player struct {
	// contains filtered or unexported fields
}

type PlayerState

type PlayerState struct {
	Playback basepb.PlayerState
	Queue    Queue
}

type Queue

type Queue struct {
	Current int
	Tracks  []unification.Track
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func InitService

func InitService(logger *slog.Logger, opts Opts) *Service

func (*Service) AllStates

func (s *Service) AllStates() map[uuid.UUID]*PlayerState

func (*Service) ClearQueue added in v0.3.2

func (s *Service) ClearQueue(playerID uuid.UUID) error

func (*Service) Enqueue

func (s *Service) Enqueue(ctx context.Context, playerID uuid.UUID, opt EnqueueOpt) error

func (*Service) Pause

func (s *Service) Pause(playerID uuid.UUID) error

func (*Service) Resume

func (s *Service) Resume(playerID uuid.UUID) error

func (*Service) Seek

func (s *Service) Seek(playerID uuid.UUID, pos time.Duration) error

func (*Service) SetVol

func (s *Service) SetVol(playerID uuid.UUID, vol int) error

func (*Service) SkipBackward

func (s *Service) SkipBackward(playerID uuid.UUID) error

func (*Service) SkipForward

func (s *Service) SkipForward(playerID uuid.UUID) error

func (*Service) Stream

func (s *Service) Stream(ctx context.Context, id unification.ID) (io.ReadSeekCloser, error)

Jump to

Keyboard shortcuts

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