mpvplayer

package
v0.0.0-...-d5b2c6c Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventConsumer

type EventConsumer interface {
	// create event that goes from mpv backend (this package) to a UI frontend
	SendEvent(event UiEvent)
}

type Player

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

func NewPlayer

func NewPlayer(logger logger.LoggerInterface) (player *Player, err error)

func (*Player) AddToQueue

func (p *Player) AddToQueue(item *QueueItem)

func (*Player) AdjustVolume

func (p *Player) AdjustVolume(increment int) error

func (*Player) ClearQueue

func (p *Player) ClearQueue()

accessed from gui context

func (*Player) DeleteQueueItem

func (p *Player) DeleteQueueItem(index int)

func (*Player) EventLoop

func (p *Player) EventLoop()

func (*Player) GetPlayingTrack

func (p *Player) GetPlayingTrack() (QueueItem, error)

accessed from background context

func (*Player) GetQueueCopy

func (p *Player) GetQueueCopy() PlayerQueue

func (*Player) GetQueueItem

func (p *Player) GetQueueItem(index int) (QueueItem, error)

func (*Player) GetTimePos

func (p *Player) GetTimePos() float64

func (*Player) GetVolume

func (p *Player) GetVolume() int64

func (*Player) IsPaused

func (p *Player) IsPaused() (bool, error)

func (*Player) IsPlaying

func (p *Player) IsPlaying() (playing bool, err error)

func (*Player) IsSeekable

func (p *Player) IsSeekable() (bool, error)

func (*Player) IsSeeking

func (p *Player) IsSeeking() (bool, error)

func (*Player) IsSongLoaded

func (p *Player) IsSongLoaded() (bool, error)

func (*Player) MoveSongDown

func (p *Player) MoveSongDown(index int)

func (*Player) MoveSongUp

func (p *Player) MoveSongUp(index int)

func (*Player) NextTrack

func (p *Player) NextTrack() error

func (*Player) OnPaused

func (p *Player) OnPaused(cb func())

remote.ControlledPlayer callbacks

func (*Player) OnPlaying

func (p *Player) OnPlaying(cb func())

func (*Player) OnSeek

func (p *Player) OnSeek(cb func())

func (*Player) OnSongChange

func (p *Player) OnSongChange(cb func(track remote.TrackInterface))

func (*Player) OnStopped

func (p *Player) OnStopped(cb func())

func (*Player) Pause

func (p *Player) Pause() (err error)

Pause toggles playing music If a song is playing, it is paused. If a song is paused, playing resumes. If stopped, the song starts playing. The state after the toggle is returned, or an error.

func (*Player) Play

func (p *Player) Play() error

func (*Player) PlayNextTrack

func (p *Player) PlayNextTrack() error

func (*Player) PlayUri

func (p *Player) PlayUri(uri, coverArtId string, song remote.TrackInterface) error

func (*Player) PreviousTrack

func (p *Player) PreviousTrack() (err error)

func (*Player) Quit

func (p *Player) Quit()

func (*Player) RegisterEventConsumer

func (p *Player) RegisterEventConsumer(consumer EventConsumer)

func (*Player) Seek

func (p *Player) Seek(increment int) error

func (*Player) SeekAbsolute

func (p *Player) SeekAbsolute(position int) error

func (*Player) SetVolume

func (p *Player) SetVolume(percentValue int) error

func (*Player) Shuffle

func (p *Player) Shuffle()

func (*Player) Stop

func (p *Player) Stop() error

func (*Player) Test

func (p *Player) Test()

type PlayerQueue

type PlayerQueue []QueueItem

type QueueItem

type QueueItem struct {
	Id          string
	Uri         string
	Title       string
	Artist      string
	Duration    int
	Album       string
	TrackNumber int
	CoverArtId  string
	DiscNumber  int
	Year        int
	Genre       string
}

func (QueueItem) GetAlbum

func (q QueueItem) GetAlbum() string

func (QueueItem) GetAlbumArtist

func (q QueueItem) GetAlbumArtist() string

func (QueueItem) GetArtist

func (q QueueItem) GetArtist() string

func (QueueItem) GetDiscNumber

func (q QueueItem) GetDiscNumber() int

func (QueueItem) GetDuration

func (q QueueItem) GetDuration() int

func (QueueItem) GetGenre

func (q QueueItem) GetGenre() string

func (QueueItem) GetId

func (q QueueItem) GetId() string

func (QueueItem) GetTitle

func (q QueueItem) GetTitle() string

func (QueueItem) GetTrackNumber

func (q QueueItem) GetTrackNumber() int

func (QueueItem) GetUri

func (q QueueItem) GetUri() string

func (QueueItem) GetYear

func (q QueueItem) GetYear() int

func (QueueItem) IsValid

func (q QueueItem) IsValid() bool

type StatusData

type StatusData struct {
	Volume   int64
	Position int64
	Duration int64
}

StatusData is a player progress report for the UI

type UiEvent

type UiEvent struct {
	Type UiEventType
	Data interface{}
}

type UiEventType

type UiEventType int
const (
	// song stopped at end of queue, data: nil
	EventStopped UiEventType = iota
	// new song started playing, data: QueueItem
	EventPlaying
	// unpaused/paused song, data: QueueItem
	EventUnpaused
	EventPaused
	// UI status update, data: StatusData
	EventStatus
)

Jump to

Keyboard shortcuts

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