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
IVideoPlayer.cs
1namespace Gondwana.Video;
2
6public interface IVideoPlayer : IDisposable
7{
8 // Control
9
14 void Open(Uri source);
15
21 void Open(Stream source, bool leaveOpen = false) => throw new NotSupportedException("This video backend does not support streams.");
22
25
27 bool IsMetadataReady => Metadata.Status == VideoMetadataStatus.Ready;
28
32 void Play();
33
37 void Pause();
38
42 void Stop();
43
48 void Seek(TimeSpan position);
49
54 void SetRate(double rate);
55
59 bool Loop { get; set; }
60
61 // Info
62
66 bool IsPlaying { get; }
67
71 TimeSpan Duration { get; }
72
76 TimeSpan Position { get; }
77
81 (int width, int height) NaturalSize { get; }
82
86 bool HasAudio { get; }
87
88 // Events
89
93 event EventHandler Started;
94
98 event EventHandler Paused;
99
103 event EventHandler Stopped;
104
108 event EventHandler Ended;
109
115 event EventHandler<VideoStateChangedEventArgs> StateChanged; // generic hook
116
121 event EventHandler<VideoFrameReadyEventArgs> FrameReady; // decoded frame callback
122}
Defines the contract for a video player that can play, pause, stop, and seek video content.
TimeSpan Position
Gets the current playback position in the video.
bool IsMetadataReady
True only when metadata for the current source is available.
EventHandler Stopped
Occurs when the video playback is stopped.
void Pause()
Pauses the video playback.
void Play()
Starts or resumes playback of the video.
void SetRate(double rate)
Sets the playback rate of the video.
TimeSpan Duration
Gets the total duration of the video.
EventHandler< VideoFrameReadyEventArgs > FrameReady
Occurs when a decoded BGRX frame is ready. The pointer is valid only during the callback....
EventHandler< VideoStateChangedEventArgs > StateChanged
Occurs when the video state changes, including MediaOpening, MediaOpened, MetadataReady,...
VideoMetadata Metadata
Gets an atomic snapshot of metadata availability and values for the current source.
bool HasAudio
Gets whether the video has an audio track. Consult IsMetadataReady before interpreting false.
bool IsPlaying
Gets a value indicating whether the video is currently playing.
EventHandler Started
Occurs when the video playback starts.
EventHandler Paused
Occurs when the video playback is paused.
bool Loop
Gets or sets a value indicating whether the video should loop when it reaches the end.
EventHandler Ended
Occurs when the video playback reaches the end.
void Stop()
Stops the video playback and resets the position.
void Seek(TimeSpan position)
Seeks to the specified position in the video.
void Open(Stream source, bool leaveOpen=false)
Opens a readable stream. Ownership transfers on success unless leaveOpen is true. Keep a borrowed str...
int width
Gets the natural size (width and height) of the video in pixels.
void Open(Uri source)
Opens a video from the specified source URI.
VideoMetadataStatus
The availability of metadata for the active source.
record VideoMetadata(VideoMetadataStatus Status, bool HasAudio, TimeSpan Duration)
An immutable metadata snapshot. Values are authoritative only when status is Ready.