player

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Player

type Player interface {
	// Name return the current player name
	Name() string

	// Run process current URL through current player
	// u will be the stream URL
	// title will be the stream title
	Run(u, title string, output io.Writer) error
}

Player describes an available media player application If you want to use a custom one, make sure to implement this interface

var (
	QuickTimePlayer Player = &player{
		name:       "QuickTime Player",
		command:    []string{"open", "-a", "quicktime player", "$url"},
		registry:   "",
		registry32: "",
	}
	IINA Player = &player{
		name:       "IINA",
		command:    []string{"iina", "--no-stdin", "$url"},
		registry:   "",
		registry32: "",
	}
	VLC Player = &player{
		name:       "VLC",
		registry:   "SOFTWARE\\VideoLAN\\VLC",
		registry32: "SOFTWARE\\WOW6432Node\\VideoLAN\\VLC",
		command:    []string{"vlc", "$url", "--meta-title=$title"},
	}
	MPV Player = &player{
		name:       "MPV",
		command:    []string{"mpv", "$url", "--quiet", "--title=$title"},
		registry:   "",
		registry32: "",
	}
)

func DefaultPlayer

func DefaultPlayer() (Player, error)

DefaultPlayer return the first media player available from $PATH or Windows registry Throw an error when no player is available

Jump to

Keyboard shortcuts

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