Gondwana Game Engine Development (master) - 2.6.1
Gondwana is a cross-platform 2.5D game and rendering engine written in C#/.NET 8. It provides fine-grained control over rendering, timing, and scene composition, with built-in support for parallax, z-ordering, pixel overhang, collision detection, and particle effects. Gondwana targets desktop and web platforms using SkiaSharp for graphics and pluggable audio backends for desktop and browser targets.
Loading...
Searching...
No Matches
Gondwana.Video.VlcVideoPlayer Class Referencesealed

Desktop/native LibVLC 3 player. Controls are serialized; event handlers must not block on the engine thread. FrameReady runs on a decoder thread and is copy-only. More...

Inheritance diagram for Gondwana.Video.VlcVideoPlayer:
Gondwana.Video.IVideoPlayer

Public Member Functions

 VlcVideoPlayer (string[]? vlcArgs=null, int initialWidth=1280, int initialHeight=720)
 Creates a native desktop player. Native libraries are supplied by the application.
void Open (Uri source)
 Opens a video from the specified source URI.
Parameters
sourceThe URI of the video source to open.

void Open (Stream source, bool leaveOpen=false)
 Opens a readable stream. Ownership transfers on success unless leaveOpen is true. Keep a borrowed stream alive and unused until the next Open or Dispose. Seek/loop require a seekable stream. Backends without stream support throw without taking ownership.
Parameters
sourceThe source.
leaveOpenWhether to leave the supplied stream open after use.

void Play ()
 Starts or resumes playback of the video.
void Pause ()
 Pauses the video playback.
void Stop ()
 Stops the video playback and resets the position.
void Seek (TimeSpan position)
 Seeks to the specified position in the video.
Parameters
positionThe position to seek to in the video timeline.

void SetRate (double rate)
 Sets the playback rate of the video.
Parameters
rateThe playback rate multiplier (e.g., 1.0 for normal speed, 2.0 for double speed).

void Dispose ()

Properties

bool Loop [get, set]
 Gets or sets a value indicating whether the video should loop when it reaches the end.
bool IsPlaying [get]
 Gets a value indicating whether the video is currently playing.
VideoMetadata Metadata [get]
 Gets an atomic snapshot of metadata availability and values for the current source.
bool IsMetadataReady [get]
 True only when metadata for the current source is available.
bool HasAudio [get]
 Gets whether the video has an audio track. Consult IsMetadataReady before interpreting false.
TimeSpan Duration [get]
 Gets the total duration of the video.
TimeSpan Position [get]
 Gets the current playback position in the video.
int int height NaturalSize [get]
Exception? LastError [get]
 The most recent native callback or playback failure, if any.

Events

EventHandler? Started
EventHandler? Paused
EventHandler? Stopped
EventHandler? Ended
EventHandler< VideoStateChangedEventArgs >? StateChanged
EventHandler< VideoFrameReadyEventArgs >? FrameReady
Events inherited from Gondwana.Video.IVideoPlayer
EventHandler Started
 Occurs when the video playback starts.
EventHandler Paused
 Occurs when the video playback is paused.
EventHandler Stopped
 Occurs when the video playback is stopped.
EventHandler Ended
 Occurs when the video playback reaches the end.
EventHandler< VideoStateChangedEventArgs > StateChanged
 Occurs when the video state changes, including MediaOpening, MediaOpened, MetadataReady, and MetadataFailed. MediaOpening must precede frames for a replacement source, after callbacks for the prior source have stopped. Events may run on background threads.
EventHandler< VideoFrameReadyEventArgs > FrameReady
 Occurs when a decoded BGRX frame is ready. The pointer is valid only during the callback. Copy it before returning. Do not call engine/render operations or player controls here.

Additional Inherited Members

Public Attributes inherited from Gondwana.Video.IVideoPlayer
int width
 Gets the natural size (width and height) of the video in pixels.

Detailed Description

Desktop/native LibVLC 3 player. Controls are serialized; event handlers must not block on the engine thread. FrameReady runs on a decoder thread and is copy-only.

Definition at line 8 of file VlcVideoPlayer.cs.

Constructor & Destructor Documentation

◆ VlcVideoPlayer()

Gondwana.Video.VlcVideoPlayer.VlcVideoPlayer ( string?[] vlcArgs = null,
int initialWidth = 1280,
int initialHeight = 720 )

Creates a native desktop player. Native libraries are supplied by the application.

Parameters
vlcArgsOptional LibVLC arguments.
initialWidthLegacy compatibility argument, validated but not used to force a decode size.
initialHeightLegacy compatibility argument; actual dimensions come from format negotiation.

Definition at line 68 of file VlcVideoPlayer.cs.

Member Function Documentation

◆ Dispose()

void Gondwana.Video.VlcVideoPlayer.Dispose ( )

Definition at line 321 of file VlcVideoPlayer.cs.

◆ Open() [1/2]

void Gondwana.Video.VlcVideoPlayer.Open ( Stream source,
bool leaveOpen = false )

Opens a readable stream. Ownership transfers on success unless leaveOpen is true. Keep a borrowed stream alive and unused until the next Open or Dispose. Seek/loop require a seekable stream. Backends without stream support throw without taking ownership.

Parameters
sourceThe source.
leaveOpenWhether to leave the supplied stream open after use.

Implements Gondwana.Video.IVideoPlayer.

Definition at line 120 of file VlcVideoPlayer.cs.

◆ Open() [2/2]

void Gondwana.Video.VlcVideoPlayer.Open ( Uri source)

Opens a video from the specified source URI.

Parameters
sourceThe URI of the video source to open.

Implements Gondwana.Video.IVideoPlayer.

Definition at line 101 of file VlcVideoPlayer.cs.

◆ Pause()

void Gondwana.Video.VlcVideoPlayer.Pause ( )

Pauses the video playback.

Implements Gondwana.Video.IVideoPlayer.

Definition at line 288 of file VlcVideoPlayer.cs.

◆ Play()

void Gondwana.Video.VlcVideoPlayer.Play ( )

Starts or resumes playback of the video.

Implements Gondwana.Video.IVideoPlayer.

Definition at line 286 of file VlcVideoPlayer.cs.

◆ Seek()

void Gondwana.Video.VlcVideoPlayer.Seek ( TimeSpan position)

Seeks to the specified position in the video.

Parameters
positionThe position to seek to in the video timeline.

Implements Gondwana.Video.IVideoPlayer.

Definition at line 292 of file VlcVideoPlayer.cs.

◆ SetRate()

void Gondwana.Video.VlcVideoPlayer.SetRate ( double rate)

Sets the playback rate of the video.

Parameters
rateThe playback rate multiplier (e.g., 1.0 for normal speed, 2.0 for double speed).

Implements Gondwana.Video.IVideoPlayer.

Definition at line 294 of file VlcVideoPlayer.cs.

◆ Stop()

void Gondwana.Video.VlcVideoPlayer.Stop ( )

Stops the video playback and resets the position.

Implements Gondwana.Video.IVideoPlayer.

Definition at line 290 of file VlcVideoPlayer.cs.

Property Documentation

◆ Duration

TimeSpan Gondwana.Video.VlcVideoPlayer.Duration
get

Gets the total duration of the video.

Implements Gondwana.Video.IVideoPlayer.

Definition at line 44 of file VlcVideoPlayer.cs.

◆ HasAudio

bool Gondwana.Video.VlcVideoPlayer.HasAudio
get

Gets whether the video has an audio track. Consult IsMetadataReady before interpreting false.

Implements Gondwana.Video.IVideoPlayer.

Definition at line 42 of file VlcVideoPlayer.cs.

◆ IsMetadataReady

bool Gondwana.Video.VlcVideoPlayer.IsMetadataReady
get

True only when metadata for the current source is available.

Implements Gondwana.Video.IVideoPlayer.

Definition at line 40 of file VlcVideoPlayer.cs.

◆ IsPlaying

bool Gondwana.Video.VlcVideoPlayer.IsPlaying
get

Gets a value indicating whether the video is currently playing.

Implements Gondwana.Video.IVideoPlayer.

Definition at line 36 of file VlcVideoPlayer.cs.

◆ LastError

Exception? Gondwana.Video.VlcVideoPlayer.LastError
get

The most recent native callback or playback failure, if any.

Definition at line 50 of file VlcVideoPlayer.cs.

◆ Loop

bool Gondwana.Video.VlcVideoPlayer.Loop
getset

Gets or sets a value indicating whether the video should loop when it reaches the end.

Implements Gondwana.Video.IVideoPlayer.

Definition at line 34 of file VlcVideoPlayer.cs.

◆ Metadata

VideoMetadata Gondwana.Video.VlcVideoPlayer.Metadata
get

Gets an atomic snapshot of metadata availability and values for the current source.

Implements Gondwana.Video.IVideoPlayer.

Definition at line 38 of file VlcVideoPlayer.cs.

◆ NaturalSize

int int height Gondwana.Video.VlcVideoPlayer.NaturalSize
get

Implements Gondwana.Video.IVideoPlayer.

Definition at line 48 of file VlcVideoPlayer.cs.

◆ Position

TimeSpan Gondwana.Video.VlcVideoPlayer.Position
get

Gets the current playback position in the video.

Implements Gondwana.Video.IVideoPlayer.

Definition at line 46 of file VlcVideoPlayer.cs.

Event Documentation

◆ Ended

EventHandler? Gondwana.Video.VlcVideoPlayer.Ended

Definition at line 58 of file VlcVideoPlayer.cs.

◆ FrameReady

EventHandler<VideoFrameReadyEventArgs>? Gondwana.Video.VlcVideoPlayer.FrameReady

Definition at line 62 of file VlcVideoPlayer.cs.

◆ Paused

EventHandler? Gondwana.Video.VlcVideoPlayer.Paused

Definition at line 54 of file VlcVideoPlayer.cs.

◆ Started

EventHandler? Gondwana.Video.VlcVideoPlayer.Started

Definition at line 52 of file VlcVideoPlayer.cs.

◆ StateChanged

EventHandler<VideoStateChangedEventArgs>? Gondwana.Video.VlcVideoPlayer.StateChanged

Definition at line 60 of file VlcVideoPlayer.cs.

◆ Stopped

EventHandler? Gondwana.Video.VlcVideoPlayer.Stopped

Definition at line 56 of file VlcVideoPlayer.cs.