Documentation
¶
Overview ¶
Package player provides media playback functionality using external players. It supports playing single files or multiple files as a playlist using mpv.
Index ¶
- func GetDefaultPath() string
- func IsAvailable(mpvPath string) bool
- func Play(streamURL, mpvPath string) error
- func PlayMultiple(streamURLs []string, mpvPath string) error
- func PlayMultipleWithOptions(streamURLs []string, mpvPath string, opts PlaybackOptions) error
- type MPVPlayer
- type PlaybackOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDefaultPath ¶
func GetDefaultPath() string
GetDefaultPath returns the default MPV path for the current platform.
func IsAvailable ¶
IsAvailable checks if MPV is available on the system. This is a convenience function for checking availability.
func Play ¶
Play launches MPV to play the given URL. This is a convenience function that uses the default player.
func PlayMultiple ¶
PlayMultiple launches MPV to play multiple URLs sequentially. This is a convenience function that uses the default player.
func PlayMultipleWithOptions ¶ added in v0.2.2
func PlayMultipleWithOptions(streamURLs []string, mpvPath string, opts PlaybackOptions) error
PlayMultipleWithOptions launches MPV with custom options.
Types ¶
type MPVPlayer ¶ added in v0.2.2
type MPVPlayer struct {
// Path is the path to the mpv executable. If empty, "mpv" is used.
Path string
}
MPVPlayer implements the Player interface using mpv media player. It provides high-quality media playback with seeking support.
func NewMPVPlayer ¶ added in v0.2.2
NewMPVPlayer creates a new MPVPlayer with the specified path. If path is empty, the system PATH will be searched for mpv.
func (*MPVPlayer) IsAvailable ¶ added in v0.2.2
IsAvailable checks if mpv is available on the system.
type PlaybackOptions ¶ added in v0.2.2
type PlaybackOptions struct {
SocketPath string // IPC socket path for progress tracking (Unix socket or Windows named pipe, empty to disable)
StartPos int // Start position in seconds (0 to start from beginning)
}
PlaybackOptions configures MPV playback behavior.