muse

package
v0.0.0-...-e62810a Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoPlaylistLoaded = errors.New("no playlist loaded")

Functions

This section is empty.

Types

type EventHandler

type EventHandler interface {
	OnSongFinish()
	OnPauseUpdate(pause bool)
}

EventHandler methods are all called in the glib main thread.

type PlayState

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

PlayState wraps the current playback state.

func (*PlayState) Bitrate

func (tc *PlayState) Bitrate() float64

Bitrate reads the bitrate atomically.

func (*PlayState) PlayTime

func (tc *PlayState) PlayTime() (pos, rem float64)

PlayTime reads the playback timestamps atomically.

type Session

type Session struct {
	Playback  *mpvipc.Connection
	PlayState *PlayState
	Command   *exec.Cmd

	// OnAsyncError is called on both nil and non-nil.
	OnAsyncError func(error)
	// contains filtered or unexported fields
}

func NewSession

func NewSession() (*Session, error)

func (*Session) PlayTrack

func (s *Session) PlayTrack(path, next string)

PlayTrack asynchronously loads and plays a file. An error is not returned because mpv doesn't seem to return one regardless.

func (*Session) Seek

func (s *Session) Seek(pos float64) error

func (*Session) SetHandler

func (s *Session) SetHandler(h EventHandler)

func (*Session) SetMute

func (s *Session) SetMute(muted bool) error

func (*Session) SetPlay

func (s *Session) SetPlay(playing bool) error

func (*Session) SetVolume

func (s *Session) SetVolume(perc float64) error

func (*Session) Start

func (s *Session) Start()

Start starts all the event listeners in background goroutines. As such, it is non-blocking.

func (*Session) Stop

func (s *Session) Stop()

Stop stops the mpv session. It does nothing if it's called more than once. A stopped session cannot be reused.

Directories

Path Synopsis
metadata
m3u

Jump to

Keyboard shortcuts

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