Documentation ¶
Index ¶
- func EventHandler(event MediaEvent)
- func Init(player, execpath, ytdlpath, numretries, useragent, socket string) error
- func SetEventHandler(handler func(e MediaEvent))
- type MPV
- func (m *MPV) BufferPercentage() int
- func (m *MPV) Buffering() bool
- func (m *MPV) Call(args ...interface{}) (interface{}, error)
- func (m *MPV) Duration() int64
- func (m *MPV) Exit()
- func (m *MPV) Exited() bool
- func (m *MPV) Finished() bool
- func (m *MPV) Get(prop string) (interface{}, error)
- func (m *MPV) Idle() bool
- func (m *MPV) Init(execpath, ytdlpath, numretries, useragent, socket string) error
- func (m *MPV) LoadFile(title string, duration int64, audio bool, files ...string) error
- func (m *MPV) Muted() bool
- func (m *MPV) Paused() bool
- func (m *MPV) Play()
- func (m *MPV) Position() int64
- func (m *MPV) SeekBackward()
- func (m *MPV) SeekForward()
- func (m *MPV) SendQuit(socket string)
- func (m *MPV) Set(prop string, value interface{}) error
- func (m *MPV) SetLoopMode(mode RepeatMode)
- func (m *MPV) Stop()
- func (m *MPV) ToggleMuted()
- func (m *MPV) TogglePaused()
- func (m *MPV) Volume() int
- func (m *MPV) VolumeDecrease()
- func (m *MPV) VolumeIncrease()
- func (m *MPV) WaitClosed()
- type MediaEvent
- type MediaPlayer
- type MediaPlayerSettings
- type RepeatMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EventHandler ¶ added in v0.3.7
func EventHandler(event MediaEvent)
EventHandler sends a media event to the preset handler.
func SetEventHandler ¶ added in v0.3.7
func SetEventHandler(handler func(e MediaEvent))
SetEventHandler sets the media event handler.
Types ¶
type MPV ¶
type MPV struct { *mpvipc.Connection // contains filtered or unexported fields }
MPV describes the mpv player.
func (*MPV) BufferPercentage ¶ added in v0.3.7
BufferPercentage returns the cache buffered percentage.
func (*MPV) LoadFile ¶
LoadFile loads the provided files into MPV. When more than one file is provided, the first file is treated as a video stream and the second file is attached as an audio stream.
func (*MPV) SeekBackward ¶
func (m *MPV) SeekBackward()
SeekBackward seeks the track backward by 1s.
func (*MPV) SetLoopMode ¶ added in v0.3.7
func (m *MPV) SetLoopMode(mode RepeatMode)
SetLoopMode sets the loop mode.
func (*MPV) VolumeDecrease ¶
func (m *MPV) VolumeDecrease()
VolumeDecrease decreases the volume by 1.
func (*MPV) VolumeIncrease ¶
func (m *MPV) VolumeIncrease()
VolumeIncrease increments the volume by 1.
type MediaEvent ¶ added in v0.3.7
type MediaEvent int
const ( EventNone MediaEvent = iota EventEnd EventStart EventInProgress EventError )
type MediaPlayer ¶
type MediaPlayer interface { Init(execpath, ytdlpath, numretries, useragent, socket string) error Exit() Exited() bool SendQuit(socket string) LoadFile(title string, duration int64, liveaudio bool, files ...string) error Play() Stop() SeekForward() SeekBackward() Position() int64 Duration() int64 Paused() bool TogglePaused() Muted() bool ToggleMuted() SetLoopMode(mode RepeatMode) Idle() bool Finished() bool Buffering() bool BufferPercentage() int Volume() int VolumeIncrease() VolumeDecrease() WaitClosed() Call(args ...interface{}) (interface{}, error) Get(prop string) (interface{}, error) Set(prop string, value interface{}) error }
MediaPlayer describes a media player.
type MediaPlayerSettings ¶ added in v0.3.7
type MediaPlayerSettings struct {
// contains filtered or unexported fields
}
MediaPlayerSettings stores the media player's settings.
type RepeatMode ¶ added in v0.3.7
type RepeatMode int
const ( RepeatModeOff RepeatMode = iota RepeatModeFile RepeatModePlaylist )
Click to show internal directories.
Click to hide internal directories.