Documentation ¶
Overview ¶
Package vlc provides Golang bindings for libVLC version 3.X.
Usage ¶
Initialization
// Initialize libVLC. Additional command line arguments can be passed in // to libVLC by specifying them in the Init function. if err := vlc.Init("--no-video", "--quiet"); err != nil { log.Fatal(err) } defer vlc.Release()
Player example
// Create a new player. player, err := vlc.NewPlayer() if err != nil { log.Fatal(err) } defer func() { player.Stop() player.Release() }() // Add a media file from path or from URL. // Set player media from path: // media, err := player.LoadMediaFromPath("localpath/test.mp4") // Set player media from URL: media, err := player.LoadMediaFromURL("http://stream-uk1.radioparadise.com/mp3-32") if err != nil { log.Fatal(err) } defer media.Release() // Retrieve player event manager. manager, err := player.EventManager() if err != nil { log.Fatal(err) } // Register the media end reached event with the event manager. quit := make(chan struct{}) eventCallback := func(event vlc.Event, userData interface{}) { close(quit) } eventID, err := manager.Attach(vlc.MediaPlayerEndReached, eventCallback, nil) if err != nil { log.Fatal(err) } defer manager.Detach(eventID) // Start playing the media. if err = player.Play(); err != nil { log.Fatal(err) } <-quit
List player example
// Create a new list player. player, err := vlc.NewListPlayer() if err != nil { log.Fatal(err) } defer func() { player.Stop() player.Release() }() // Create a new media list. list, err := vlc.NewMediaList() if err != nil { log.Fatal(err) } defer list.Release() err = list.AddMediaFromPath("localpath/test1.mp3") if err != nil { log.Fatal(err) } err = list.AddMediaFromURL("http://stream-uk1.radioparadise.com/mp3-32") if err != nil { log.Fatal(err) } // Set player media list. if err = player.SetMediaList(list); err != nil { log.Fatal(err) } // Media files can be added to the list after the list has been added // to the player. The player will play these files as well. err = list.AddMediaFromPath("localpath/test2.mp3") if err != nil { log.Fatal(err) } // Retrieve player event manager. manager, err := player.EventManager() if err != nil { log.Fatal(err) } // Register the media end reached event with the event manager. quit := make(chan struct{}) eventCallback := func(event vlc.Event, userData interface{}) { close(quit) } eventID, err := manager.Attach(vlc.MediaListPlayerPlayed, eventCallback, nil) if err != nil { log.Fatal(err) } defer manager.Detach(eventID) // Start playing the media list. if err = player.Play(); err != nil { log.Fatal(err) } <-quit
Handling multiple events example
// Create a new player. player, err := vlc.NewPlayer() if err != nil { log.Fatal(err) } defer func() { player.Stop() player.Release() }() // Add a media file from path or from URL. // Set player media from path: // media, err := player.LoadMediaFromPath("test.mp3") // Set player media from URL: media, err := player.LoadMediaFromURL("http://stream-uk1.radioparadise.com/mp3-32") if err != nil { log.Fatal(err) } defer media.Release() // Retrieve player event manager. manager, err := player.EventManager() if err != nil { log.Fatal(err) } // Create event handler. quit := make(chan struct{}) eventCallback := func(event vlc.Event, userData interface{}) { switch event { case vlc.MediaPlayerEndReached: log.Println("Player end reached") close(quit) case vlc.MediaPlayerTimeChanged: media, err := player.Media() if err != nil { log.Println(err) break } stats, err := media.Stats() if err != nil { log.Println(err) break } log.Printf("%+v\n", stats) } } // Register events with the event manager. events := []vlc.Event{ vlc.MediaPlayerTimeChanged, vlc.MediaPlayerEndReached, } var eventIDs []vlc.EventID for _, event := range events { eventID, err := manager.Attach(event, eventCallback, nil) if err != nil { log.Fatal(err) } eventIDs = append(eventIDs, eventID) } // De-register attached events. defer func() { for _, eventID := range eventIDs { manager.Detach(eventID) } }() // Start playing the media. if err = player.Play(); err != nil { log.Fatal(err) } <-quit
Index ¶
- Constants
- Variables
- func EqualizerBandCount() uint
- func EqualizerBandFrequencies() []float64
- func EqualizerBandFrequency(index uint) float64
- func EqualizerPresetCount() uint
- func EqualizerPresetName(index uint) string
- func EqualizerPresetNames() []string
- func Init(args ...string) error
- func Release() error
- func SetAppID(id, version, icon string) error
- func SetAppName(name, userAgent string) error
- func StartUserInterface(name string) error
- type AudioOutput
- type AudioOutputDevice
- type ChapterInfo
- type DeinterlaceMode
- type Equalizer
- type Event
- type EventCallback
- type EventID
- type EventManager
- type ListPlayer
- func (lp *ListPlayer) EventManager() (*EventManager, error)
- func (lp *ListPlayer) IsPlaying() bool
- func (lp *ListPlayer) MediaList() *MediaList
- func (lp *ListPlayer) MediaState() (MediaState, error)
- func (lp *ListPlayer) Play() error
- func (lp *ListPlayer) PlayAtIndex(index uint) error
- func (lp *ListPlayer) PlayItem(m *Media) error
- func (lp *ListPlayer) PlayNext() error
- func (lp *ListPlayer) PlayPrevious() error
- func (lp *ListPlayer) Player() (*Player, error)
- func (lp *ListPlayer) Release() error
- func (lp *ListPlayer) SetMediaList(ml *MediaList) error
- func (lp *ListPlayer) SetPause(pause bool) error
- func (lp *ListPlayer) SetPlaybackMode(mode PlaybackMode) error
- func (lp *ListPlayer) SetPlayer(player *Player) error
- func (lp *ListPlayer) Stop() error
- func (lp *ListPlayer) TogglePause() error
- type Logo
- func (l *Logo) DisplayDuration() (time.Duration, error)
- func (l *Logo) Enable(enable bool) error
- func (l *Logo) Opacity() (int, error)
- func (l *Logo) Position() (Position, error)
- func (l *Logo) RepeatCount() (int, error)
- func (l *Logo) SetDisplayDuration(displayDuration time.Duration) error
- func (l *Logo) SetFiles(files ...*LogoFile) error
- func (l *Logo) SetOpacity(opacity int) error
- func (l *Logo) SetPosition(position Position) error
- func (l *Logo) SetRepeatCount(count int) error
- func (l *Logo) SetX(x int) error
- func (l *Logo) SetY(y int) error
- func (l *Logo) X() (int, error)
- func (l *Logo) Y() (int, error)
- type LogoFile
- type Marquee
- func (m *Marquee) Color() (color.Color, error)
- func (m *Marquee) DisplayDuration() (time.Duration, error)
- func (m *Marquee) Enable(enable bool) error
- func (m *Marquee) Opacity() (int, error)
- func (m *Marquee) Position() (Position, error)
- func (m *Marquee) RefreshInterval() (time.Duration, error)
- func (m *Marquee) SetColor(color color.Color) error
- func (m *Marquee) SetDisplayDuration(displayDuration time.Duration) error
- func (m *Marquee) SetOpacity(opacity int) error
- func (m *Marquee) SetPosition(position Position) error
- func (m *Marquee) SetRefreshInterval(refreshInterval time.Duration) error
- func (m *Marquee) SetSize(size int) error
- func (m *Marquee) SetText(text string) error
- func (m *Marquee) SetX(x int) error
- func (m *Marquee) SetY(y int) error
- func (m *Marquee) Size() (int, error)
- func (m *Marquee) Text() (string, error)
- func (m *Marquee) X() (int, error)
- func (m *Marquee) Y() (int, error)
- type Media
- func (m *Media) AddOptions(options ...string) error
- func (m *Media) Duplicate() (*Media, error)
- func (m *Media) Duration() (time.Duration, error)
- func (m *Media) EventManager() (*EventManager, error)
- func (m *Media) IsParsed() (bool, error)
- func (m *Media) Location() (string, error)
- func (m *Media) Meta(key MediaMetaKey) (string, error)
- func (m *Media) Parse() error
- func (m *Media) ParseAsync() error
- func (m *Media) ParseStatus() (MediaParseStatus, error)
- func (m *Media) ParseWithOptions(timeout int, opts ...MediaParseOption) error
- func (m *Media) Release() error
- func (m *Media) SaveMeta() error
- func (m *Media) SetMeta(key MediaMetaKey, val string) error
- func (m *Media) SetUserData(userData interface{}) error
- func (m *Media) State() (MediaState, error)
- func (m *Media) Stats() (*MediaStats, error)
- func (m *Media) StopParse() error
- func (m *Media) SubItems() (*MediaList, error)
- func (m *Media) Tracks() ([]*MediaTrack, error)
- func (m *Media) Type() (MediaType, error)
- func (m *Media) UserData() (interface{}, error)
- type MediaAudioTrack
- type MediaDiscoverer
- type MediaDiscovererDescriptor
- type MediaDiscoveryCallback
- type MediaDiscoveryCategory
- type MediaList
- func (ml *MediaList) AddMedia(m *Media) error
- func (ml *MediaList) AddMediaFromPath(path string) error
- func (ml *MediaList) AddMediaFromReadSeeker(r io.ReadSeeker) error
- func (ml *MediaList) AddMediaFromURL(url string) error
- func (ml *MediaList) AssociateMedia(m *Media) error
- func (ml *MediaList) AssociatedMedia() (*Media, error)
- func (ml *MediaList) Count() (int, error)
- func (ml *MediaList) EventManager() (*EventManager, error)
- func (ml *MediaList) IndexOfMedia(m *Media) (int, error)
- func (ml *MediaList) InsertMedia(m *Media, index uint) error
- func (ml *MediaList) InsertMediaFromPath(path string, index uint) error
- func (ml *MediaList) InsertMediaFromReadSeeker(r io.ReadSeeker, index uint) error
- func (ml *MediaList) InsertMediaFromURL(url string, index uint) error
- func (ml *MediaList) IsReadOnly() (bool, error)
- func (ml *MediaList) Lock() error
- func (ml *MediaList) MediaAtIndex(index uint) (*Media, error)
- func (ml *MediaList) Release() error
- func (ml *MediaList) RemoveMediaAtIndex(index uint) error
- func (ml *MediaList) Unlock() error
- type MediaMetaKey
- type MediaParseOption
- type MediaParseStatus
- type MediaScreenOptions
- type MediaState
- type MediaStats
- type MediaSubtitleTrack
- type MediaTrack
- type MediaTrackDescriptor
- type MediaTrackType
- type MediaType
- type MediaVideoTrack
- type ModuleDescription
- type NavigationAction
- type PlaybackMode
- type Player
- func (p *Player) AspectRatio() (string, error)
- func (p *Player) AudioDelay() (time.Duration, error)
- func (p *Player) AudioOutputDevice() (string, error)
- func (p *Player) AudioOutputDevices() ([]*AudioOutputDevice, error)
- func (p *Player) AudioTrackCount() (int, error)
- func (p *Player) AudioTrackDescriptors() ([]*MediaTrackDescriptor, error)
- func (p *Player) AudioTrackID() (int, error)
- func (p *Player) Brightness() (float64, error)
- func (p *Player) CanPause() bool
- func (p *Player) ChapterCount() (int, error)
- func (p *Player) ChapterIndex() (int, error)
- func (p *Player) Contrast() (float64, error)
- func (p *Player) CursorPosition() (int, int, error)
- func (p *Player) EnableVideoAdjustments(enable bool) error
- func (p *Player) EventManager() (*EventManager, error)
- func (p *Player) Gamma() (float64, error)
- func (p *Player) HWND() (uintptr, error)
- func (p *Player) Hue() (float64, error)
- func (p *Player) IsFullScreen() (bool, error)
- func (p *Player) IsMuted() (bool, error)
- func (p *Player) IsPlaying() bool
- func (p *Player) IsScrambled() bool
- func (p *Player) IsSeekable() bool
- func (p *Player) LoadMediaFromPath(path string) (*Media, error)
- func (p *Player) LoadMediaFromReadSeeker(r io.ReadSeeker) (*Media, error)
- func (p *Player) LoadMediaFromURL(url string) (*Media, error)
- func (p *Player) Logo() *Logo
- func (p *Player) Marquee() *Marquee
- func (p *Player) Media() (*Media, error)
- func (p *Player) MediaLength() (int, error)
- func (p *Player) MediaPosition() (float32, error)
- func (p *Player) MediaState() (MediaState, error)
- func (p *Player) MediaTime() (int, error)
- func (p *Player) NSObject() (uintptr, error)
- func (p *Player) Navigate(action NavigationAction) error
- func (p *Player) NextChapter() error
- func (p *Player) NextFrame() error
- func (p *Player) Play() error
- func (p *Player) PlaybackRate() float32
- func (p *Player) PreviousChapter() error
- func (p *Player) Release() error
- func (p *Player) Role() (PlayerRole, error)
- func (p *Player) Saturation() (float64, error)
- func (p *Player) Scale() (float64, error)
- func (p *Player) SetAspectRatio(aspectRatio string) error
- func (p *Player) SetAudioDelay(d time.Duration) error
- func (p *Player) SetAudioOutput(output string) error
- func (p *Player) SetAudioOutputDevice(device, output string) error
- func (p *Player) SetAudioTrack(trackID int) error
- func (p *Player) SetBrightness(brightness float64) error
- func (p *Player) SetChapter(chapterIndex int) error
- func (p *Player) SetContrast(contrast float64) error
- func (p *Player) SetDeinterlaceMode(mode DeinterlaceMode) error
- func (p *Player) SetEqualizer(e *Equalizer) error
- func (p *Player) SetFullScreen(fullscreen bool) error
- func (p *Player) SetGamma(gamma float64) error
- func (p *Player) SetHWND(hwnd uintptr) error
- func (p *Player) SetHue(hue float64) error
- func (p *Player) SetKeyInput(enable bool) error
- func (p *Player) SetMedia(m *Media) error
- func (p *Player) SetMediaPosition(pos float32) error
- func (p *Player) SetMediaTime(t int) error
- func (p *Player) SetMouseInput(enable bool) error
- func (p *Player) SetMute(mute bool) error
- func (p *Player) SetNSObject(drawable uintptr) error
- func (p *Player) SetPause(pause bool) error
- func (p *Player) SetPlaybackRate(rate float32) error
- func (p *Player) SetRenderer(r *Renderer) error
- func (p *Player) SetRole(role PlayerRole) error
- func (p *Player) SetSaturation(saturation float64) error
- func (p *Player) SetScale(scale float64) error
- func (p *Player) SetStereoMode(mode StereoMode) error
- func (p *Player) SetSubtitleDelay(d time.Duration) error
- func (p *Player) SetSubtitleTrack(trackID int) error
- func (p *Player) SetTitle(titleIndex int) error
- func (p *Player) SetTitleDisplayMode(position Position, timeout time.Duration) error
- func (p *Player) SetVideoTrack(trackID int) error
- func (p *Player) SetVolume(volume int) error
- func (p *Player) SetXWindow(windowID uint32) error
- func (p *Player) StereoMode() (StereoMode, error)
- func (p *Player) Stop() error
- func (p *Player) SubtitleDelay() (time.Duration, error)
- func (p *Player) SubtitleTrackCount() (int, error)
- func (p *Player) SubtitleTrackDescriptors() ([]*MediaTrackDescriptor, error)
- func (p *Player) SubtitleTrackID() (int, error)
- func (p *Player) TakeSnapshot(outputPath string, width, height uint) error
- func (p *Player) TitleChapterCount(titleIndex int) (int, error)
- func (p *Player) TitleChapters(titleIndex int) ([]*ChapterInfo, error)
- func (p *Player) TitleCount() (int, error)
- func (p *Player) TitleIndex() (int, error)
- func (p *Player) Titles() ([]*TitleInfo, error)
- func (p *Player) ToggleFullScreen() error
- func (p *Player) ToggleMute() error
- func (p *Player) TogglePause() error
- func (p *Player) UpdateVideoViewpoint(vp *VideoViewpoint, absolute bool) error
- func (p *Player) VideoAdjustmentsEnabled(enable bool) (bool, error)
- func (p *Player) VideoDimensions() (uint, uint, error)
- func (p *Player) VideoOutputCount() int
- func (p *Player) VideoTrackCount() (int, error)
- func (p *Player) VideoTrackDescriptors() ([]*MediaTrackDescriptor, error)
- func (p *Player) VideoTrackID() (int, error)
- func (p *Player) Volume() (int, error)
- func (p *Player) WillPlay() bool
- func (p *Player) XWindow() (uint32, error)
- type PlayerRole
- type Position
- type Renderer
- type RendererDiscoverer
- type RendererDiscovererDescriptor
- type RendererDiscoveryCallback
- type RendererFlags
- type RendererType
- type StereoMode
- type TitleFlag
- type TitleInfo
- type VersionInfo
- type VideoOrientation
- type VideoProjection
- type VideoViewpoint
Constants ¶
const ( MediaListViewItemAdded = 0x300 + iota MediaListViewWillAddItem MediaListViewItemDeleted MediaListViewWillDeleteItem )
Deprecated events.
const ( // MediaListPlayerPlayed is triggered when playback of the media list // of the list player has ended. MediaListPlayerPlayed = 0x400 + iota // MediaListPlayerNextItemSet is triggered when the current item // of a media list player has changed to a different item. MediaListPlayerNextItemSet // MediaListPlayerStopped is triggered when playback // of a media list player is stopped programmatically. MediaListPlayerStopped )
Variables ¶
var ( ErrModuleInitialize = errors.New("could not initialize module") ErrModuleNotInitialized = errors.New("module is not initialized") ErrUserInterfaceStart = errors.New("could not start user interface") )
Module errors.
var ( ErrPlayerCreate = errors.New("could not create player") ErrPlayerNotInitialized = errors.New("player is not initialized") ErrPlayerPlay = errors.New("cannot play the requested media") ErrPlayerSetVolume = errors.New("could not set player volume") ErrPlayerSetRenderer = errors.New("could not set player renderer") ErrPlayerSetEqualizer = errors.New("could not set player equalizer") ErrPlayerInvalidRole = errors.New("invalid player role") ErrPlayerTitleNotInitialized = errors.New("player title not initialized") ErrPlayerChapterNotInitialized = errors.New("player chapter not initialized") )
Player errors.
var ( ErrListPlayerCreate = errors.New("could not create list player") ErrListPlayerNotInitialized = errors.New("list player not initialized") )
List player errors.
var ( ErrMediaCreate = errors.New("could not create media") ErrMediaNotFound = errors.New("could not find media") ErrMediaNotInitialized = errors.New("media is not initialized") ErrMediaListCreate = errors.New("could not create media list") ErrMediaListNotFound = errors.New("could not find media list") ErrMediaListNotInitialized = errors.New("media list is not initialized") ErrMediaListReadOnly = errors.New("media list is read-only") ErrMediaListActionFailed = errors.New("could not perform media list action") ErrMissingMediaStats = errors.New("could not get media statistics") ErrInvalidMediaStats = errors.New("invalid media statistics") ErrMissingMediaLocation = errors.New("could not get media location") ErrMissingMediaDimensions = errors.New("could not get media dimensions") ErrMediaMetaSave = errors.New("could not save media metadata") ErrMediaParse = errors.New("could not parse media") ErrMediaNotParsed = errors.New("media is not parsed") )
Media errors.
var ( ErrMediaTrackNotInitialized = errors.New("media track is not initialized") ErrMediaTrackNotFound = errors.New("could not find media track") ErrInvalidMediaTrack = errors.New("invalid media track") )
Media track errors.
var ( ErrMissingEventManager = errors.New("could not get event manager instance") ErrInvalidEventCallback = errors.New("invalid event callback") ErrEventAttach = errors.New("could not attach event") )
Event manager errors.
var ( ErrAudioOutputListMissing = errors.New("could not get audio output list") ErrAudioOutputSet = errors.New("could not set audio output") ErrAudioOutputDeviceListMissing = errors.New("could not get audio output device list") ErrAudioOutputDeviceMissing = errors.New("could not get audio output device") ErrFilterListMissing = errors.New("could not get filter list") ErrStereoModeSet = errors.New("could not set stereo mode") ErrVideoViewpointSet = errors.New("could not set video viewpoint") ErrVideoSnapshot = errors.New("could not take video snapshot") ErrCursorPositionMissing = errors.New("could not get cursor position") )
Audio/Video errors.
var ( ErrRendererDiscovererParse = errors.New("could not parse renderer discoverer") ErrRendererDiscovererCreate = errors.New("could not create renderer discoverer") ErrRendererDiscovererNotInitialized = errors.New("renderer discoverer not initialized") ErrRendererDiscovererStart = errors.New("could not start renderer discoverer") ErrRendererNotInitialized = errors.New("renderer not initialized") )
Renderer discoverer errors.
var ( ErrMediaDiscovererParse = errors.New("could not parse media discoverer") ErrMediaDiscovererCreate = errors.New("could not create media discoverer") ErrMediaDiscovererNotInitialized = errors.New("media discoverer not initialized") ErrMediaDiscovererStart = errors.New("could not start media discoverer") )
Media discoverer errors.
var ( ErrEqualizerCreate = errors.New("could not create equalizer") ErrEqualizerNotInitialized = errors.New("equalizer not initialized") ErrEqualizerAmpValueSet = errors.New("could not set equalizer amplification value") )
Equalizer errors.
var (
ErrInvalid = errors.New("the provided value is not valid")
)
Generic errors.
Functions ¶
func EqualizerBandCount ¶ added in v3.1.2
func EqualizerBandCount() uint
EqualizerBandCount returns the number of distinct equalizer frequency bands.
func EqualizerBandFrequencies ¶ added in v3.1.2
func EqualizerBandFrequencies() []float64
EqualizerBandFrequencies returns the frequencies of all available equalizer bands, sorted by their indices in ascending order.
func EqualizerBandFrequency ¶ added in v3.1.2
EqualizerBandFrequency returns the frequency of the equalizer band with the specified index. The index must be a number greater than or equal to 0 and less than EqualizerBandCount(). The function returns -1 for invalid indices.
func EqualizerPresetCount ¶ added in v3.1.2
func EqualizerPresetCount() uint
EqualizerPresetCount returns the number of available equalizer presets.
func EqualizerPresetName ¶ added in v3.1.2
EqualizerPresetName returns the name of the equalizer preset with the specified index. The index must be a number greater than or equal to 0 and less than EqualizerPresetCount(). The function returns an empty string for invalid indices.
func EqualizerPresetNames ¶ added in v3.1.2
func EqualizerPresetNames() []string
EqualizerPresetNames returns the names of all available equalizer presets, sorted by their indices in ascending order.
func Init ¶
Init creates an instance of the libVLC module. Must be called only once and the module instance must be released using the Release function.
func SetAppName ¶ added in v3.0.4
SetAppName sets the human-readable application name and the HTTP user agent. The specified user agent is used when a protocol requires it.
func StartUserInterface ¶ added in v3.0.4
StartUserInterface attempts to start a user interface for the libVLC instance. Pass an empty string as the name parameter in order to start the default interface.
Types ¶
type AudioOutput ¶
AudioOutput contains information regarding an audio output.
func AudioOutputList ¶
func AudioOutputList() ([]*AudioOutput, error)
AudioOutputList returns the list of available audio outputs. In order to change the audio output of a media player instance, use the Player.SetAudioOutput method.
type AudioOutputDevice ¶ added in v3.1.4
AudioOutputDevice contains information regarding an audio output device.
func ListAudioOutputDevices ¶ added in v3.1.4
func ListAudioOutputDevices(output string) ([]*AudioOutputDevice, error)
ListAudioOutputDevices returns the list of available devices for the specified audio output. Use the AudioOutputList method in order to obtain the list of available audio outputs. In order to change the audio output device of a media player instance, use Player.SetAudioOutputDevice.
NOTE: Not all audio outputs support this. An empty list of devices does not imply that the specified audio output does not work. Some audio output devices in the list might not work in some circumstances. By default, it is recommended to not specify any explicit audio device.
type ChapterInfo ¶ added in v3.1.5
type ChapterInfo struct { Name string // Name of the chapter. Duration time.Duration // Duration of the chapter. Offset time.Duration // Offset from the start of the media or media title. }
ChapterInfo contains information regarding a media chapter. DVD and Blu-ray formats have their content split into titles and chapters. However, chapters are supported by other media formats as well.
type DeinterlaceMode ¶ added in v3.1.6
type DeinterlaceMode string
DeinterlaceMode defines deinterlacing modes which can be used when rendering videos.
For more information see https://wiki.videolan.org/Deinterlacing.
const ( DeinterlaceModeDisable DeinterlaceMode = "" DeinterlaceModeDiscard DeinterlaceMode = "discard" DeinterlaceModeBlend DeinterlaceMode = "blend" DeinterlaceModeMean DeinterlaceMode = "mean" DeinterlaceModeBob DeinterlaceMode = "bob" DeinterlaceModeLinear DeinterlaceMode = "linear" DeinterlaceModeX DeinterlaceMode = "x" DeinterlaceModeYadif DeinterlaceMode = "yadif" DeinterlaceModeYadif2x DeinterlaceMode = "yadif2x" DeinterlaceModePhosphor DeinterlaceMode = "phosphor" DeinterlaceModeIVTC DeinterlaceMode = "ivtc" )
Deinterlace modes.
type Equalizer ¶ added in v3.1.2
type Equalizer struct {
// contains filtered or unexported fields
}
Equalizer represents an audio equalizer. Use Player.SetEqualizer to assign the equalizer to a player instance.
func NewEqualizer ¶ added in v3.1.2
NewEqualizer returns a new equalizer with all frequency values set to zero.
func NewEqualizerFromPreset ¶ added in v3.1.2
NewEqualizerFromPreset returns a new equalizer with the frequency values copied from the preset with the specified index. The index must be a number greater than or equal to 0 and less than EqualizerPresetCount().
func (*Equalizer) AmpValueAtIndex ¶ added in v3.1.2
AmpValueAtIndex returns the amplification value for the equalizer frequency band with the specified index, in Hz. The index must be a number greater than or equal to 0 and less than EqualizerBandCount().
func (*Equalizer) PreampValue ¶ added in v3.1.2
PreampValue returns the pre-amplification value of the equalizer in Hz.
func (*Equalizer) SetAmpValueAtIndex ¶ added in v3.1.2
SetAmpValueAtIndex sets the amplification value for the equalizer frequency band with the specified index, in Hz. The index must be a number greater than or equal to 0 and less than EqualizerBandCount().
func (*Equalizer) SetPreampValue ¶ added in v3.1.2
SetPreampValue sets the pre-amplification value of the equalizer. The specified amplification value is clamped to the [-20.0, 20.0] Hz range.
type Event ¶
type Event int
Event represents an event that can occur inside libvlc.
const ( // MediaMetaChanged is triggered when the metadata of a media item changes. MediaMetaChanged Event = iota // MediaSubItemAdded is triggered when a Subitem is added to a media item. MediaSubItemAdded // MediaDurationChanged is triggered when the duration // of a media item changes. MediaDurationChanged // MediaParsedChanged is triggered when the parsing state // of a media item changes. MediaParsedChanged // MediaFreed is triggered when a media item is freed. MediaFreed // MediaStateChanged is triggered when the state of the media item changes. MediaStateChanged // MediaSubItemTreeAdded is triggered when a Subitem tree is // added to a media item. MediaSubItemTreeAdded // MediaThumbnailGenerated is triggered when a thumbnail // generation is completed. MediaThumbnailGenerated )
Media events.
const ( MediaPlayerMediaChanged Event = 0x100 + iota MediaPlayerNothingSpecial MediaPlayerOpening MediaPlayerBuffering MediaPlayerPlaying MediaPlayerPaused MediaPlayerStopped MediaPlayerForward MediaPlayerBackward MediaPlayerEndReached MediaPlayerEncounteredError MediaPlayerTimeChanged MediaPlayerPositionChanged MediaPlayerSeekableChanged MediaPlayerPausableChanged MediaPlayerTitleChanged MediaPlayerSnapshotTaken MediaPlayerLengthChanged MediaPlayerVout MediaPlayerScrambledChanged MediaPlayerESAdded MediaPlayerESDeleted MediaPlayerESSelected MediaPlayerCorked MediaPlayerUncorked MediaPlayerMuted MediaPlayerUnmuted MediaPlayerAudioVolume MediaPlayerAudioDevice MediaPlayerChapterChanged )
Player events.
const ( // MediaListItemAdded is triggered when a media item is added to a media list. MediaListItemAdded Event = 0x200 + iota // MediaListWillAddItem is triggered when a media item is about to get // added to a media list. MediaListWillAddItem // MediaListItemDeleted is triggered when a media item is deleted // from a media list. MediaListItemDeleted // MediaListWillDeleteItem is triggered when a media item is about to get // deleted from a media list. MediaListWillDeleteItem // MediaListEndReached is triggered when a media list has reached the end. MediaListEndReached )
Media list events.
const ( // RendererDiscovererItemAdded is triggered when a new renderer item is // found by a renderer discoverer. The renderer item is valid until deleted. RendererDiscovererItemAdded Event = 0x502 + iota // RendererDiscovererItemDeleted is triggered when a previously discovered // renderer item was deleted by a renderer discoverer. The renderer item // is no longer valid. RendererDiscovererItemDeleted )
Renderer events.
const ( VlmMediaAdded Event = 0x600 + iota VlmMediaRemoved VlmMediaChanged VlmMediaInstanceStarted VlmMediaInstanceStopped VlmMediaInstanceStatusInit VlmMediaInstanceStatusOpening VlmMediaInstanceStatusPlaying VlmMediaInstanceStatusPause VlmMediaInstanceStatusEnd VlmMediaInstanceStatusError )
VideoLAN Manager events.
type EventCallback ¶
type EventCallback func(Event, interface{})
EventCallback represents an event notification callback function.
type EventManager ¶
type EventManager struct {
// contains filtered or unexported fields
}
EventManager wraps a libvlc event manager.
func (*EventManager) Attach ¶
func (em *EventManager) Attach(event Event, callback EventCallback, userData interface{}) (EventID, error)
Attach registers a callback for an event notification.
func (*EventManager) Detach ¶
func (em *EventManager) Detach(eventIDs ...EventID)
Detach unregisters the specified event notification.
type ListPlayer ¶
type ListPlayer struct {
// contains filtered or unexported fields
}
ListPlayer is an enhanced media player used to play media lists.
func NewListPlayer ¶
func NewListPlayer() (*ListPlayer, error)
NewListPlayer creates a new list player instance.
func (*ListPlayer) EventManager ¶
func (lp *ListPlayer) EventManager() (*EventManager, error)
EventManager returns the event manager responsible for the list player.
func (*ListPlayer) IsPlaying ¶
func (lp *ListPlayer) IsPlaying() bool
IsPlaying returns a boolean value specifying if the player is currently playing.
func (*ListPlayer) MediaList ¶
func (lp *ListPlayer) MediaList() *MediaList
MediaList returns the current media list of the player, if one exists.
func (*ListPlayer) MediaState ¶
func (lp *ListPlayer) MediaState() (MediaState, error)
MediaState returns the state of the current media.
func (*ListPlayer) PlayAtIndex ¶
func (lp *ListPlayer) PlayAtIndex(index uint) error
PlayAtIndex plays the media at the specified index from the current media list.
func (*ListPlayer) PlayItem ¶ added in v3.0.3
func (lp *ListPlayer) PlayItem(m *Media) error
PlayItem plays the specified media item. The item must be part of the current media list of the player.
func (*ListPlayer) PlayNext ¶
func (lp *ListPlayer) PlayNext() error
PlayNext plays the next media in the current media list.
func (*ListPlayer) PlayPrevious ¶
func (lp *ListPlayer) PlayPrevious() error
PlayPrevious plays the previous media in the current media list.
func (*ListPlayer) Player ¶
func (lp *ListPlayer) Player() (*Player, error)
Player returns the underlying Player instance of the list player.
func (*ListPlayer) Release ¶
func (lp *ListPlayer) Release() error
Release destroys the list player instance.
func (*ListPlayer) SetMediaList ¶
func (lp *ListPlayer) SetMediaList(ml *MediaList) error
SetMediaList sets the media list to be played.
func (*ListPlayer) SetPause ¶ added in v3.0.3
func (lp *ListPlayer) SetPause(pause bool) error
SetPause sets the pause state of the list player. Pass in `true` to pause the current media, or `false` to resume it.
func (*ListPlayer) SetPlaybackMode ¶
func (lp *ListPlayer) SetPlaybackMode(mode PlaybackMode) error
SetPlaybackMode sets the player playback mode for the media list. By default, it plays the media list once and then stops.
func (*ListPlayer) SetPlayer ¶
func (lp *ListPlayer) SetPlayer(player *Player) error
SetPlayer sets the underlying Player instance of the list player.
func (*ListPlayer) Stop ¶
func (lp *ListPlayer) Stop() error
Stop cancels the currently playing media list, if there is one.
func (*ListPlayer) TogglePause ¶
func (lp *ListPlayer) TogglePause() error
TogglePause pauses/resumes the player. Calling this method has no effect if there is no media.
type Logo ¶ added in v3.1.6
type Logo struct {
// contains filtered or unexported fields
}
Logo represents a logo that can be displayed over a media instance.
For more information see https://wiki.videolan.org/Documentation:Modules/logo.
func (*Logo) DisplayDuration ¶ added in v3.1.6
DisplayDuration returns the global duration for which a logo file is set to be displayed before displaying the next one (if one is available). The global display duration can be overridden by each provided logo file. Default: 1s.
func (*Logo) Enable ¶ added in v3.1.6
Enable enables or disables the logo. By default, the logo is disabled.
func (*Logo) Opacity ¶ added in v3.1.6
Opacity returns the global opacity of the logo. The returned opacity is a value between 0 (transparent) and 255 (opaque). The global opacity can be overridden by each provided logo file. Default: 255.
func (*Logo) Position ¶ added in v3.1.6
Position returns the position of the logo, relative to its container. Default: vlc.PositionTopLeft.
func (*Logo) RepeatCount ¶ added in v3.1.6
RepeatCount returns the number of times the logo sequence is set to be repeated.
func (*Logo) SetDisplayDuration ¶ added in v3.1.6
SetDisplayDuration sets the duration for which to display a logo file before displaying the next one (if one is available). The global display duration can be overridden by each provided logo file.
func (*Logo) SetFiles ¶ added in v3.1.6
SetFiles sets the sequence of files to be displayed for the logo.
func (*Logo) SetOpacity ¶ added in v3.1.6
SetOpacity sets the global opacity of the logo. If an opacity override is not specified when setting the logo files, the global opacity is used. The opacity is specified as an integer between 0 (transparent) and 255 (opaque). The global opacity can be overridden by each provided logo file.
func (*Logo) SetPosition ¶ added in v3.1.6
SetPosition sets the position of the logo, relative to its container.
func (*Logo) SetRepeatCount ¶ added in v3.1.6
SetRepeatCount sets the number of times the logo sequence should repeat. Pass in `-1` to repeat the logo sequence indefinitely, `0` to disable logo sequence looping or a positive number to repeat the logo sequence a specific number of times. Default: -1 (the logo sequence is repeated indefinitely).
func (*Logo) SetX ¶ added in v3.1.6
SetX sets the X coordinate of the logo. The value is specified relative to the position of the logo inside its container, i.e. the position set using the `Logo.SetPosition` method.
NOTE: the method has no effect if the position of the logo is set to `vlc.PositionCenter`, `vlc.PositionTop` or `vlc.PositionBottom`.
func (*Logo) SetY ¶ added in v3.1.6
SetY sets the Y coordinate of the logo. The value is specified relative to the position of the logo inside its container.
NOTE: the method has no effect if the position of the logo is set to `vlc.PositionCenter`, `vlc.PositionLeft` or `vlc.PositionRight`.
type LogoFile ¶ added in v3.1.6
type LogoFile struct {
// contains filtered or unexported fields
}
LogoFile represents a logo file which can be used as a media player's logo. The logo of a player can also be composed of a series of alternating files.
func NewLogoFileFromImage ¶ added in v3.1.6
func NewLogoFileFromImage(img image.Image, displayDuration time.Duration, opacity int) (*LogoFile, error)
NewLogoFileFromImage returns a new logo file with the specified image. The file is displyed for the provided duration. If the specified display duration is negative, the global display duration set on the logo the file is applied to is used. The provided opacity must be a value between 0 (transparent) and 255 (opaque). If the specified opacity is negative, the global opacity set on the logo the file is applied to is used.
func NewLogoFileFromPath ¶ added in v3.1.6
func NewLogoFileFromPath(path string, displayDuration time.Duration, opacity int) (*LogoFile, error)
NewLogoFileFromPath returns a new logo file with the specified path. The file is displyed for the provided duration. If the specified display duration is negative, the global display duration set on the logo the file is applied to is used. The provided opacity must be a value between 0 (transparent) and 255 (opaque). If the specified opacity is negative, the global opacity set on the logo the file is applied to is used.
type Marquee ¶ added in v3.1.6
type Marquee struct {
// contains filtered or unexported fields
}
Marquee represents a marquee text than can be displayed over a media instance, along with its visual properties.
For more information see https://wiki.videolan.org/Documentation:Modules/marq.
func (*Marquee) Color ¶ added in v3.1.6
Color returns the marquee text color. Opacity information is included in the returned color. Default: white.
func (*Marquee) DisplayDuration ¶ added in v3.1.6
DisplayDuration returns the duration for which the marquee text is set to be displayed. Default: 0 (the marquee is displayed indefinitely).
func (*Marquee) Enable ¶ added in v3.1.6
Enable enables or disables the marquee. By default, the marquee is disabled.
func (*Marquee) Opacity ¶ added in v3.1.6
Opacity returns the opacity of the marquee text. The returned opacity is a value between 0 (transparent) and 255 (opaque). Default: 255.
func (*Marquee) Position ¶ added in v3.1.6
Position returns the position of the marquee, relative to its container. Default: vlc.PositionTopLeft.
func (*Marquee) RefreshInterval ¶ added in v3.1.6
RefreshInterval returns the interval between marquee text updates. The marquee text refreshes mainly when using time format string sequences. Default: 1s.
func (*Marquee) SetColor ¶ added in v3.1.6
SetColor sets the color of the marquee text. The opacity of the text is also set, based on the alpha value of the color.
func (*Marquee) SetDisplayDuration ¶ added in v3.1.6
SetDisplayDuration sets the duration for which to display the marquee text.
func (*Marquee) SetOpacity ¶ added in v3.1.6
SetOpacity sets the opacity of the marquee text. The opacity is specified as an integer between 0 (transparent) and 255 (opaque).
func (*Marquee) SetPosition ¶ added in v3.1.6
SetPosition sets the position of the marquee, relative to its container.
func (*Marquee) SetRefreshInterval ¶ added in v3.1.6
SetRefreshInterval sets the interval between marquee text updates. The marquee text refreshes mainly when using time format string sequences.
func (*Marquee) SetSize ¶ added in v3.1.6
SetSize sets the font size used to render the marquee text.
func (*Marquee) SetText ¶ added in v3.1.6
SetText sets the marquee text. The specified text can contain time format string sequences which are converted to the requested time values at runtime. Most of the time conversion specifiers supported by the `strftime` C function can be used.
Common time format string sequences: %Y = year, %m = month, %d = day, %H = hour, %M = minute, %S = second. For more information see https://en.cppreference.com/w/c/chrono/strftime.
func (*Marquee) SetX ¶ added in v3.1.6
SetX sets the X coordinate of the marquee text. The value is specified relative to the position of the marquee inside its container.
NOTE: the method has no effect if the position of the marquee is set to `vlc.PositionCenter`, `vlc.PositionTop` or `vlc.PositionBottom`.
func (*Marquee) SetY ¶ added in v3.1.6
SetY sets the Y coordinate of the marquee text. The value is specified relative to the position of the marquee inside its container.
NOTE: the method has no effect if the position of the marquee is set to `vlc.PositionCenter`, `vlc.PositionLeft` or `vlc.PositionRight`.
func (*Marquee) Size ¶ added in v3.1.6
Size returns the font size used to render the marquee text. Default: 0 (default font size is used).
type Media ¶
type Media struct {
// contains filtered or unexported fields
}
Media is an abstract representation of a playable media file.
func NewMediaFromPath ¶
NewMediaFromPath creates a new media instance based on the media located at the specified path.
func NewMediaFromReadSeeker ¶ added in v3.0.9
func NewMediaFromReadSeeker(r io.ReadSeeker) (*Media, error)
NewMediaFromReadSeeker creates a new media instance based on the provided read seeker.
func NewMediaFromScreen ¶ added in v3.0.3
func NewMediaFromScreen(opts *MediaScreenOptions) (*Media, error)
NewMediaFromScreen creates a media instance from the current computer screen, using the specified options.
NOTE: This functionality requires the VLC screen module to be installed. See installation instructions at https://github.com/adrg/libvlc-go/wiki. See https://wiki.videolan.org/Documentation:Modules/screen.
func NewMediaFromURL ¶
NewMediaFromURL creates a new media instance based on the media located at the specified URL.
func (*Media) AddOptions ¶
AddOptions adds the specified options to the media. The specified options determine how a media player reads the media, allowing advanced reading or streaming on a per-media basis.
func (*Media) Duplicate ¶ added in v3.0.8
Duplicate duplicates the current media instance.
NOTE: Call the Release method on the returned media in order to free the allocated resources.
func (*Media) Duration ¶ added in v3.0.4
Duration returns the media duration in milliseconds.
NOTE: The duration can only be obtained for parsed media instances. Either play the media once or call one of the parsing methods first.
func (*Media) EventManager ¶
func (m *Media) EventManager() (*EventManager, error)
EventManager returns the event manager responsible for the media.
func (*Media) IsParsed ¶
IsParsed returns true if the media was parsed.
NOTE: Deprecated in libVLC v3.0.0+. Use ParseStatus instead.
func (*Media) Location ¶
Location returns the media location, which can be either a local path or a URL, depending on how the media was loaded.
func (*Media) Meta ¶
func (m *Media) Meta(key MediaMetaKey) (string, error)
Meta reads the value of the specified media metadata key.
func (*Media) Parse ¶
Parse fetches local art, metadata and track information synchronously.
NOTE: Deprecated in libVLC v3.0.0+. Use ParseWithOptions instead.
func (*Media) ParseAsync ¶
ParseAsync fetches local art, metadata and track information asynchronously. Listen to the MediaParsedChanged event on the media event manager the track when the parsing has finished. However, if the media was already parsed, the event is not sent.
NOTE: Deprecated in libVLC v3.0.0+. Use ParseWithOptions instead.
func (*Media) ParseStatus ¶ added in v3.0.2
func (m *Media) ParseStatus() (MediaParseStatus, error)
ParseStatus returns the parsing status of the media.
func (*Media) ParseWithOptions ¶ added in v3.0.2
func (m *Media) ParseWithOptions(timeout int, opts ...MediaParseOption) error
ParseWithOptions fetches art, metadata and track information asynchronously, using the specified options. Listen to the MediaParsedChanged event on the media event manager the track when the parsing has finished. However, if the media was already parsed, the event is not sent. If no option is provided, the media is parsed only if it is a local file. The timeout parameter specifies the maximum amount of time allowed to preparse the media, in milliseconds.
// Timeout values: timeout < 0: use default preparse time. timeout == 0: wait indefinitely. timeout > 0: wait the specified number of milliseconds.
func (*Media) SetMeta ¶
func (m *Media) SetMeta(key MediaMetaKey, val string) error
SetMeta sets the specified media metadata key to the provided value. In order to save the metadata on the media file, call SaveMeta.
func (*Media) SetUserData ¶ added in v3.0.9
SetUserData associates the passed in user data with the media instance. The data can be retrieved by using the UserData method.
func (*Media) State ¶ added in v3.0.4
func (m *Media) State() (MediaState, error)
State returns the current state of the media instance.
func (*Media) Stats ¶
func (m *Media) Stats() (*MediaStats, error)
Stats returns playback statistics for the media.
func (*Media) StopParse ¶ added in v3.0.2
StopParse stops the parsing of the media. When the media parsing is stopped, the MediaParsedChanged event is sent and the parsing status of the media is set to MediaParseTimeout.
func (*Media) SubItems ¶ added in v3.0.4
SubItems returns a media list containing the sub-items of the current media instance. If the media does not have any sub-items, an empty media list is returned.
NOTE: Call the Release method on the returned media list in order to free the allocated resources.
func (*Media) Tracks ¶ added in v3.0.7
func (m *Media) Tracks() ([]*MediaTrack, error)
Tracks returns the tracks (audio, video, subtitle) of the current media.
NOTE: The tracks can only be obtained for parsed media instances. Either play the media once or call one of the parsing methods first.
type MediaAudioTrack ¶ added in v3.0.7
type MediaAudioTrack struct { Channels uint // number of audio channels. Rate uint // audio sample rate. }
MediaAudioTrack contains information specific to audio media tracks.
type MediaDiscoverer ¶ added in v3.1.3
type MediaDiscoverer struct {
// contains filtered or unexported fields
}
MediaDiscoverer represents a media discovery service. Discovery services use different discovery protocols (e.g. MTP, UPnP, SMB) in order to find available media instances.
func NewMediaDiscoverer ¶ added in v3.1.3
func NewMediaDiscoverer(name string) (*MediaDiscoverer, error)
NewMediaDiscoverer instantiates the media discovery service identified by the specified name. Use the ListMediaDiscoverers method to obtain the list of available discovery service descriptors.
NOTE: Call the Release method on the discovery service instance in order to free the allocated resources.
func (*MediaDiscoverer) IsRunning ¶ added in v3.1.3
func (md *MediaDiscoverer) IsRunning() bool
IsRunning returns true if the media discovery service is running.
func (*MediaDiscoverer) MediaList ¶ added in v3.1.3
func (md *MediaDiscoverer) MediaList() (*MediaList, error)
MediaList returns the media list associated with the discovery service, which contains the found media instances.
NOTE: The returned media list is read-only.
func (*MediaDiscoverer) Release ¶ added in v3.1.3
func (md *MediaDiscoverer) Release() error
Release stops and destroys the media discovery service along with all the media found by the instance.
func (*MediaDiscoverer) Start ¶ added in v3.1.3
func (md *MediaDiscoverer) Start(cb MediaDiscoveryCallback) error
Start starts the media discovery service and reports discovery events through the specified callback function.
NOTE: The Stop and Release methods should not be called from the callback function. Doing so will result in undefined behavior.
func (*MediaDiscoverer) Stop ¶ added in v3.1.3
func (md *MediaDiscoverer) Stop() error
Stop stops the discovery service.
type MediaDiscovererDescriptor ¶ added in v3.1.3
type MediaDiscovererDescriptor struct { Name string LongName string Category MediaDiscoveryCategory }
MediaDiscovererDescriptor contains information about a media discovery service. Pass the `Name` field to the NewMediaDiscoverer method in order to create a new discovery service instance.
func ListMediaDiscoverers ¶ added in v3.1.3
func ListMediaDiscoverers(category MediaDiscoveryCategory) ([]*MediaDiscovererDescriptor, error)
ListMediaDiscoverers returns a list of descriptors identifying the available media discovery services of the specified category.
type MediaDiscoveryCallback ¶ added in v3.1.3
MediaDiscoveryCallback is used by media discovery services to report discovery events. The callback provides the event, the media instance, and the index at which the action takes place in the media list of the discovery service.
The available events are:
- MediaListWillAddItem
- MediaListItemAdded
- MediaListWillDeleteItem
- MediaListItemDeleted
type MediaDiscoveryCategory ¶ added in v3.1.3
type MediaDiscoveryCategory uint
MediaDiscoveryCategory defines categories of media discovery services.
const ( // Devices (e.g. portable devices supporting MTP, discs). MediaDiscoveryDevices MediaDiscoveryCategory = iota // LAN/WAN services (e.g. UPnP, SMB, SAP). MediaDiscoveryLAN // Internet services (e.g. podcasts, radio stations). MediaDiscoveryInternet // Local directories. MediaDiscoveryLocal )
Media discovery categories.
type MediaList ¶
type MediaList struct {
// contains filtered or unexported fields
}
MediaList represents a collection of media files.
func NewMediaList ¶
NewMediaList creates an empty media list.
func (*MediaList) AddMedia ¶
AddMedia adds the provided Media instance at the end of the media list.
func (*MediaList) AddMediaFromPath ¶
AddMediaFromPath loads the media file at the specified path and adds it at the end of the media list.
func (*MediaList) AddMediaFromReadSeeker ¶ added in v3.0.9
func (ml *MediaList) AddMediaFromReadSeeker(r io.ReadSeeker) error
AddMediaFromReadSeeker loads the media from the provided read seeker and adds it at the end of the media list.
func (*MediaList) AddMediaFromURL ¶
AddMediaFromURL loads the media file at the specified URL and adds it at the end of the the media list.
func (*MediaList) AssociateMedia ¶ added in v3.0.4
AssociateMedia associates the specified media with the media list instance.
NOTE: If another media instance is already associated with the list, it will be released.
func (*MediaList) AssociatedMedia ¶ added in v3.0.4
AssociatedMedia returns the media instance associated with the list, if one exists. A media instance is automatically associated with the list of its sub-items.
NOTE: Do not call Release on the returned media instance.
func (*MediaList) EventManager ¶
func (ml *MediaList) EventManager() (*EventManager, error)
EventManager returns the event manager responsible for the media list.
func (*MediaList) IndexOfMedia ¶ added in v3.0.3
IndexOfMedia returns the index of the specified media item in the list.
NOTE: The same instance of a media item can be present multiple times in the list. The method returns the first matched index.
func (*MediaList) InsertMedia ¶
InsertMedia inserts the provided Media instance in the list, at the specified index.
func (*MediaList) InsertMediaFromPath ¶
InsertMediaFromPath loads the media file at the provided path and inserts it in the list, at the specified index.
func (*MediaList) InsertMediaFromReadSeeker ¶ added in v3.0.9
func (ml *MediaList) InsertMediaFromReadSeeker(r io.ReadSeeker, index uint) error
InsertMediaFromReadSeeker loads the media from the provided read seeker and inserts it in the list, at the specified index.
func (*MediaList) InsertMediaFromURL ¶
InsertMediaFromURL loads the media file at the provided URL and inserts it in the list, at the specified index.
func (*MediaList) IsReadOnly ¶
IsReadOnly specifies if the media list can be modified.
func (*MediaList) MediaAtIndex ¶
MediaAtIndex returns the media item at the specified index from the list.
func (*MediaList) RemoveMediaAtIndex ¶
RemoveMediaAtIndex removes the media item at the specified index from the list.
type MediaMetaKey ¶
type MediaMetaKey uint
MediaMetaKey uniquely identifies a type of media metadata.
const ( MediaTitle MediaMetaKey = iota MediaArtist MediaGenre MediaCopyright MediaAlbum MediaTrackNumber MediaDescription MediaRating MediaDate MediaSetting MediaURL MediaLanguage MediaNowPlaying MediaPublisher MediaEncodedBy MediaArtworkURL MediaTrackID MediaTrackTotal MediaDirector MediaSeason MediaEpisode MediaShowName MediaActors MediaAlbumArtist MediaDiscNumber MediaDiscTotal )
Media metadata types.
func (MediaMetaKey) Validate ¶
func (mt MediaMetaKey) Validate() error
Validate checks if the media metadata key is valid.
type MediaParseOption ¶ added in v3.0.2
type MediaParseOption uint
MediaParseOption defines different options for parsing media files.
const ( // Parse media if it is a local file. MediaParseLocal MediaParseOption = 0x00 // Parse media if it is a local or network file. MediaParseNetwork MediaParseOption = 0x01 // Fetch metadata, track information and cover art using local resources. MediaFetchLocal MediaParseOption = 0x02 // Fetch metadata, track information and cover art using network resources. MediaFetchNetwork MediaParseOption = 0x04 // Interact with the user when preparsing media. Set this flag in order to // receive a callback if the input media is asking for credentials. MediaParseInteract MediaParseOption = 0x08 )
Media parse options.
type MediaParseStatus ¶ added in v3.0.2
type MediaParseStatus uint
MediaParseStatus represents the parsing status of a media file.
const ( MediaParseUnstarted MediaParseStatus = iota MediaParseSkipped MediaParseFailed MediaParseTimeout MediaParseDone )
Media parse statuses.
type MediaScreenOptions ¶ added in v3.0.3
type MediaScreenOptions struct { // Screen capture area. X int // Left edge coordinate of the subscreen. Default: 0. Y int // Top edge coordinate of the subscreen. Default: 0. Width int // Width of the subscreen. Default: 0 (full screen width). Height int // Height of the subscreen. Default: 0 (full screen height). // Screen capture frame rate. Default: 0. FPS float64 // Follow the mouse when capturing a subscreen. Default: false. FollowMouse bool // Mouse cursor image to use. If specified, the cursor will be overlayed // on the captured video. Default: "". // NOTE: Windows only. CursorImage string // Optimize the capture by fragmenting the screen in chunks of predefined // height (16 might be a good value). Default: 0 (disabled). // NOTE: Windows only. FragmentSize int }
MediaScreenOptions provides configuration options for creating media instances from the current computer screen.
type MediaState ¶
type MediaState uint
MediaState represents the state of a media file.
const ( MediaNothingSpecial MediaState = iota MediaOpening MediaBuffering MediaPlaying MediaPaused MediaStopped MediaEnded MediaError )
Media states.
type MediaStats ¶
type MediaStats struct { // Input statistics. ReadBytes int // Input bytes read. InputBitRate float64 // Input bit rate. // Demux statistics. DemuxReadBytes int // Demux bytes read (demuxed data size). DemuxBitRate float64 // Demux bit rate (content bit rate). DemuxCorrupted int // Demux corruptions (discarded). DemuxDiscontinuity int // Demux discontinuities (dropped). // Video output statistics. DecodedVideo int // Number of decoded video blocks. DisplayedPictures int // Number of displayed frames. LostPictures int // Number of lost frames. // Audio output statistics. DecodedAudio int // Number of decoded audio blocks. PlayedAudioBuffers int // Number of played audio buffers. LostAudioBuffers int // Number of lost audio buffers. }
MediaStats contains playback statistics for a media file.
type MediaSubtitleTrack ¶ added in v3.0.7
type MediaSubtitleTrack struct {
Encoding string // character encoding of the subtitle.
}
MediaSubtitleTrack contains information specific to subtitle media tracks.
type MediaTrack ¶ added in v3.0.7
type MediaTrack struct { ID int // Media track identifier. Type MediaTrackType // Media track type. BitRate uint // Media track bit rate. // libVLC representation of the four-character code of the codec used by // the media track. Codec uint // The original four-character code of the codec used by the media track, // extracted from the container. OriginalCodec uint // Codec profile (real audio flavor, MPEG audio layer, H264 profile, etc.). // NOTE: Profile values are codec specific. Profile int // Stream restriction level (resolution, bitrate, codec features, etc.). // NOTE: Level values are codec specific. Level int Language string // Media track language name. Description string // Description of the media track. // Type specific information. Audio *MediaAudioTrack Video *MediaVideoTrack Subtitle *MediaSubtitleTrack }
MediaTrack contains information regarding a media track.
func (*MediaTrack) CodecDescription ¶ added in v3.0.7
func (mt *MediaTrack) CodecDescription() (string, error)
CodecDescription returns the description of the codec used by the media track.
type MediaTrackDescriptor ¶ added in v3.1.1
type MediaTrackDescriptor struct { ID int // Media track identifier. Description string // Description of the media track. }
MediaTrackDescriptor contains information about a media track.
type MediaTrackType ¶ added in v3.0.7
type MediaTrackType int
MediaTrackType represents the type of a media track.
const ( MediaTrackUnknown MediaTrackType = iota - 1 MediaTrackAudio MediaTrackVideo MediaTrackText )
Media track types.
type MediaVideoTrack ¶ added in v3.0.7
type MediaVideoTrack struct { Width uint // video width. Height uint // video height. Orientation VideoOrientation // video orientation. Projection VideoProjection // video projection mode. Pose VideoViewpoint // video initial viewpoint. // Aspect ratio information. AspectRatioNum uint // aspect ratio numerator. AspectRatioDen uint // aspect ratio denominator. // Frame rate information. FrameRateNum uint // frame rate numerator. FrameRateDen uint // frame rate denominator. }
MediaVideoTrack contains information specific to video media tracks.
type ModuleDescription ¶ added in v3.0.4
ModuleDescription contains information about a libVLC module.
func ListAudioFilters ¶ added in v3.0.4
func ListAudioFilters() ([]*ModuleDescription, error)
ListAudioFilters returns the list of available audio filters.
func ListVideoFilters ¶ added in v3.0.4
func ListVideoFilters() ([]*ModuleDescription, error)
ListVideoFilters returns the list of available video filters.
type NavigationAction ¶ added in v3.1.5
type NavigationAction uint
NavigationAction defines actions for navigating menus of VCDs, DVDs and BDs.
const ( NavigationAction = iota NavigationActionUp NavigationActionDown NavigationActionLeft NavigationActionRight NavigationActionPopup )NavigationActionActivate
Navigation actions.
type PlaybackMode ¶
type PlaybackMode uint
PlaybackMode defines playback modes for a media list.
const ( Default PlaybackMode = iota Loop Repeat )
Playback modes.
func (PlaybackMode) Validate ¶ added in v3.1.6
func (pm PlaybackMode) Validate() error
Validate checks if the playback mode valid.
type Player ¶
type Player struct {
// contains filtered or unexported fields
}
Player is a media player used to play a single media file. For playing media lists (playlists) use ListPlayer instead.
func (*Player) AspectRatio ¶ added in v3.0.8
AspectRatio returns the aspect ratio of the current video.
func (*Player) AudioDelay ¶ added in v3.1.1
AudioDelay returns the delay of the current audio track, with microsecond precision.
func (*Player) AudioOutputDevice ¶ added in v3.1.4
AudioOutputDevice returns the name of the current audio output device used by the media player.
NOTE: The initial value for the current audio output device identifier may not be set or may be an unknown value. Applications should compare the returned value against the known device identifiers to find the current audio output device. It is possible for the audio output device to be changed externally. That may make the method unsuitable to use for applications which are attempting to track audio device changes.
func (*Player) AudioOutputDevices ¶ added in v3.1.4
func (p *Player) AudioOutputDevices() ([]*AudioOutputDevice, error)
AudioOutputDevices returns the list of available devices for the audio output used by the media player.
NOTE: Not all audio outputs support this. An empty list of devices does not imply that the audio output used by the player does not work. Some audio output devices in the list might not work in some circumstances. By default, it is recommended to not specify any explicit audio device.
func (*Player) AudioTrackCount ¶ added in v3.1.1
AudioTrackCount returns the number of audio tracks available in the current media of the player.
func (*Player) AudioTrackDescriptors ¶ added in v3.1.1
func (p *Player) AudioTrackDescriptors() ([]*MediaTrackDescriptor, error)
AudioTrackDescriptors returns a descriptor list of the available audio tracks for the current player media.
func (*Player) AudioTrackID ¶ added in v3.1.1
AudioTrackID returns the ID of the current audio track of the player.
NOTE: The method returns -1 if there is no active audio track.
func (*Player) Brightness ¶ added in v3.1.6
Brightness returns the brightness set to be used when rendering videos. The returned brightness is a value between 0.0 and 2.0. Default: 1.0.
func (*Player) ChapterCount ¶ added in v3.1.5
ChapterCount returns the number of chapters in the currently playing media.
NOTE: The method returns -1 if the player does not have a media instance.
func (*Player) ChapterIndex ¶ added in v3.1.5
ChapterIndex returns the index of the currently playing media chapter.
NOTE: The method returns -1 if the player does not have a media instance.
func (*Player) Contrast ¶ added in v3.1.6
Contrast returns the contrast set to be used when rendering videos. The returned contrast is a value between 0.0 and 2.0. Default: 1.0.
func (*Player) CursorPosition ¶ added in v3.1.4
CursorPosition returns the X and Y coordinates of the mouse cursor relative to the rendered area of the currently playing video.
NOTE: The coordinates are expressed in terms of the decoded video resolution, not in terms of pixels on the screen. Either coordinate may be negative or larger than the corresponding dimension of the video, if the cursor is outside the rendering area. The coordinates may be out of date if the pointer is not located on the video rendering area. libVLC does not track the pointer if it is outside of the video widget. Also, libVLC does not support multiple cursors.
func (*Player) EnableVideoAdjustments ¶ added in v3.1.6
EnableVideoAdjustments enables or disables video adjustments. By default, video adjustments are not enabled.
func (*Player) EventManager ¶
func (p *Player) EventManager() (*EventManager, error)
EventManager returns the event manager responsible for the media player.
func (*Player) Gamma ¶ added in v3.1.6
Gamma returns the gamma set to be used when rendering videos. The returned gamma is a value between 0.01 and 10.0. Default: 1.0.
func (*Player) HWND ¶ added in v3.0.2
HWND returns the handle of the Windows API window the media player is configured to render its video output to, or 0 if no window is set. The window can be set using the SetHWND method.
NOTE: The window handle is returned even if the player is not currently using it (for instance if it is playing an audio-only input).
func (*Player) Hue ¶ added in v3.1.6
Hue returns the hue set to be used when rendering videos. The returned hue is a value between -180.0 and 180.0. Default: 0.0.
func (*Player) IsFullScreen ¶
IsFullScreen returns the fullscreen status of the player.
func (*Player) IsMuted ¶ added in v3.0.8
IsMuted returns a boolean value that specifies whether the audio output of the player is muted.
func (*Player) IsPlaying ¶
IsPlaying returns a boolean value specifying if the player is currently playing.
func (*Player) IsScrambled ¶ added in v3.0.5
IsScrambled returns true if the media player is in a scrambled state.
func (*Player) IsSeekable ¶ added in v3.0.5
IsSeekable returns true if the current media is seekable.
func (*Player) LoadMediaFromPath ¶
LoadMediaFromPath loads the media located at the specified path and sets it as the current media of the player.
func (*Player) LoadMediaFromReadSeeker ¶ added in v3.0.9
func (p *Player) LoadMediaFromReadSeeker(r io.ReadSeeker) (*Media, error)
LoadMediaFromReadSeeker loads the media from the provided read seeker and sets it as the current media of the player.
func (*Player) LoadMediaFromURL ¶
LoadMediaFromURL loads the media located at the specified URL and sets it as the current media of the player.
func (*Player) MediaLength ¶
MediaLength returns media length in milliseconds.
func (*Player) MediaPosition ¶
MediaPosition returns media position as a float percentage between 0.0 and 1.0.
func (*Player) MediaState ¶
func (p *Player) MediaState() (MediaState, error)
MediaState returns the state of the current media.
func (*Player) NSObject ¶ added in v3.0.2
NSObject returns the handler of the NSView the media player is configured to render its video output to, or 0 if no view is set. See SetNSObject.
func (*Player) Navigate ¶ added in v3.1.5
func (p *Player) Navigate(action NavigationAction) error
Navigate executes the specified action in order to navigate menus of VCDs, DVDs and BDs.
func (*Player) NextChapter ¶ added in v3.1.5
NextChapter sets the next chapter to be played, if applicable to the current player media instance.
NOTE: The method has no effect if the current player media has no chapters.
func (*Player) PlaybackRate ¶ added in v3.0.5
PlaybackRate returns the playback rate of the media player.
NOTE: Depending on the underlying media, the returned rate may be different from the real playback rate.
func (*Player) PreviousChapter ¶ added in v3.1.5
PreviousChapter sets the previous chapter to be played, if applicable to the current player media instance.
NOTE: The method has no effect if the current player media has no chapters.
func (*Player) Role ¶ added in v3.1.4
func (p *Player) Role() (PlayerRole, error)
Role returns the role of the player.
func (*Player) Saturation ¶ added in v3.1.6
Saturation returns the saturation set to be used when rendering videos. The returned saturation is a value between 0.0 and 3.0. Default: 1.0.
func (*Player) Scale ¶ added in v3.0.8
Scale returns the scaling factor of the current video. A scaling factor of zero means the video is configured to fit in the available space.
func (*Player) SetAspectRatio ¶ added in v3.0.8
SetAspectRatio sets the aspect ratio of the current video (e.g. `16:9`).
NOTE: Invalid aspect ratios are ignored.
func (*Player) SetAudioDelay ¶ added in v3.1.1
SetAudioDelay delays the current audio track according to the specified duration, with microsecond precision. The delay can be either positive (the audio track is played later) or negative (the audio track is played earlier), and it defaults to zero.
NOTE: The audio delay is set to zero each time the player media changes.
func (*Player) SetAudioOutput ¶
SetAudioOutput sets the audio output to be used by the player. Any change will take effect only after playback is stopped and restarted. The audio output cannot be changed while playing.
func (*Player) SetAudioOutputDevice ¶ added in v3.1.4
SetAudioOutputDevice sets the audio output device to be used by the media player. The list of available devices can be obtained using the Player.AudioOutputDevices method. Pass in an empty string as the `output` parameter in order to move the current audio output to the specified device immediately. This is the recommended usage.
NOTE: The syntax for the `device` parameter depends on the audio output. Some audio output modules require further parameters. Due to a design bug in libVLC, the method does not return an error if the passed in device cannot be set. Use the Player.AudioOutputDevice method to check if the device has been set.
func (*Player) SetAudioTrack ¶ added in v3.1.1
SetAudioTrack sets the track identified by the specified ID as the current audio track of the player.
func (*Player) SetBrightness ¶ added in v3.1.6
SetBrightness sets the brightness to be used when rendering videos. The specified brightness must be a value between 0.0 and 2.0.
NOTE: this method has no effect if video adjustments are not enabled. The adjustments can be enabled using the Player.EnableVideoAdjustments method.
func (*Player) SetChapter ¶ added in v3.1.5
SetChapter sets the chapter with the specified index to be played, if applicable to the current player media instance.
NOTE: The method has no effect if the current player media has no chapters.
func (*Player) SetContrast ¶ added in v3.1.6
SetContrast sets the contrast to be used when rendering videos. The specified contrast must be a value between 0.0 and 2.0.
NOTE: this method has no effect if video adjustments are not enabled. The adjustments can be enabled using the Player.EnableVideoAdjustments method.
func (*Player) SetDeinterlaceMode ¶ added in v3.1.6
func (p *Player) SetDeinterlaceMode(mode DeinterlaceMode) error
SetDeinterlaceMode sets the deinterlace mode to use when rendering videos.
NOTE: pass in `vlc.DeinterlaceModeDisable` to disable deinterlacing.
func (*Player) SetEqualizer ¶ added in v3.1.2
SetEqualizer sets an equalizer for the player. The equalizer can be applied at any time (whether media playback is started or not) and it will be used for subsequently played media instances as well. In order to revert to the default equalizer, pass in `nil` as the equalizer parameter.
func (*Player) SetFullScreen ¶
SetFullScreen sets the fullscreen state of the media player. Pass in `true` to enable fullscreen, or `false` to disable it.
func (*Player) SetGamma ¶ added in v3.1.6
SetGamma sets the gamma to be used when rendering videos. The specified gamma must be a value between 0.01 and 10.0.
NOTE: this method has no effect if video adjustments are not enabled. The adjustments can be enabled using the Player.EnableVideoAdjustments method.
func (*Player) SetHWND ¶ added in v3.0.2
SetHWND sets a Windows API window handle where the media player can render its video output. If libVLC was built without Win32/Win64 API output support, calling this method has no effect.
NOTE: By default, libVLC captures input events on the video rendering area. Use the SetMouseInput and SetKeyInput methods if you want to handle input events in your application.
func (*Player) SetHue ¶ added in v3.1.6
SetHue sets the hue to be used when rendering videos. The specified hue must be a value between -180.0 and 180.0.
NOTE: this method has no effect if video adjustments are not enabled. The adjustments can be enabled using the Player.EnableVideoAdjustments method.
func (*Player) SetKeyInput ¶ added in v3.0.2
SetKeyInput enables or disables key press event handling, according to the libVLC hotkeys configuration. By default, keyboard events are handled by the libVLC video widget.
NOTE: This method works only for X11 and Win32 at the moment. NOTE: On X11, there can be only one subscriber for key press and mouse click events per window. If your application has subscribed to these events for the X window ID of the video widget, then libVLC will not be able to handle key presses and mouse clicks.
func (*Player) SetMediaPosition ¶
SetMediaPosition sets media position as percentage between 0.0 and 1.0. Some formats and protocols do not support this.
func (*Player) SetMediaTime ¶
SetMediaTime sets the media time in milliseconds. Some formats and protocols do not support this.
func (*Player) SetMouseInput ¶ added in v3.0.2
SetMouseInput enables or disables mouse click event handling. By default, mouse events are handled by the libVLC video widget. This is needed for DVD menus to work, as well as for a few video filters, such as "puzzle".
NOTE: This method works only for X11 and Win32 at the moment. NOTE: On X11, there can be only one subscriber for key press and mouse click events per window. If your application has subscribed to these events for the X window ID of the video widget, then libVLC will not be able to handle key presses and mouse clicks.
func (*Player) SetMute ¶ added in v3.0.8
SetMute mutes or unmutes the audio output of the player.
NOTE: If there is no active audio playback stream, the mute status might not be available. If digital pass-through (S/PDIF, HDMI, etc.) is in use, muting may not be applicable. Some audio output plugins do not support muting.
func (*Player) SetNSObject ¶ added in v3.0.2
SetNSObject sets a NSObject handler where the media player can render its video output. Use the vout called "macosx". The object can be a NSView or a NSObject following the VLCVideoViewEmbedding protocol.
@protocol VLCVideoViewEmbedding <NSObject> - (void)addVoutSubview:(NSView *)view; - (void)removeVoutSubview:(NSView *)view; @end
func (*Player) SetPause ¶
SetPause sets the pause state of the media player. Pass in `true` to pause the current media, or `false` to resume it.
func (*Player) SetPlaybackRate ¶ added in v3.0.5
SetPlaybackRate sets the playback rate of the media player.
NOTE: Depending on the underlying media, changing the playback rate might not be supported.
func (*Player) SetRenderer ¶ added in v3.1.0
SetRenderer sets a renderer for the player media (e.g. Chromecast).
NOTE: This method must be called before starting media playback in order to take effect.
func (*Player) SetRole ¶ added in v3.1.4
func (p *Player) SetRole(role PlayerRole) error
SetRole sets the role of the player.
func (*Player) SetSaturation ¶ added in v3.1.6
SetSaturation sets the saturation to be used when rendering videos. The specified saturation must be a value between 0.0 and 3.0.
NOTE: this method has no effect if video adjustments are not enabled. The adjustments can be enabled using the Player.EnableVideoAdjustments method.
func (*Player) SetScale ¶ added in v3.0.8
SetScale sets the scaling factor of the current video. The scaling factor is the ratio of the number of pixels displayed on the screen to the number of pixels in the original decoded video. A scaling factor of zero adjusts the video to fit in the available space.
NOTE: Not all video outputs support scaling.
func (*Player) SetStereoMode ¶ added in v3.1.2
func (p *Player) SetStereoMode(mode StereoMode) error
SetStereoMode sets the stereo mode of the audio output used by the player.
NOTE: The audio output might not support all stereo modes.
func (*Player) SetSubtitleDelay ¶ added in v3.1.1
SetSubtitleDelay delays the current subtitle track according to the specified duration, with microsecond precision. The delay can be either positive (the subtitle track is displayed later) or negative (the subtitle track is displayed earlier), and it defaults to zero.
NOTE: The subtitle delay is set to zero each time the player media changes.
func (*Player) SetSubtitleTrack ¶ added in v3.1.1
SetSubtitleTrack sets the track identified by the specified ID as the current subtitle track of the player.
func (*Player) SetTitle ¶ added in v3.1.5
SetTitle sets the title with the specified index to be played, if applicable to the current player media instance.
NOTE: The method has no effect if the current player media has no titles.
func (*Player) SetTitleDisplayMode ¶ added in v3.1.5
SetTitleDisplayMode configures if and how the video title will be displayed. Pass in `vlc.PositionDisable` in order to prevent the video title from being displayed. The title is displayed after the specified `timeout`.
func (*Player) SetVideoTrack ¶ added in v3.1.1
SetVideoTrack sets the track identified by the specified ID as the current video track of the player.
func (*Player) SetXWindow ¶
SetXWindow sets an X Window System drawable where the media player can render its video output. The call takes effect when the playback starts. If it is already started, it might need to be stopped before changes apply. If libVLC was built without X11 output support, calling this method has no effect.
NOTE: By default, libVLC captures input events on the video rendering area. Use the SetMouseInput and SetKeyInput methods if you want to handle input events in your application. By design, the X11 protocol delivers input events to only one recipient.
func (*Player) StereoMode ¶ added in v3.1.2
func (p *Player) StereoMode() (StereoMode, error)
StereoMode returns the stereo mode of the audio output used by the player.
func (*Player) SubtitleDelay ¶ added in v3.1.1
SubtitleDelay returns the delay of the current subtitle track, with microsecond precision.
func (*Player) SubtitleTrackCount ¶ added in v3.1.1
SubtitleTrackCount returns the number of subtitle tracks available in the current media of the player.
func (*Player) SubtitleTrackDescriptors ¶ added in v3.1.1
func (p *Player) SubtitleTrackDescriptors() ([]*MediaTrackDescriptor, error)
SubtitleTrackDescriptors returns a descriptor list of the available subtitle tracks for the current player media.
func (*Player) SubtitleTrackID ¶ added in v3.1.1
SubtitleTrackID returns the ID of the current subtitle track of the player.
NOTE: The method returns -1 if there is no active subtitle track.
func (*Player) TakeSnapshot ¶ added in v3.1.5
TakeSnapshot takes a snapshot of the current video and saves it at the specified output path. If the specified width is 0, the snapshot width will be calculated based on the specified height in order to preserve the original aspect ratio. Similarly, if the specified height is 0, the snapshot height will be calculated based on the specified width in order to preserve the original aspect ratio. If both the width and height values are 0, the original video size dimensions are used for the snapshot.
func (*Player) TitleChapterCount ¶ added in v3.1.5
TitleChapterCount returns the number of chapters available within the media title with the specified index.
NOTE: The method returns -1 if the player does not have a media instance.
func (*Player) TitleChapters ¶ added in v3.1.5
func (p *Player) TitleChapters(titleIndex int) ([]*ChapterInfo, error)
TitleChapters returns the list of chapters available within the media title with the specified index.
NOTE: The method returns -1 if the player does not have a media instance.
func (*Player) TitleCount ¶ added in v3.1.5
TitleCount returns the number of titles in the currently playing media.
NOTE: The method returns -1 if the player does not have a media instance.
func (*Player) TitleIndex ¶ added in v3.1.5
TitleIndex returns the index of the currently playing media title.
NOTE: The method returns -1 if the player does not have a media instance.
func (*Player) Titles ¶ added in v3.1.5
Titles returns the list of titles available within the currently playing media instance, if any. DVD and Blu-ray formats have their content split into titles.
func (*Player) ToggleFullScreen ¶
ToggleFullScreen toggles the fullscreen status of the player, on non-embedded video outputs.
func (*Player) ToggleMute ¶ added in v3.0.8
ToggleMute mutes or unmutes the audio output of the player, depending on the current status.
NOTE: If there is no active audio playback stream, the mute status might not be available. If digital pass-through (S/PDIF, HDMI, etc.) is in use, muting may not be applicable. Some audio output plugins do not support muting.
func (*Player) TogglePause ¶
TogglePause pauses or resumes the player, depending on its current status. Calling this method has no effect if there is no media.
func (*Player) UpdateVideoViewpoint ¶ added in v3.1.4
func (p *Player) UpdateVideoViewpoint(vp *VideoViewpoint, absolute bool) error
UpdateVideoViewpoint updates the viewpoint of the current media of the player. This method only works with 360° videos. If `absolute` is true, the passed in viewpoint replaces the current one. Otherwise, the current viewpoint is updated using the specified viewpoint values.
NOTE: It is safe to call this method before media playback is started.
func (*Player) VideoAdjustmentsEnabled ¶ added in v3.1.6
VideoAdjustmentsEnabled returns true if video adjustments are enabled. By default, video adjustments are not enabled.
func (*Player) VideoDimensions ¶ added in v3.1.4
VideoDimensions returns the width and height of the current media of the player, in pixels.
NOTE: The dimensions can only be obtained for parsed media instances. Either play the media or call one of the media parsing methods first.
func (*Player) VideoOutputCount ¶ added in v3.0.5
VideoOutputCount returns the number of video outputs the media player has.
func (*Player) VideoTrackCount ¶ added in v3.1.1
VideoTrackCount returns the number of video tracks available in the current media of the player.
func (*Player) VideoTrackDescriptors ¶ added in v3.1.1
func (p *Player) VideoTrackDescriptors() ([]*MediaTrackDescriptor, error)
VideoTrackDescriptors returns a descriptor list of the available video tracks for the current player media.
func (*Player) VideoTrackID ¶ added in v3.1.1
VideoTrackID returns the ID of the current video track of the player.
NOTE: The method returns -1 if there is no active video track.
func (*Player) WillPlay ¶
WillPlay returns true if the current media is not in a finished or error state.
func (*Player) XWindow ¶ added in v3.0.2
XWindow returns the identifier of the X window the media player is configured to render its video output to, or 0 if no window is set. The window can be set using the SetXWindow method.
NOTE: The window identifier is returned even if the player is not currently using it (for instance if it is playing an audio-only input).
type PlayerRole ¶ added in v3.1.4
type PlayerRole uint
PlayerRole defines the intended usage of a media player.
const ( // No role has been set. PlayerRoleNone PlayerRole = iota // Music (or radio) playback. PlayerRoleMusic // Video playback. PlayerRoleVideo // Speech, real-time communication. PlayerRoleCommunication // Video games. PlayerRoleGame // User interaction feedback. PlayerRoleNotification // Embedded animations (e.g. in a web page). PlayerRoleAnimation // Editing or production. PlayerRoleProduction // Accessibility. PlayerRoleAccessibility // Testing. PlayerRoleTest )
Player roles.
type Position ¶ added in v3.1.5
type Position int
Position defines locations of entities relative to a container.
type Renderer ¶ added in v3.1.0
type Renderer struct {
// contains filtered or unexported fields
}
Renderer represents a medium capable of rendering media files.
func (*Renderer) Flags ¶ added in v3.1.0
func (r *Renderer) Flags() (*RendererFlags, error)
Flags returns the flags of the renderer.
func (*Renderer) Type ¶ added in v3.1.0
func (r *Renderer) Type() (RendererType, error)
Type returns the type of the renderer.
type RendererDiscoverer ¶ added in v3.1.0
type RendererDiscoverer struct {
// contains filtered or unexported fields
}
RendererDiscoverer represents a renderer discovery service. Discovery services use different discovery protocols (e.g. mDNS) in order to find available media renderers (e.g. Chromecast).
func NewRendererDiscoverer ¶ added in v3.1.0
func NewRendererDiscoverer(name string) (*RendererDiscoverer, error)
NewRendererDiscoverer instantiates the renderer discovery service identified by the specified name. Use the ListRendererDiscoverers method to obtain the list of available discovery service descriptors.
NOTE: Call the Release method on the discovery service instance in order to free the allocated resources.
func (*RendererDiscoverer) Release ¶ added in v3.1.0
func (rd *RendererDiscoverer) Release() error
Release stops and destroys the renderer discovery service along with all the renderers found by the instance.
func (*RendererDiscoverer) Start ¶ added in v3.1.0
func (rd *RendererDiscoverer) Start(cb RendererDiscoveryCallback) error
Start starts the renderer discovery service and reports discovery events through the specified callback function.
NOTE: The Stop and Release methods should not be called from the callback function. Doing so will result in undefined behavior.
func (*RendererDiscoverer) Stop ¶ added in v3.1.0
func (rd *RendererDiscoverer) Stop() error
Stop stops the discovery service.
type RendererDiscovererDescriptor ¶ added in v3.1.0
RendererDiscovererDescriptor contains information about a renderer discovery service. Pass the `Name` field to the NewRendererDiscoverer method in order to create a new discovery service instance.
func ListRendererDiscoverers ¶ added in v3.1.0
func ListRendererDiscoverers() ([]*RendererDiscovererDescriptor, error)
ListRendererDiscoverers returns a list of descriptors identifying the available renderer discovery services.
type RendererDiscoveryCallback ¶ added in v3.1.0
RendererDiscoveryCallback is used by renderer discovery services to report discovery events.
The available events are:
- RendererDiscovererItemAdded
- RendererDiscovererItemDeleted
type RendererFlags ¶ added in v3.1.0
RendererFlags contains flags describing a renderer (e.g. capabilities).
type RendererType ¶ added in v3.1.0
type RendererType string
RendererType represents the type of a renderer.
const (
RendererChromecast RendererType = "chromecast"
)
Renderer types.
type StereoMode ¶ added in v3.1.2
type StereoMode int
StereoMode defines stereo modes which can be used by an audio output.
const ( StereoModeError StereoMode = iota - 1 StereoModeNotSet StereoModeNormal StereoModeReverse StereoModeLeft StereoModeRight StereoModeDolbySurround StereoModeHeadphones )
Stereo modes.
type TitleFlag ¶ added in v3.1.5
type TitleFlag uint
TitleFlag defines properties of media titles. DVD and Blu-ray formats have their content split into titles.
type TitleInfo ¶ added in v3.1.5
type TitleInfo struct { Name string // Name of the title. Duration time.Duration // Duration of the title. Flags TitleFlag // Flags describing title properties. }
TitleInfo contains information regarding a media title. DVD and Blu-ray formats have their content split into titles.
type VersionInfo ¶
VersionInfo contains details regarding the version of the libVLC module.
func Version ¶
func Version() VersionInfo
Version returns details regarding the version of the libVLC module.
func (VersionInfo) Changeset ¶ added in v3.0.4
func (v VersionInfo) Changeset() string
Changeset returns the changeset identifier for the current libVLC build.
func (VersionInfo) Compiler ¶ added in v3.0.4
func (v VersionInfo) Compiler() string
Compiler returns information regarding the compiler used to build libVLC.
func (VersionInfo) Runtime ¶ added in v3.0.4
func (v VersionInfo) Runtime() string
Runtime returns the runtime version of libVLC, usually including the codename of the build.
NOTE: Due to binary backward compatibility, the runtime version may be more recent than the build version.
func (VersionInfo) String ¶
func (v VersionInfo) String() string
String returns a string representation of the version.
type VideoOrientation ¶ added in v3.0.7
type VideoOrientation int
VideoOrientation represents the orientation of a video media track.
const ( // Normal. OrientationTopLeft VideoOrientation = iota // Flipped horizontally. OrientationTopRight // Flipped vertically. OrientationBottomLeft // Rotated 180 degrees. OrientationBottomRight // Transposed. OrientationLeftTop // Rotated 90 degrees anti-clockwise. OrientationLeftBottom // Rotated 90 degrees clockwise. OrientationRightTop // Anti-transposed. OrientationRightBottom )
Video orientations.
type VideoProjection ¶ added in v3.0.7
type VideoProjection int
VideoProjection represents the projection mode of a video media track.
const ( ProjectionRectangular VideoProjection = 0 ProjectionEquirectangular VideoProjection = 1 ProjectionCubemapLayoutStandard VideoProjection = 0x100 )
Video projections.
type VideoViewpoint ¶ added in v3.0.7
type VideoViewpoint struct { Yaw float64 // Viewpoint yaw in degrees [-180-180]. Pitch float64 // Viewpoint pitch in degrees [-90-90]. Roll float64 // Viewpoint roll in degrees [-180-180]. FOV float64 // Viewpoint field of view in degrees [0-180]. Default: 80. }
VideoViewpoint contains viewpoint information for a video media track.