vlc package - github.com/adrg/libvlc-go/v3 - Go Packages (original) (raw)

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

View Source

const ( MediaListViewItemAdded = 0x300 + iota MediaListViewWillAddItem MediaListViewItemDeleted MediaListViewWillDeleteItem )

Deprecated events.

View Source

const (

MediaListPlayerPlayed = 0x400 + [iota](/builtin#iota)


MediaListPlayerNextItemSet


MediaListPlayerStopped

)

View Source

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.

View Source

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.

View Source

var ( ErrListPlayerCreate = errors.New("could not create list player") ErrListPlayerNotInitialized = errors.New("list player not initialized") )

List player errors.

View Source

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.

View Source

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.

View Source

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.

View Source

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.

View Source

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.

View Source

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.

View Source

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.

Generic errors.

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() uint

EqualizerPresetCount returns the number of available equalizer presets.

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() []string

EqualizerPresetNames returns the names of all available equalizer presets, sorted by their indices in ascending order.

Init creates an instance of the libVLC module. Must be called only once and the module instance must be released using the Release function.

Release destroys the instance created by the Init function.

SetAppID sets metadata for identifying the application.

SetAppName sets the human-readable application name and the HTTP user agent. The specified user agent is used when a protocol requires it.

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.

AudioOutput contains information regarding an audio output.

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 struct { Name string Description string }

AudioOutputDevice contains information regarding an audio output device.

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.

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.

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 struct {

}

Equalizer represents an audio equalizer. Use Player.SetEqualizer to assign the equalizer to a player instance.

func NewEqualizer() (*Equalizer, error)

NewEqualizer returns a new equalizer with all frequency values set to zero.

func NewEqualizerFromPreset(index uint) (*Equalizer, error)

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().

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().

PreampValue returns the pre-amplification value of the equalizer in Hz.

Release destroys the equalizer instance.

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().

SetPreampValue sets the pre-amplification value of the equalizer. The specified amplification value is clamped to the [-20.0, 20.0] Hz range.

Event represents an event that can occur inside libvlc.

const (

MediaMetaChanged [Event](#Event) = [iota](/builtin#iota)


MediaSubItemAdded


MediaDurationChanged


MediaParsedChanged


MediaFreed


MediaStateChanged


MediaSubItemTreeAdded


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 [Event](#Event) = 0x200 + [iota](/builtin#iota)


MediaListWillAddItem


MediaListItemDeleted


MediaListWillDeleteItem


MediaListEndReached

)

Media list events.

const ( MediaDiscovererStarted Event = 0x500 + iota MediaDiscovererEnded )

Deprecated events.

const (

RendererDiscovererItemAdded [Event](#Event) = 0x502 + [iota](/builtin#iota)


RendererDiscovererItemDeleted

)

Renderer events.

const ( VlmMediaAdded Event = 0x600 + iota VlmMediaRemoved VlmMediaChanged VlmMediaInstanceStarted VlmMediaInstanceStopped VlmMediaInstanceStatusInit VlmMediaInstanceStatusOpening VlmMediaInstanceStatusPlaying VlmMediaInstanceStatusPause VlmMediaInstanceStatusEnd VlmMediaInstanceStatusError )

VideoLAN Manager events.

type EventCallback func(Event, interface{})

EventCallback represents an event notification callback function.

EventID uniquely identifies a registered event.

type EventManager struct {

}

EventManager wraps a libvlc event manager.

func (em *EventManager) Attach(event Event, callback EventCallback, userData interface{}) (EventID, error)

Attach registers a callback for an event notification.

func (em *EventManager) Detach(eventIDs ...EventID)

Detach unregisters the specified event notification.

type ListPlayer struct {

}

ListPlayer is an enhanced media player used to play media lists.

func NewListPlayer() (*ListPlayer, error)

NewListPlayer creates a new list player instance.

func (lp ListPlayer) EventManager() (EventManager, error)

EventManager returns the event manager responsible for the list player.

func (lp *ListPlayer) IsPlaying() bool

IsPlaying returns a boolean value specifying if the player is currently playing.

func (lp *ListPlayer) MediaList() *MediaList

MediaList returns the current media list of the player, if one exists.

MediaState returns the state of the current media.

Play plays the current media list.

PlayAtIndex plays the media at the specified index from the current media list.

PlayItem plays the specified media item. The item must be part of the current media list of the player.

PlayNext plays the next media in the current media list.

func (lp *ListPlayer) PlayPrevious() error

PlayPrevious plays the previous media in the current media list.

Player returns the underlying Player instance of the list player.

Release destroys the list player instance.

func (lp *ListPlayer) SetMediaList(ml *MediaList) error

SetMediaList sets the media list to be played.

SetPause sets the pause state of the list player. Pass in `true` to pause the current media, or `false` to resume it.

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 (lp *ListPlayer) SetPlayer(player *Player) error

SetPlayer sets the underlying Player instance of the list player.

Stop cancels the currently playing media list, if there is one.

func (lp *ListPlayer) TogglePause() error

TogglePause pauses/resumes the player. Calling this method has no effect if there is no media.

Logo represents a logo that can be displayed over a media instance.

For more information see https://wiki.videolan.org/Documentation:Modules/logo.

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.

Enable enables or disables the logo. By default, the logo is disabled.

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 (l *Logo) Position() (Position, error)

Position returns the position of the logo, relative to its container. Default: vlc.PositionTopLeft.

RepeatCount returns the number of times the logo sequence is set to be repeated.

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 (l Logo) SetFiles(files ...LogoFile) error

SetFiles sets the sequence of files to be displayed for the logo.

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 (l *Logo) SetPosition(position Position) error

SetPosition sets the position of the logo, relative to its container.

func (l *Logo) SetRepeatCount(count int) error

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).

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.

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.

X returns the X coordinate of the logo. The returned value is relative to the position of the logo inside its container, i.e. the position set using Logo.SetPosition method. Default: 0.

Y returns the Y coordinate of the logo. The returned value is relative to the position of the logo inside its container, i.e. the position set using the `Logo.SetPosition` method. Default: 0.

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.

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.

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.

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.

Color returns the marquee text color. Opacity information is included in the returned color. Default: white.

DisplayDuration returns the duration for which the marquee text is set to be displayed. Default: 0 (the marquee is displayed indefinitely).

Enable enables or disables the marquee. By default, the marquee is disabled.

Opacity returns the opacity of the marquee text. The returned opacity is a value between 0 (transparent) and 255 (opaque). Default: 255.

Position returns the position of the marquee, relative to its container. Default: vlc.PositionTopLeft.

RefreshInterval returns the interval between marquee text updates. The marquee text refreshes mainly when using time format string sequences. Default: 1s.

SetColor sets the color of the marquee text. The opacity of the text is also set, based on the alpha value of the color.

SetDisplayDuration sets the duration for which to display the marquee text.

SetOpacity sets the opacity of the marquee text. The opacity is specified as an integer between 0 (transparent) and 255 (opaque).

func (m *Marquee) SetPosition(position Position) error

SetPosition sets the position of the marquee, relative to its container.

SetRefreshInterval sets the interval between marquee text updates. The marquee text refreshes mainly when using time format string sequences.

SetSize sets the font size used to render the marquee text.

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.

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.

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.

Size returns the font size used to render the marquee text. Default: 0 (default font size is used).

Text returns the marquee text. Default: "".

X returns the X coordinate of the marquee text. The returned value is relative to the position of the marquee inside its container, i.e. the position set using the `Marquee.SetPosition` method. Default: 0.

Y returns the Y coordinate of the marquee text. The returned value is relative to the position of the marquee inside its container, i.e. the position set using the `Marquee.SetPosition` method. Default: 0.

Media is an abstract representation of a playable media file.

NewMediaFromPath creates a new media instance based on the media located at the specified path.

NewMediaFromReadSeeker creates a new media instance based on the provided read seeker.

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.

NewMediaFromURL creates a new media instance based on the media located at the specified URL.

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 (m Media) Duplicate() (Media, error)

Duplicate duplicates the current media instance.

NOTE: Call the Release method on the returned media in order to free the allocated resources.

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 (m Media) EventManager() (EventManager, error)

EventManager returns the event manager responsible for the media.

IsParsed returns true if the media was parsed.

NOTE: Deprecated in libVLC v3.0.0+. Use ParseStatus instead.

Location returns the media location, which can be either a local path or a URL, depending on how the media was loaded.

Meta reads the value of the specified media metadata key.

Parse fetches local art, metadata and track information synchronously.

NOTE: Deprecated in libVLC v3.0.0+. Use ParseWithOptions instead.

func (m *Media) ParseAsync() error

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.

ParseStatus returns the parsing status of the media.

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.

Release destroys the media instance.

SaveMeta saves the previously set media metadata.

SetMeta sets the specified media metadata key to the provided value. In order to save the metadata on the media file, call SaveMeta.

func (m *Media) SetUserData(userData interface{}) error

SetUserData associates the passed in user data with the media instance. The data can be retrieved by using the UserData method.

State returns the current state of the media instance.

Stats returns playback statistics for the media.

func (m *Media) StopParse() error

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 (m Media) SubItems() (MediaList, error)

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.

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 returns the type of the media instance.

func (m *Media) UserData() (interface{}, error)

UserData returns the user data associated with the media instance.

NOTE: The method returns nil if no user data is found.

type MediaAudioTrack struct { Channels uint Rate uint }

MediaAudioTrack contains information specific to audio media tracks.

type MediaDiscoverer struct {

}

MediaDiscoverer represents a media discovery service. Discovery services use different discovery protocols (e.g. MTP, UPnP, SMB) in order to find available media instances.

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 (md *MediaDiscoverer) IsRunning() bool

IsRunning returns true if the media discovery service is running.

MediaList returns the media list associated with the discovery service, which contains the found media instances.

NOTE: The returned media list is read-only.

Release stops and destroys the media discovery service along with all the media found by the instance.

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.

Stop stops the discovery service.

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(category MediaDiscoveryCategory) ([]*MediaDiscovererDescriptor, error)

ListMediaDiscoverers returns a list of descriptors identifying the available media discovery services of the specified category.

type MediaDiscoveryCallback func(Event, *Media, int)

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:

type MediaDiscoveryCategory uint

MediaDiscoveryCategory defines categories of media discovery services.

const (

MediaDiscoveryDevices [MediaDiscoveryCategory](#MediaDiscoveryCategory) = [iota](/builtin#iota)


MediaDiscoveryLAN


MediaDiscoveryInternet


MediaDiscoveryLocal

)

Media discovery categories.

type MediaList struct {

}

MediaList represents a collection of media files.

func NewMediaList() (*MediaList, error)

NewMediaList creates an empty media list.

AddMedia adds the provided Media instance at the end of the media list.

AddMediaFromPath loads the media file at the specified path and adds it at the end of the media list.

AddMediaFromReadSeeker loads the media from the provided read seeker and adds it at the end of the media list.

AddMediaFromURL loads the media file at the specified URL and adds it at the end of the the media list.

func (ml *MediaList) AssociateMedia(m *Media) error

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 (ml MediaList) AssociatedMedia() (Media, error)

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.

Count returns the number of media items in the list.

func (ml MediaList) EventManager() (EventManager, error)

EventManager returns the event manager responsible for the media list.

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.

InsertMedia inserts the provided Media instance in the list, at the specified index.

InsertMediaFromPath loads the media file at the provided path and inserts it in the list, at the specified index.

InsertMediaFromReadSeeker loads the media from the provided read seeker and inserts it in the list, at the specified index.

InsertMediaFromURL loads the media file at the provided URL and inserts it in the list, at the specified index.

IsReadOnly specifies if the media list can be modified.

Lock makes the caller the current owner of the media list.

MediaAtIndex returns the media item at the specified index from the list.

Release destroys the media list instance.

RemoveMediaAtIndex removes the media item at the specified index from the list.

Unlock releases ownership of the media list.

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.

Validate checks if the media metadata key is valid.

type MediaParseOption uint

MediaParseOption defines different options for parsing media files.

const (

MediaParseLocal [MediaParseOption](#MediaParseOption) = 0x00


MediaParseNetwork [MediaParseOption](#MediaParseOption) = 0x01


MediaFetchLocal [MediaParseOption](#MediaParseOption) = 0x02


MediaFetchNetwork [MediaParseOption](#MediaParseOption) = 0x04


MediaParseInteract [MediaParseOption](#MediaParseOption) = 0x08

)

Media parse options.

type MediaParseStatus uint

MediaParseStatus represents the parsing status of a media file.

const ( MediaParseUnstarted MediaParseStatus = iota MediaParseSkipped MediaParseFailed MediaParseTimeout MediaParseDone )

Media parse statuses.

MediaScreenOptions provides configuration options for creating media instances from the current computer screen.

MediaState represents the state of a media file.

const ( MediaNothingSpecial MediaState = iota MediaOpening MediaBuffering MediaPlaying MediaPaused MediaStopped MediaEnded MediaError )

Media states.

type MediaStats struct {

ReadBytes    [int](/builtin#int)     
InputBitRate [float64](/builtin#float64) 


DemuxReadBytes     [int](/builtin#int)     
DemuxBitRate       [float64](/builtin#float64) 
DemuxCorrupted     [int](/builtin#int)     
DemuxDiscontinuity [int](/builtin#int)     


DecodedVideo      [int](/builtin#int) 
DisplayedPictures [int](/builtin#int) 
LostPictures      [int](/builtin#int) 


DecodedAudio       [int](/builtin#int) 
PlayedAudioBuffers [int](/builtin#int) 
LostAudioBuffers   [int](/builtin#int) 

}

MediaStats contains playback statistics for a media file.

type MediaSubtitleTrack struct { Encoding string }

MediaSubtitleTrack contains information specific to subtitle media tracks.

MediaTrack contains information regarding a media track.

CodecDescription returns the description of the codec used by the media track.

type MediaTrackDescriptor struct { ID int
Description string }

MediaTrackDescriptor contains information about a media track.

MediaTrackType represents the type of a media track.

const ( MediaTrackUnknown MediaTrackType = iota - 1 MediaTrackAudio MediaTrackVideo MediaTrackText )

Media track types.

MediaType represents the type of a media file.

const ( MediaTypeUnknown MediaType = iota MediaTypeFile MediaTypeDirectory MediaTypeDisc MediaTypeStream MediaTypePlaylist )

MediaTypes.

type MediaVideoTrack struct { Width uint
Height uint
Orientation VideoOrientation Projection VideoProjection
Pose VideoViewpoint

AspectRatioNum [uint](/builtin#uint) 
AspectRatioDen [uint](/builtin#uint) 


FrameRateNum [uint](/builtin#uint) 
FrameRateDen [uint](/builtin#uint) 

}

MediaVideoTrack contains information specific to video media tracks.

ModuleDescription contains information about a libVLC module.

func ListAudioFilters() ([]*ModuleDescription, error)

ListAudioFilters returns the list of available audio filters.

func ListVideoFilters() ([]*ModuleDescription, error)

ListVideoFilters returns the list of available video filters.

type NavigationAction uint

NavigationAction defines actions for navigating menus of VCDs, DVDs and BDs.

const (

NavigationActionActivate [NavigationAction](#NavigationAction) = [iota](/builtin#iota)


NavigationActionUp


NavigationActionDown


NavigationActionLeft


NavigationActionRight

NavigationActionPopup

)

Navigation actions.

PlaybackMode defines playback modes for a media list.

const ( Default PlaybackMode = iota Loop Repeat )

Playback modes.

Validate checks if the playback mode valid.

Player is a media player used to play a single media file. For playing media lists (playlists) use ListPlayer instead.

NewPlayer creates an instance of a single-media player.

AspectRatio returns the aspect ratio of the current video.

AudioDelay returns the delay of the current audio track, with microsecond precision.

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 (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.

AudioTrackCount returns the number of audio tracks available in the current media of the player.

func (p Player) AudioTrackDescriptors() ([]MediaTrackDescriptor, error)

AudioTrackDescriptors returns a descriptor list of the available audio tracks for the current player media.

AudioTrackID returns the ID of the current audio track of the player.

NOTE: The method returns -1 if there is no active audio track.

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 (p *Player) CanPause() bool

CanPause returns true if the media player can be paused.

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.

ChapterIndex returns the index of the currently playing media chapter.

NOTE: The method returns -1 if the player does not have a media instance.

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.

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 (p *Player) EnableVideoAdjustments(enable bool) error

EnableVideoAdjustments enables or disables video adjustments. By default, video adjustments are not enabled.

func (p Player) EventManager() (EventManager, error)

EventManager returns the event manager responsible for the media player.

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.

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).

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.

IsFullScreen returns the fullscreen status of the player.

IsMuted returns a boolean value that specifies whether the audio output of the player is muted.

func (p *Player) IsPlaying() bool

IsPlaying returns a boolean value specifying if the player is currently playing.

func (p *Player) IsScrambled() bool

IsScrambled returns true if the media player is in a scrambled state.

func (p *Player) IsSeekable() bool

IsSeekable returns true if the current media is seekable.

LoadMediaFromPath loads the media located at the specified path and sets it as the current media of the player.

LoadMediaFromReadSeeker loads the media from the provided read seeker and sets it as the current media of the player.

LoadMediaFromURL loads the media located at the specified URL and sets it as the current media of the player.

func (p *Player) Logo() *Logo

Logo returns the logo of the player.

func (p *Player) Marquee() *Marquee

Marquee returns the marquee of the player.

Media returns the current media of the player, if one exists.

MediaLength returns media length in milliseconds.

MediaPosition returns media position as a float percentage between 0.0 and 1.0.

func (p *Player) MediaState() (MediaState, error)

MediaState returns the state of the current media.

MediaTime returns media time in milliseconds.

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.

Navigate executes the specified action in order to navigate menus of VCDs, DVDs and BDs.

func (p *Player) NextChapter() error

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 (p *Player) NextFrame() error

NextFrame displays the next video frame, if supported.

Play plays the current media.

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 (p *Player) PreviousChapter() error

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.

Release destroys the media player instance.

Role returns the role of the player.

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.

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.

SetAspectRatio sets the aspect ratio of the current video (e.g. `16:9`).

NOTE: Invalid aspect ratios are ignored.

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.

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 (p *Player) SetAudioOutputDevice(device, output string) error

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 (p *Player) SetAudioTrack(trackID int) error

SetAudioTrack sets the track identified by the specified ID as the current audio track of the player.

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 (p *Player) SetChapter(chapterIndex int) error

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.

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 (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 (p *Player) SetEqualizer(e *Equalizer) error

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.

SetFullScreen sets the fullscreen state of the media player. Pass in `true` to enable fullscreen, or `false` to disable it.

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.

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.

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.

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.

SetMedia sets the provided media as the current media of the player.

SetMediaPosition sets media position as percentage between 0.0 and 1.0. Some formats and protocols do not support this.

SetMediaTime sets the media time in milliseconds. Some formats and protocols do not support this.

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.

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.

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

SetPause sets the pause state of the media player. Pass in `true` to pause the current media, or `false` to resume it.

SetPlaybackRate sets the playback rate of the media player.

NOTE: Depending on the underlying media, changing the playback rate might not be supported.

func (p *Player) SetRenderer(r *Renderer) error

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.

SetRole sets the role of the player.

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.

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 (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.

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 (p *Player) SetSubtitleTrack(trackID int) error

SetSubtitleTrack sets the track identified by the specified ID as the current subtitle track of the player.

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.

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 (p *Player) SetVideoTrack(trackID int) error

SetVideoTrack sets the track identified by the specified ID as the current video track of the player.

SetVolume sets the volume of the player.

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 (p *Player) StereoMode() (StereoMode, error)

StereoMode returns the stereo mode of the audio output used by the player.

Stop cancels the currently playing media, if there is one.

SubtitleDelay returns the delay of the current subtitle track, with microsecond precision.

func (p *Player) SubtitleTrackCount() (int, error)

SubtitleTrackCount returns the number of subtitle tracks available in the current media of the player.

func (p Player) SubtitleTrackDescriptors() ([]MediaTrackDescriptor, error)

SubtitleTrackDescriptors returns a descriptor list of the available subtitle tracks for the current player media.

SubtitleTrackID returns the ID of the current subtitle track of the player.

NOTE: The method returns -1 if there is no active subtitle track.

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.

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 (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.

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.

TitleIndex returns the index of the currently playing media title.

NOTE: The method returns -1 if the player does not have a media instance.

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 (p *Player) ToggleFullScreen() error

ToggleFullScreen toggles the fullscreen status of the player, on non-embedded video outputs.

func (p *Player) ToggleMute() error

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 (p *Player) TogglePause() error

TogglePause pauses or resumes the player, depending on its current status. Calling this method has no effect if there is no media.

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.

VideoAdjustmentsEnabled returns true if video adjustments are enabled. By default, video adjustments are not enabled.

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 (p *Player) VideoOutputCount() int

VideoOutputCount returns the number of video outputs the media player has.

VideoTrackCount returns the number of video tracks available in the current media of the player.

func (p Player) VideoTrackDescriptors() ([]MediaTrackDescriptor, error)

VideoTrackDescriptors returns a descriptor list of the available video tracks for the current player media.

VideoTrackID returns the ID of the current video track of the player.

NOTE: The method returns -1 if there is no active video track.

Volume returns the volume of the player.

func (p *Player) WillPlay() bool

WillPlay returns true if the current media is not in a finished or error state.

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).

PlayerRole defines the intended usage of a media player.

const (

PlayerRoleNone [PlayerRole](#PlayerRole) = [iota](/builtin#iota)


PlayerRoleMusic


PlayerRoleVideo


PlayerRoleCommunication


PlayerRoleGame


PlayerRoleNotification


PlayerRoleAnimation


PlayerRoleProduction


PlayerRoleAccessibility


PlayerRoleTest

)

Player roles.

Position defines locations of entities relative to a container.

const ( PositionDisable Position = iota - 1 PositionCenter PositionLeft PositionRight PositionTop PositionTopLeft PositionTopRight PositionBottom PositionBottomLeft PositionBottomRight )

Positions.

Renderer represents a medium capable of rendering media files.

Flags returns the flags of the renderer.

IconURI returns the icon URI of the renderer.

Name returns the name of the renderer.

Type returns the type of the renderer.

type RendererDiscoverer struct {

}

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).

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.

Release stops and destroys the renderer discovery service along with all the renderers found by the instance.

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.

Stop stops the discovery service.

type RendererDiscovererDescriptor struct { Name string LongName string }

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() ([]*RendererDiscovererDescriptor, error)

ListRendererDiscoverers returns a list of descriptors identifying the available renderer discovery services.

type RendererDiscoveryCallback func(Event, *Renderer)

RendererDiscoveryCallback is used by renderer discovery services to report discovery events.

The available events are:

type RendererFlags struct { AudioEnabled bool VideoEnabled bool }

RendererFlags contains flags describing a renderer (e.g. capabilities).

RendererType represents the type of a renderer.

const ( RendererChromecast RendererType = "chromecast" )

Renderer types.

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.

TitleFlag defines properties of media titles. DVD and Blu-ray formats have their content split into titles.

const ( TitleFlagMenu TitleFlag = iota + 0x01

TitleFlagInteractive

)

Title flags.

TitleInfo contains information regarding a media title. DVD and Blu-ray formats have their content split into titles.

type VersionInfo struct { Major uint Minor uint Patch uint }

VersionInfo contains details regarding the version of the libVLC module.

func Version() VersionInfo

Version returns details regarding the version of the libVLC module.

Changeset returns the changeset identifier for the current libVLC build.

Compiler returns information regarding the compiler used to build libVLC.

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.

String returns a string representation of the version.

type VideoOrientation int

VideoOrientation represents the orientation of a video media track.

const (

OrientationTopLeft [VideoOrientation](#VideoOrientation) = [iota](/builtin#iota)


OrientationTopRight


OrientationBottomLeft


OrientationBottomRight


OrientationLeftTop


OrientationLeftBottom


OrientationRightTop


OrientationRightBottom

)

Video orientations.

VideoProjection represents the projection mode of a video media track.

const ( ProjectionRectangular VideoProjection = 0 ProjectionEquirectangular VideoProjection = 1 ProjectionCubemapLayoutStandard VideoProjection = 0x100 )

Video projections.

VideoViewpoint contains viewpoint information for a video media track.