Documentation ¶
Index ¶
- Variables
- type AudioDevice
- type Equalizer
- type EqualizerBand
- type EqualizerCurve
- type ISO15BandEqualizer
- type MediaInfo
- type Player
- func (p *Player) Continue() error
- func (p *Player) Destroy()
- func (p *Player) Equalizer() Equalizer
- func (p *Player) GetMediaInfo() (MediaInfo, error)
- func (p *Player) GetPeaks() (float64, float64, float64, float64)
- func (p *Player) GetStatus() player.Status
- func (p *Player) GetVolume() int
- func (p *Player) Init(maxCacheMB int) error
- func (p *Player) IsSeeking() bool
- func (p *Player) ListAudioDevices() ([]AudioDevice, error)
- func (p *Player) OnPaused(cb func())
- func (p *Player) OnPlaying(cb func())
- func (p *Player) OnSeek(cb func())
- func (p *Player) OnStopped(cb func())
- func (p *Player) OnTrackChange(cb func())
- func (p *Player) Pause() error
- func (p *Player) PlayFile(url string) error
- func (p *Player) SeekSeconds(secs float64) error
- func (p *Player) SetAudioDevice(deviceName string) error
- func (p *Player) SetAudioExclusive(tf bool)
- func (p *Player) SetEqualizer(eq Equalizer) error
- func (p *Player) SetNextFile(url string) error
- func (p *Player) SetPeaksEnabled(enabled bool) error
- func (p *Player) SetReplayGainOptions(options player.ReplayGainOptions) error
- func (p *Player) SetVolume(vol int) error
- func (p *Player) Stop() error
- type WidthType
Constants ¶
This section is empty.
Variables ¶
var ErrUnitialized error = errors.New("mpv player uninitialized")
Error returned by many Player functions if called before the player has not been initialized.
Functions ¶
This section is empty.
Types ¶
type AudioDevice ¶
type AudioDevice struct { // The name of the audio device. // This is the string to pass to SetAudioDevice. Name string // The description of the audio device. // This is the friendly string that should be used in UIs. Description string }
Information about a specific audio device. Returned by ListAudioDevices.
type Equalizer ¶
type Equalizer interface { IsEnabled() bool Preamp() float64 Curve() EqualizerCurve Type() string // Returns the band frequencies as strings friendly for display BandFrequencies() []string }
type EqualizerBand ¶
func (EqualizerBand) String ¶
func (e EqualizerBand) String() string
type EqualizerCurve ¶
type EqualizerCurve []EqualizerBand
func (EqualizerCurve) String ¶
func (e EqualizerCurve) String() string
type ISO15BandEqualizer ¶
func (*ISO15BandEqualizer) BandFrequencies ¶
func (*ISO15BandEqualizer) BandFrequencies() []string
func (*ISO15BandEqualizer) Curve ¶
func (i *ISO15BandEqualizer) Curve() EqualizerCurve
func (*ISO15BandEqualizer) IsEnabled ¶
func (i *ISO15BandEqualizer) IsEnabled() bool
func (*ISO15BandEqualizer) Preamp ¶
func (i *ISO15BandEqualizer) Preamp() float64
func (*ISO15BandEqualizer) Type ¶
func (*ISO15BandEqualizer) Type() string
type MediaInfo ¶
type MediaInfo struct { // The sample format as string. This uses the same names as used in other places of mpv. // NOTE: this is the format that the decoder outputs, NOT necessarily the format of the file. Format string // Audio samplerate. Samplerate int // The number of channels. ChannelCount int // The audio codec. Codec string // The average bit rate in bits per second. Bitrate int }
Media information about the currently playing media.
type Player ¶
type Player struct {
// contains filtered or unexported fields
}
Player encapsulates the mpv instance and provides functions to control it and to check its status.
func New ¶
func New() *Player
Returns a new player. Must call Init on the player before it is ready for playback.
func NewWithClientName ¶
Same as New, but sets the application name that mpv reports to the system audio API.
func (*Player) GetMediaInfo ¶
func (*Player) Init ¶
Initializes the Player and makes it ready for playback. Most Player functions will return ErrUnitialized if called before Init.
func (*Player) ListAudioDevices ¶
func (p *Player) ListAudioDevices() ([]AudioDevice, error)
List available audio devices.
func (*Player) OnPaused ¶
func (p *Player) OnPaused(cb func())
Registers a callback which is invoked when the player transitions to the Paused state.
func (*Player) OnPlaying ¶
func (p *Player) OnPlaying(cb func())
Registers a callback which is invoked when the player transitions to the Playing state.
func (*Player) OnSeek ¶
func (p *Player) OnSeek(cb func())
Registers a callback which is invoked whenever a seek event occurs.
func (*Player) OnStopped ¶
func (p *Player) OnStopped(cb func())
Registers a callback which is invoked when the player transitions to the Stopped state.
func (*Player) OnTrackChange ¶
func (p *Player) OnTrackChange(cb func())
Registers a callback which is invoked when the currently playing track changes, or when playback begins at any time from the Stopped state. Callback is invoked with the index of the currently playing track (zero-based).
func (*Player) SeekSeconds ¶
Seeks within the currently playing track. See MPV seek command documentation for more details.
func (*Player) SetAudioDevice ¶
func (*Player) SetAudioExclusive ¶
Sets the audio exclusive option of the player. Unlike most Player functions, SetAudioExclusive can be called before Init, to set the initial option of the player on startup.
func (*Player) SetEqualizer ¶
func (*Player) SetNextFile ¶
func (*Player) SetPeaksEnabled ¶ added in v0.13.0
func (*Player) SetReplayGainOptions ¶
func (p *Player) SetReplayGainOptions(options player.ReplayGainOptions) error
Sets the ReplayGain options of the player. Unlike most Player functions, SetReplayGainOptions can be called before Init, to set the initial replaygain options of the player on startup.