Gondwana Game Engine Development (master) - 2.7.0
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) =>
22 throw new NotSupportedException("This video backend does not support streams.");
23
26
28 bool IsMetadataReady => Metadata.Status == VideoMetadataStatus.Ready;
29
31 bool CanControlAudio => false;
32
34 float Volume
35 {
36 get => 1;
37 set => throw new NotSupportedException("This video backend does not support volume control.");
38 }
39
42 {
43 get => false;
44 set => throw new NotSupportedException("This video backend does not support mute control.");
45 }
46
48 bool CanSeek => true;
49
51 Exception? LastError => null;
52
56 void Play();
57
61 void Pause();
62
66 void Stop();
67
72 void Seek(TimeSpan position);
73
78 void SetRate(double rate);
79
83 bool Loop { get; set; }
84
85 // Info
86
90 bool IsPlaying { get; }
91
95 TimeSpan Duration { get; }
96
100 TimeSpan Position { get; }
101
105 (int width, int height) NaturalSize { get; }
106
110 bool HasAudio { get; }
111
112 // Events
113
117 event EventHandler Started;
118
122 event EventHandler Paused;
123
127 event EventHandler Stopped;
128
132 event EventHandler Ended;
133
139 event EventHandler<VideoStateChangedEventArgs> StateChanged; // generic hook
140
145 event EventHandler<VideoFrameReadyEventArgs> FrameReady; // decoded frame callback
146}
Defines the contract for a video player that can play, pause, stop, and seek video content.
bool IsMuted
Mutes output without changing the retained volume.
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.
bool CanSeek
Whether the current media supports seeking. Legacy backends retain their existing seek behavior.
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.
bool CanControlAudio
Whether this backend exposes independent volume and mute controls.
void Stop()
Stops the video playback and resets the position.
float Volume
Audible output gain from zero to one. Legacy backends may not support setting it.
void Seek(TimeSpan position)
Seeks to the specified position in the video.
Exception? LastError
The most recent playback failure, when available.
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.