Documentation ¶
Index ¶
- func EventHandler(event MediaEvent)
- func Init(player string, properties MediaPlayerProperties) 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(properties MediaPlayerProperties) error
- func (m *MPV) LoadFile(title string, duration int64, audio bool, files [2]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) SeekToPosition(seekpos string)
- func (m *MPV) SendQuit(socket string)
- func (m *MPV) Set(prop string, value interface{}) error
- func (m *MPV) SetLoopMode(mode RepeatMode)
- func (m *MPV) SetPosition(position int64)
- 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 MediaPlayerProperties
- 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 Init ¶
func Init(player string, properties MediaPlayerProperties) error
Init launches the provided player.
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) Init ¶
func (m *MPV) Init(properties MediaPlayerProperties) error
Init initializes and sets up MPV.
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) SeekToPosition ¶ added in v0.4.3
SeekToPosition seeks the track to the given position.
func (*MPV) SetLoopMode ¶ added in v0.3.7
func (m *MPV) SetLoopMode(mode RepeatMode)
SetLoopMode sets the loop mode.
func (*MPV) SetPosition ¶ added in v0.4.3
SetPosition sets the absolute position for the track.
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 EventLoading EventInProgress EventError )
type MediaPlayer ¶
type MediaPlayer interface { Init(properties MediaPlayerProperties) error Exit() Exited() bool SendQuit(socket string) LoadFile(title string, duration int64, liveaudio bool, files [2]string) error Play() Stop() SeekForward() SeekBackward() SeekToPosition(seekpos string) SetPosition(position int64) 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 MediaPlayerProperties ¶ added in v0.4.2
type MediaPlayerProperties struct {
PlayerPath, YtdlPath, UserAgent, SocketPath string
NumRetries string
CloseInstances bool
}
MediaPlayerProperties stores the media player's properties.
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 )