Table of Contents

Class MediaPlayer

Namespace
LibVLCSharp.Shared
Assembly
LibVLCSharp.dll

The MediaPlayer type is used to control playback, set renderers, provide events and much more

public class MediaPlayer : Internal, IDisposable
Inheritance
MediaPlayer
Implements
Inherited Members

Constructors

MediaPlayer(LibVLC)

Create an empty Media Player object

public MediaPlayer(LibVLC libVLC)

Parameters

libVLC LibVLC

the libvlc instance in which the Media Player

should be created.

MediaPlayer(Media)

Create a Media Player object from a Media

public MediaPlayer(Media media)

Parameters

media Media

the media. Afterwards the p_md can be safely

destroyed.

Properties

AspectRatio

Get/set current video aspect ratio. Set to null to reset to default Invalid aspect ratios are ignored.

public string? AspectRatio { get; set; }

Property Value

string

AudioDelay

Get current audio delay (microseconds).

public long AudioDelay { get; }

Property Value

long

AudioOutputDeviceEnum

Gets a list of potential audio output devices

Not all audio outputs support enumerating devices. The audio output may be functional even if the list is empty (NULL). The list may not be exhaustive. Some audio output devices in the list might not actually work in some circumstances.

By default, it is recommended to not specify any explicit audio device.
public AudioOutputDevice[] AudioOutputDeviceEnum { get; }

Property Value

AudioOutputDevice[]

AudioTrack

Get current audio track ID or -1 if no active input.

public int AudioTrack { get; }

Property Value

int

AudioTrackCount

Get the number of available audio tracks (int), or -1 if unavailable

public int AudioTrackCount { get; }

Property Value

int

AudioTrackDescription

Retrive the audio track description

public TrackDescription[] AudioTrackDescription { get; }

Property Value

TrackDescription[]

CanPause

True if the media player can pause

public bool CanPause { get; }

Property Value

bool

Channel

Get current audio channel.

public AudioOutputChannel Channel { get; }

Property Value

AudioOutputChannel

Chapter

Set movie chapter (if applicable).

Get the movie chapter number currently playing, or -1 if there is no media.
public int Chapter { get; set; }

Property Value

int

ChapterCount

Get the number of chapters in movie, or -1.

public int ChapterCount { get; }

Property Value

int

CropGeometry

Get/Set current crop filter geometry. Empty string to unset

public string? CropGeometry { get; set; }

Property Value

string

EnableHardwareDecoding

Enable/disable hardware decoding in a crossplatform way.

public bool EnableHardwareDecoding { get; set; }

Property Value

bool

EnableKeyInput

Enable or disable key press events handling, according to the LibVLC hotkeys configuration. By default and for historical reasons, keyboard events are handled by the LibVLC video widget. Note On X11, there can be only one subscriber for key press and mouse click events per window. If your application has subscribed to those events for the X window ID of the video widget, then LibVLC will not be able to handle key presses and mouse clicks in any case. Warning This function is only implemented for X11 and Win32 at the moment. true to handle key press events, false to ignore them.

public bool EnableKeyInput { set; }

Property Value

bool

EnableMouseInput

Enable or disable mouse click events handling. By default, those events are handled. This is needed for DVD menus to work, as well as a few video filters such as "puzzle". Warning This function is only implemented for X11 and Win32 at the moment. true to handle mouse click events, false to ignore them.

public bool EnableMouseInput { set; }

Property Value

bool

FileCaching

Caching value for local files, in milliseconds [0 .. 60000ms]

public uint FileCaching { get; set; }

Property Value

uint

Fps

Get the frames per second (fps) for this playing movie, or 0 if unspecified

public float Fps { get; }

Property Value

float

Fullscreen

Enable or disable fullscreen. Warning, TL;DR version : Unless you know what you're doing, don't use this. Put your VideoView inside a fullscreen control instead, refer to your platform documentation.

Warning, long version : With most window managers, only a top-level windows can be in full-screen mode. Hence, this function will not operate properly if libvlc_media_player_set_xwindow() was used to embed the video in a non-top-level window. In that case, the embedding window must be reparented to the root window before fullscreen mode is enabled. You will want to reparent it back to its normal parent when disabling fullscreen.

return the fullscreen status (boolean)
public bool Fullscreen { get; set; }

Property Value

bool

Hwnd

Set a Win32/Win64 API window handle (HWND) where the media player should render its video output. If LibVLC was built without Win32/Win64 API output support, then this has no effects.

Get the Windows API window handle (HWND) previously set
public nint Hwnd { get; set; }

Property Value

nint

IsPlaying

return true if the media player is playing, false otherwise

public bool IsPlaying { get; }

Property Value

bool

IsSeekable

True if the media player can seek

public bool IsSeekable { get; }

Property Value

bool

Length

The movie length (in ms), or -1 if there is no media.

public long Length { get; }

Property Value

long

Media

Get the media used by the media_player. Set the media that will be used by the media_player. If any, previous md will be released. Note: It is safe to release the Media on the C# side after it's been set on the MediaPlayer successfully

public Media? Media { get; set; }

Property Value

Media

Remarks

Each time this getter is called, the native media instance reference count is incremented. So, once you're done with the Media object after accessing it with this property, you should dispose of it.

Mute

Get current mute status. Set mute status. Warning This function does not always work. If there are no active audio playback stream, the mute status might not be available. If digital pass-through (S/PDIF, HDMI...) is in use, muting may be unapplicable. Also some audio output plugins do not support muting at all. Note To force silent playback, disable all audio tracks. This is more efficient and reliable than mute.

public bool Mute { get; set; }

Property Value

bool

NetworkCaching

Caching value for network resources, in milliseconds [0 .. 60000ms]

public uint NetworkCaching { get; set; }

Property Value

uint

NsObject

Get the NSView handler previously set return the NSView handler or 0 if none where set

Set the NSView handler where the media player should render its video output. Use the vout called "macosx".

The drawable is an NSObject that follow the VLCOpenGLVideoViewEmbedding protocol: VLCOpenGLVideoViewEmbedding NSObject Or it can be an NSView object. If you want to use it along with Qt4 see the QMacCocoaViewContainer. Then the following code should work: { NSView *video = [[NSView alloc] init]; QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent); libvlc_media_player_set_nsobject(mp, video); [video release]; } You can find a live example in VLCVideoView in VLCKit.framework.
public nint NsObject { get; set; }

Property Value

nint

OutputDevice

Get the current audio output device identifier. This complements SetOutputDevice(string, string?) warning The initial value for the current audio output device identifier may not be set or may be some unknown value.A LibVLC application should compare this value against the known device identifiers (e.g.those that were previously retrieved by a call to AudioOutputDeviceEnum or AudioOutputDevices(string)) to find the current audio output device.

It is possible that the selected audio output device changes(an external change) without a call to SetOutputDevice(string, string?).That may make this method unsuitable to use if a LibVLC application is attempting to track dynamic audio device changes as they happen.

public string? OutputDevice { get; }

Property Value

string

the current audio output device identifier, or NULL if no device is selected or in case of error.

Position

Set movie position as percentage between 0.0 and 1.0. This has no effect if playback is not enabled. This might not work depending on the underlying input format and protocol.

Get movie position as percentage between 0.0 and 1.0.
public float Position { get; set; }

Property Value

float

ProgramScambled

True if the current program is scrambled

LibVLC 2.2.0 or later
public bool ProgramScambled { get; }

Property Value

bool

Rate

Get the requested movie play rate. warning

Depending on the underlying media, the requested rate may be different from the real playback rate.
public float Rate { get; }

Property Value

float

Role

Gets the media role.

version LibVLC 3.0.0 and later.
public MediaPlayerRole Role { get; }

Property Value

MediaPlayerRole

Scale

Get/Set the current video scaling factor. See also MediaPlayer::setScale() . That is the ratio of the number of pixels on screen to the number of pixels in the original decoded video in each dimension.Zero is a special value; it will adjust the video to the output window/drawable(in windowed mode) or the entire screen. Note that not all video outputs support scaling.

public float Scale { get; set; }

Property Value

float

Spu

The current video subtitle track

public int Spu { get; }

Property Value

int

SpuCount

Get the number of available video subtitles.

public int SpuCount { get; }

Property Value

int

SpuDelay

Get the current subtitle delay.

public long SpuDelay { get; }

Property Value

long

SpuDescription

Retrieve SpuDescription in a TrackDescription struct

public TrackDescription[] SpuDescription { get; }

Property Value

TrackDescription[]

State

Get the current state of the media player (playing, paused, ...)

public VLCState State { get; }

Property Value

VLCState

Teletext

Get current teletext page requested. Set new teletext page to retrieve.

public int Teletext { get; set; }

Property Value

int

Time

Set the movie time (in ms). This has no effect if no media is being played. Not all formats and protocols support this.

Get the movie time (in ms), or -1 if there is no media.
public long Time { get; set; }

Property Value

long

Title

Set movie title number to play

Get movie title number currently playing, or -1
public int Title { get; set; }

Property Value

int

TitleCount

The title number count, or -1

public int TitleCount { get; }

Property Value

int

TitleDescription

Get the description of available titles.

public TrackDescription[] TitleDescription { get; }

Property Value

TrackDescription[]

VideoTrack

Get current video track ID (int) or -1 if no active input.

public int VideoTrack { get; }

Property Value

int

VideoTrackCount

Get number of available video tracks.

public int VideoTrackCount { get; }

Property Value

int

VideoTrackDescription

Get the description of available video tracks.

public TrackDescription[] VideoTrackDescription { get; }

Property Value

TrackDescription[]

Viewpoint

Current 360 viewpoint of this mediaplayer.

Update with UpdateViewpoint(float, float, float, float, bool)
public VideoViewpoint Viewpoint { get; }

Property Value

VideoViewpoint

Volume

Get/Set the volume in percents (0 = mute, 100 = 0dB)

public int Volume { get; set; }

Property Value

int

VoutCount

Get the number of video outputs

public uint VoutCount { get; }

Property Value

uint

WillPlay

True if the player is able to play

public bool WillPlay { get; }

Property Value

bool

XWindow

Set an X Window System drawable where the media player should 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, then this function has no effects. By default, LibVLC will capture input events on the video rendering area. Use libvlc_video_set_mouse_input() and libvlc_video_set_key_input() to disable that and deliver events to the parent window / to the application instead. By design, the X11 protocol delivers input events to only one recipient.

Warning: The application must call the XInitThreads() function from Xlib before libvlc_new(), and before any call to XOpenDisplay() directly or via any other library.Failure to call XInitThreads() will seriously impede LibVLC performance. Calling XOpenDisplay() before XInitThreads() will eventually crash the process. That is a limitation of Xlib. uint: X11 window ID
public uint XWindow { get; set; }

Property Value

uint

Methods

AddSlave(MediaSlaveType, string, bool)

Add a slave to the current media player. note If the player is playing, the slave will be added directly. This call will also update the slave list of the attached VLC::Media.

public bool AddSlave(MediaSlaveType type, string uri, bool select)

Parameters

type MediaSlaveType

subtitle or audio

uri string

Uri of the slave (should contain a valid scheme).

select bool

True if this slave should be selected when it's loaded

Returns

bool

AdjustFloat(VideoAdjustOption)

Get adjust option float value

public float AdjustFloat(VideoAdjustOption option)

Parameters

option VideoAdjustOption

The option for which to get the value

Returns

float

the float value for a given option

AdjustInt(VideoAdjustOption)

Get integer adjust option.

public int AdjustInt(VideoAdjustOption option)

Parameters

option VideoAdjustOption

adjust option to get, values of libvlc_video_adjust_option_t

Returns

int

ChapterCountForTitle(int)

Get the number of chapters in title, or -1

public int ChapterCountForTitle(int title)

Parameters

title int

Returns

int

ChapterDescription(int)

Get the description of available chapters for specific title.

public TrackDescription[] ChapterDescription(int titleIndex)

Parameters

titleIndex int

selected title

Returns

TrackDescription[]

chapter descriptions

Cursor(uint, ref int, ref int)

Get the mouse pointer coordinates over a video. Coordinates are expressed in terms of the decoded video resolution, not in terms of pixels on the screen/viewport (to get the latter, you can query your windowing system directly). Either of the coordinates may be negative or larger than the corresponding dimension of the video, if the cursor is outside the rendering area. Warning 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. Note LibVLC does not support multiple pointers(it does of course support multiple input devices sharing the same pointer) at the moment.

public bool Cursor(uint num, ref int px, ref int py)

Parameters

num uint

number of the video (starting from, and most commonly 0)

px int

pointer to get the abscissa [OUT]

py int

pointer to get the ordinate [OUT]

Returns

bool

true on success, false on failure

Dispose(bool)

Dispose override Effectively stops playback and disposes a media if any

protected override void Dispose(bool disposing)

Parameters

disposing bool

release any unmanaged resources

Equals(object?)

Equals override based on the native instance reference

public override bool Equals(object? obj)

Parameters

obj object

the mediaplayer instance to compare this to

Returns

bool

FullChapterDescriptions(int)

Get the full description of available chapters.

public ChapterDescription[] FullChapterDescriptions(int titleIndex = -1)

Parameters

titleIndex int

Index of the title to query for chapters (uses current title if set to -1)

Returns

ChapterDescription[]

Array of chapter descriptions.

GetHashCode()

Custom hascode implemenation for this MediaPlayer instance

public override int GetHashCode()

Returns

int

the hashcode for this MediaPlayer instance

LogoInt(VideoLogoOption)

Get integer logo option.

public int LogoInt(VideoLogoOption option)

Parameters

option VideoLogoOption

logo option to get, values of libvlc_video_logo_option_t

Returns

int

MarqueeInt(VideoMarqueeOption)

Get an integer marquee option value

public int MarqueeInt(VideoMarqueeOption option)

Parameters

option VideoMarqueeOption

marq option to get

Returns

int

MarqueeString(VideoMarqueeOption)

Get a string marquee option value

public string? MarqueeString(VideoMarqueeOption option)

Parameters

option VideoMarqueeOption

marq option to get

Returns

string

Navigate(uint)

Navigate through DVD Menu

public void Navigate(uint navigate)

Parameters

navigate uint

the Navigation mode

NextChapter()

Set next chapter (if applicable)

public void NextChapter()

NextFrame()

Display the next frame (if supported)

public void NextFrame()

Pause()

Toggle pause (no effect if there is no media)

public void Pause()

Play()

Start playback with Media that is set If playback was already started, this method has no effect

public bool Play()

Returns

bool

true if successful

Play(Media)

Set media and start playback

public bool Play(Media media)

Parameters

media Media

Returns

bool

true if successful

PreviousChapter()

Set previous chapter (if applicable)

public void PreviousChapter()

SeekTo(TimeSpan)

Set the movie time. This has no effect if no media is being played. Not all formats and protocols support this.

public void SeekTo(TimeSpan time)

Parameters

time TimeSpan

the movie time to seek to

SetAdjustFloat(VideoAdjustOption, float)

Set adjust option as float. Options that take a different type value are ignored.

public void SetAdjustFloat(VideoAdjustOption option, float value)

Parameters

option VideoAdjustOption

adust option to set, values of VideoAdjustOption

value float

adjust option value

SetAdjustInt(VideoAdjustOption, int)

Set adjust option as integer. Options that take a different type value are ignored. Passing libvlc_adjust_enable as option value has the side effect of starting (arg !0) or stopping (arg 0) the adjust filter.

public void SetAdjustInt(VideoAdjustOption option, int value)

Parameters

option VideoAdjustOption

adust option to set, values of libvlc_video_adjust_option_t

value int

adjust option value

SetAudioCallbacks(LibVLCAudioPlayCb, LibVLCAudioPauseCb?, LibVLCAudioResumeCb?, LibVLCAudioFlushCb?, LibVLCAudioDrainCb?)

Sets callbacks and private data for decoded audio. Use libvlc_audio_set_format() or libvlc_audio_set_format_callbacks() to configure the decoded audio format. Note: The audio callbacks override any other audio output mechanism. If the callbacks are set, LibVLC will not output audio in any way.

public void SetAudioCallbacks(MediaPlayer.LibVLCAudioPlayCb playCb, MediaPlayer.LibVLCAudioPauseCb? pauseCb, MediaPlayer.LibVLCAudioResumeCb? resumeCb, MediaPlayer.LibVLCAudioFlushCb? flushCb, MediaPlayer.LibVLCAudioDrainCb? drainCb)

Parameters

playCb MediaPlayer.LibVLCAudioPlayCb

callback to play audio samples (must not be NULL)

pauseCb MediaPlayer.LibVLCAudioPauseCb

callback to pause playback (or NULL to ignore)

resumeCb MediaPlayer.LibVLCAudioResumeCb

callback to resume playback (or NULL to ignore)

flushCb MediaPlayer.LibVLCAudioFlushCb

callback to flush audio buffers (or NULL to ignore)

drainCb MediaPlayer.LibVLCAudioDrainCb

callback to drain audio buffers (or NULL to ignore)

SetAudioDelay(long)

Set current audio delay. The audio delay will be reset to zero each time the media changes.

public bool SetAudioDelay(long delay)

Parameters

delay long

the audio delay (microseconds)

Returns

bool

true on success, false on error

SetAudioFormat(string, uint, uint)

Sets a fixed decoded audio format. This only works in combination with libvlc_audio_set_callbacks(), and is mutually exclusive with libvlc_audio_set_format_callbacks().

public void SetAudioFormat(string format, uint rate, uint channels)

Parameters

format string

a four-characters string identifying the sample format (e.g. "S16N" or "FL32")

rate uint

sample rate (expressed in Hz)

channels uint

channels count

SetAudioFormatCallback(LibVLCAudioSetupCb, LibVLCAudioCleanupCb)

Sets decoded audio format via callbacks. This only works in combination with libvlc_audio_set_callbacks().

public void SetAudioFormatCallback(MediaPlayer.LibVLCAudioSetupCb setupCb, MediaPlayer.LibVLCAudioCleanupCb cleanupCb)

Parameters

setupCb MediaPlayer.LibVLCAudioSetupCb

callback to select the audio format (cannot be NULL)

cleanupCb MediaPlayer.LibVLCAudioCleanupCb

callback to release any allocated resources (or NULL)

SetAudioOutput(string)

Selects an audio output module. Note: Any change will take effect only after playback is stopped and restarted. Audio output cannot be changed while playing.

public bool SetAudioOutput(string name)

Parameters

name string

name of audio output, use psz_name of

Returns

bool

true if function succeeded, false on error

SetAudioTrack(int)

Set current audio track.

public bool SetAudioTrack(int trackIndex)

Parameters

trackIndex int

the track ID (i_id field from track description)

Returns

bool

true on success, false on error

SetChannel(AudioOutputChannel)

Set current audio channel.

public bool SetChannel(AudioOutputChannel channel)

Parameters

channel AudioOutputChannel

the audio channel

Returns

bool

SetDeinterlace(string?)

Enable or disable deinterlace filter

public void SetDeinterlace(string? deinterlaceMode)

Parameters

deinterlaceMode string

type of deinterlace filter, null to disable

SetEqualizer(Equalizer)

Apply new equalizer settings to a media player. The equalizer is first created by invoking libvlc_audio_equalizer_new() or libvlc_audio_equalizer_new_from_preset(). It is possible to apply new equalizer settings to a media player whether the media player is currently playing media or not. Invoking this method will immediately apply the new equalizer settings to the audio output of the currently playing media if there is any. If there is no currently playing media, the new equalizer settings will be applied later if and when new media is played. Equalizer settings will automatically be applied to subsequently played media. To disable the equalizer for a media player invoke this method passing NULL for the p_equalizer parameter. The media player does not keep a reference to the supplied equalizer so it is safe for an application to release the equalizer reference any time after this method returns.

public bool SetEqualizer(Equalizer equalizer)

Parameters

equalizer Equalizer

opaque equalizer handle, or NULL to disable the equalizer for this media player

Returns

bool

true on success, false otherwise.

SetLogoInt(VideoLogoOption, int)

Set logo option as integer. Options that take a different type value are ignored. Passing libvlc_logo_enable as option value has the side effect of starting (arg !0) or stopping (arg 0) the logo filter.

public void SetLogoInt(VideoLogoOption option, int value)

Parameters

option VideoLogoOption

logo option to set, values of libvlc_video_logo_option_t

value int

logo option value

SetLogoString(VideoLogoOption, string?)

Set logo option as string. Options that take a different type value are ignored.

public void SetLogoString(VideoLogoOption option, string? logoValue)

Parameters

option VideoLogoOption

logo option to set, values of libvlc_video_logo_option_t

logoValue string

logo option value

SetMarqueeInt(VideoMarqueeOption, int)

Enable, disable or set an integer marquee option Setting libvlc_marquee_Enable has the side effect of enabling (arg !0) or disabling (arg 0) the marq filter.

public void SetMarqueeInt(VideoMarqueeOption option, int value)

Parameters

option VideoMarqueeOption

marq option to set

value int

marq option value

SetMarqueeString(VideoMarqueeOption, string?)

Enable, disable or set an string marquee option

public void SetMarqueeString(VideoMarqueeOption option, string? marqueeValue)

Parameters

option VideoMarqueeOption

marq option to set

marqueeValue string

marq option value

SetOutputDevice(string, string?)

Configures an explicit audio output device. If the module paramater is NULL, audio output will be moved to the device specified by the device identifier string immediately.This is the recommended usage. A list of adequate potential device strings can be obtained with AudioOutputDeviceEnum However passing NULL is supported in LibVLC version 2.2.0 and later only; in earlier versions, this function would have no effects when the module parameter was NULL. If the module parameter is not NULL, the device parameter of the corresponding audio output, if it exists, will be set to the specified string. A list of adequate potential device strings can be obtained with AudioOutputDevices(string)

public void SetOutputDevice(string deviceId, string? module = null)

Parameters

deviceId string

device identifier string

module string

If NULL, current audio output module. if non-NULL, name of audio output module

SetPause(bool)

Pause or resume (no effect if there is no media). version LibVLC 1.1.1 or later

public void SetPause(bool pause)

Parameters

pause bool

play/resume if true, pause if false

SetRate(float)

Set movie play rate

public int SetRate(float rate)

Parameters

rate float

movie play rate to set

Returns

int

return -1 if an error was detected, 0 otherwise (but even then, it might not actually work depending on the underlying media protocol)

SetRenderer(RendererItem?)

Set a renderer to the media player.

public bool SetRenderer(RendererItem? rendererItem)

Parameters

rendererItem RendererItem

discovered renderer item or null to fallback on local rendering

Returns

bool

true on success, false otherwise

SetRole(MediaPlayerRole)

Sets the media role.

version LibVLC 3.0.0 and later.
public bool SetRole(MediaPlayerRole role)

Parameters

role MediaPlayerRole

Returns

bool

true on success, false otherwise

SetSpu(int)

Set Spu (subtitle)

public bool SetSpu(int spu)

Parameters

spu int

Video subtitle track to select (id from track description)

Returns

bool

true on success, false otherwise

SetSpuDelay(long)

Set the subtitle delay. This affects the timing of when the subtitle will be displayed. Positive values result in subtitles being displayed later, while negative values will result in subtitles being displayed earlier. The subtitle delay will be reset to zero each time the media changes.

public bool SetSpuDelay(long delay)

Parameters

delay long

time (in microseconds) the display of subtitles should be delayed

Returns

bool

true if successful, false otherwise

SetVideoCallbacks(LibVLCVideoLockCb, LibVLCVideoUnlockCb?, LibVLCVideoDisplayCb?)

Set callbacks and private data to render decoded video to a custom area in memory. Use libvlc_video_set_format() or libvlc_video_set_format_callbacks() to configure the decoded format. Warning Rendering video into custom memory buffers is considerably less efficient than rendering in a custom window as normal. For optimal perfomances, VLC media player renders into a custom window, and does not use this function and associated callbacks. It is highly recommended that other LibVLC-based application do likewise. To embed video in a window, use libvlc_media_player_set_xid() or equivalent depending on the operating system. If window embedding does not fit the application use case, then a custom LibVLC video output display plugin is required to maintain optimal video rendering performances. The following limitations affect performance: Hardware video decoding acceleration will either be disabled completely, or require(relatively slow) copy from video/DSP memory to main memory. Sub-pictures(subtitles, on-screen display, etc.) must be blent into the main picture by the CPU instead of the GPU. Depending on the video format, pixel format conversion, picture scaling, cropping and/or picture re-orientation, must be performed by the CPU instead of the GPU. Memory copying is required between LibVLC reference picture buffers and application buffers (between lock and unlock callbacks).

public void SetVideoCallbacks(MediaPlayer.LibVLCVideoLockCb lockCb, MediaPlayer.LibVLCVideoUnlockCb? unlockCb, MediaPlayer.LibVLCVideoDisplayCb? displayCb)

Parameters

lockCb MediaPlayer.LibVLCVideoLockCb

callback to lock video memory (must not be NULL)

unlockCb MediaPlayer.LibVLCVideoUnlockCb

callback to unlock video memory (or NULL if not needed)

displayCb MediaPlayer.LibVLCVideoDisplayCb

callback to display video (or NULL if not needed)

SetVideoFormat(string, uint, uint, uint)

Set decoded video chroma and dimensions. This only works in combination with MediaPlayer::setCallbacks() , and is mutually exclusive with MediaPlayer::setFormatCallbacks()

public void SetVideoFormat(string chroma, uint width, uint height, uint pitch)

Parameters

chroma string

a four-characters string identifying the chroma (e.g."RV32" or "YUYV")

width uint

pixel width

height uint

pixel height

pitch uint

line pitch (in bytes)

SetVideoFormatCallbacks(LibVLCVideoFormatCb, LibVLCVideoCleanupCb?)

Set decoded video chroma and dimensions. This only works in combination with libvlc_video_set_callbacks().

public void SetVideoFormatCallbacks(MediaPlayer.LibVLCVideoFormatCb formatCb, MediaPlayer.LibVLCVideoCleanupCb? cleanupCb)

Parameters

formatCb MediaPlayer.LibVLCVideoFormatCb

callback to select the video format (cannot be NULL)

cleanupCb MediaPlayer.LibVLCVideoCleanupCb

callback to release any allocated resources (or NULL)

SetVideoTitleDisplay(Position, uint)

Set if, and how, the video title will be shown when media is played.

public void SetVideoTitleDisplay(Position position, uint timeout)

Parameters

position Position

position at which to display the title, or libvlc_position_disable to prevent the title from being displayed

timeout uint

title display timeout in milliseconds (ignored if libvlc_position_disable)

SetVideoTrack(int)

Set video track.

public bool SetVideoTrack(int trackIndex)

Parameters

trackIndex int

the track ID (i_id field from track description)

Returns

bool

true on sucess, false out of range

SetVolumeCallback(LibVLCVolumeCb)

Set callbacks and private data for decoded audio. This only works in combination with libvlc_audio_set_callbacks(). Use libvlc_audio_set_format() or libvlc_audio_set_format_callbacks() to configure the decoded audio format.

public void SetVolumeCallback(MediaPlayer.LibVLCVolumeCb volumeCb)

Parameters

volumeCb MediaPlayer.LibVLCVolumeCb

callback to apply audio volume, or NULL to apply volume in software

Size(uint, ref uint, ref uint)

Get the pixel dimensions of a video.

public bool Size(uint num, ref uint px, ref uint py)

Parameters

num uint

number of the video (starting from, and most commonly 0)

px uint

pointer to get the pixel width [OUT]

py uint

pointer to get the pixel height [OUT]

Returns

bool

Stop()

Stop the playback (no effect if there is no media) warning: This is synchronous, and will block until all VLC threads have been joined. Calling this from a VLC callback is a bound to cause a deadlock.

public void Stop()

TakeSnapshot(uint, string?, uint, uint)

Take a snapshot of the current video window. If i_width AND i_height is 0, original size is used. If i_width XOR i_height is 0, original aspect-ratio is preserved.

public bool TakeSnapshot(uint num, string? filePath, uint width, uint height)

Parameters

num uint

number of video output (typically 0 for the first/only one)

filePath string

the path where to save the screenshot to

width uint

the snapshot's width

height uint

the snapshot's height

Returns

bool

true on success

ToggleFullscreen()

Toggle fullscreen status on non-embedded video outputs.

warning: The same limitations applies to this function as to MediaPlayer::setFullscreen()
public void ToggleFullscreen()

ToggleMute()

Toggle mute status. Warning Toggling mute atomically is not always possible: On some platforms, other processes can mute the VLC audio playback stream asynchronously. Thus, there is a small race condition where toggling will not work. See also the limitations of libvlc_audio_set_mute().

public void ToggleMute()

ToggleTeletext()

Toggle teletext transparent status on video output.

public void ToggleTeletext()

UnsetEqualizer()

unsetEqualizer disable equalizer for this media player

public bool UnsetEqualizer()

Returns

bool

true on success, false otherwise.

UpdateViewpoint(float, float, float, float, bool)

Update the video viewpoint information. The values are set asynchronously, it will be used by the next frame displayed. It is safe to call this function before the media player is started. LibVLC 3.0.0 and later

public bool UpdateViewpoint(float yaw, float pitch, float roll, float fov, bool absolute = true)

Parameters

yaw float

view point yaw in degrees ]-180;180]

pitch float

view point pitch in degrees ]-90;90]

roll float

view point roll in degrees ]-180;180]

fov float

field of view in degrees ]0;180[ (default 80.)

absolute bool

if true replace the old viewpoint with the new one. If false, increase/decrease it.

Returns

bool

true if successful, false otherwise

Events

AudioDevice

The mediaplayer's audio device changed

public event EventHandler<MediaPlayerAudioDeviceEventArgs> AudioDevice

Event Type

EventHandler<MediaPlayerAudioDeviceEventArgs>

Backward

The mediaplayer went backward in the playback

public event EventHandler<EventArgs> Backward

Event Type

EventHandler<EventArgs>

Buffering

The mediaplayer is buffering

public event EventHandler<MediaPlayerBufferingEventArgs> Buffering

Event Type

EventHandler<MediaPlayerBufferingEventArgs>

ChapterChanged

The mediaplayer changed the chapter of a media

public event EventHandler<MediaPlayerChapterChangedEventArgs> ChapterChanged

Event Type

EventHandler<MediaPlayerChapterChangedEventArgs>

Corked

The mediaplayer is corked

public event EventHandler<EventArgs> Corked

Event Type

EventHandler<EventArgs>

ESAdded

The mediaplayer has a new Elementary Stream (ES)

public event EventHandler<MediaPlayerESAddedEventArgs> ESAdded

Event Type

EventHandler<MediaPlayerESAddedEventArgs>

ESDeleted

The mediaplayer has one less Elementary Stream (ES)

public event EventHandler<MediaPlayerESDeletedEventArgs> ESDeleted

Event Type

EventHandler<MediaPlayerESDeletedEventArgs>

ESSelected

An Elementary Stream (ES) was selected

public event EventHandler<MediaPlayerESSelectedEventArgs> ESSelected

Event Type

EventHandler<MediaPlayerESSelectedEventArgs>

EncounteredError

The mediaplayer encountered an error during playback

public event EventHandler<EventArgs> EncounteredError

Event Type

EventHandler<EventArgs>

EndReached

The mediaplayer reached the end of the playback

public event EventHandler<EventArgs> EndReached

Event Type

EventHandler<EventArgs>

Forward

The mediaplayer went forward in the playback

public event EventHandler<EventArgs> Forward

Event Type

EventHandler<EventArgs>

LengthChanged

The length of a playback changed

public event EventHandler<MediaPlayerLengthChangedEventArgs> LengthChanged

Event Type

EventHandler<MediaPlayerLengthChangedEventArgs>

MediaChanged

The media of this mediaplayer changed

public event EventHandler<MediaPlayerMediaChangedEventArgs> MediaChanged

Event Type

EventHandler<MediaPlayerMediaChangedEventArgs>

Muted

The mediaplayer is muted

public event EventHandler<EventArgs> Muted

Event Type

EventHandler<EventArgs>

NothingSpecial

Nothing special to report

public event EventHandler<EventArgs> NothingSpecial

Event Type

EventHandler<EventArgs>

Opening

The mediaplayer is opening a media

public event EventHandler<EventArgs> Opening

Event Type

EventHandler<EventArgs>

PausableChanged

The mediaplayer's pause capability changed

public event EventHandler<MediaPlayerPausableChangedEventArgs> PausableChanged

Event Type

EventHandler<MediaPlayerPausableChangedEventArgs>

Paused

The mediaplayer paused playback

public event EventHandler<EventArgs> Paused

Event Type

EventHandler<EventArgs>

Playing

The mediaplayer started playing a media

public event EventHandler<EventArgs> Playing

Event Type

EventHandler<EventArgs>

PositionChanged

The mediaplayer's position changed

public event EventHandler<MediaPlayerPositionChangedEventArgs> PositionChanged

Event Type

EventHandler<MediaPlayerPositionChangedEventArgs>

ScrambledChanged

The mediaplayer scrambled status changed

public event EventHandler<MediaPlayerScrambledChangedEventArgs> ScrambledChanged

Event Type

EventHandler<MediaPlayerScrambledChangedEventArgs>

SeekableChanged

The mediaplayer's seek capability changed

public event EventHandler<MediaPlayerSeekableChangedEventArgs> SeekableChanged

Event Type

EventHandler<MediaPlayerSeekableChangedEventArgs>

SnapshotTaken

The mediaplayer took a snapshot

public event EventHandler<MediaPlayerSnapshotTakenEventArgs> SnapshotTaken

Event Type

EventHandler<MediaPlayerSnapshotTakenEventArgs>

Stopped

The mediaplayer stopped playback

public event EventHandler<EventArgs> Stopped

Event Type

EventHandler<EventArgs>

TimeChanged

The mediaplayer's playback time changed

public event EventHandler<MediaPlayerTimeChangedEventArgs> TimeChanged

Event Type

EventHandler<MediaPlayerTimeChangedEventArgs>

TitleChanged

The title of the mediaplayer changed

public event EventHandler<MediaPlayerTitleChangedEventArgs> TitleChanged

Event Type

EventHandler<MediaPlayerTitleChangedEventArgs>

Uncorked

The mediaplayer is uncorked

public event EventHandler<EventArgs> Uncorked

Event Type

EventHandler<EventArgs>

Unmuted

The mediaplayer is unmuted

public event EventHandler<EventArgs> Unmuted

Event Type

EventHandler<EventArgs>

VolumeChanged

The mediaplayer's volume changed

public event EventHandler<MediaPlayerVolumeChangedEventArgs> VolumeChanged

Event Type

EventHandler<MediaPlayerVolumeChangedEventArgs>

Vout

The Video Output count of the MediaPlayer changed

public event EventHandler<MediaPlayerVoutEventArgs> Vout

Event Type

EventHandler<MediaPlayerVoutEventArgs>