34 Func<IVideoPlayer>? playerFactory =
null,
35 string? nickname =
null)
39 ValidateBounds(bounds).Location,
44 ArgumentNullException.ThrowIfNull(view);
45 ArgumentNullException.ThrowIfNull(source);
49 () => player = (playerFactory ?? DefaultPlayerFactory)(),
78 Func<IVideoPlayer>? playerFactory =
null,
79 string? nickname =
null)
83 ValidateBounds(bounds).Location,
88 ArgumentNullException.ThrowIfNull(sceneLayer);
89 ArgumentNullException.ThrowIfNull(source);
93 () => player = (playerFactory ?? DefaultPlayerFactory)(),
123 string? nickname =
null)
129 OwnedPlayerFactory(player),
147 string? nickname =
null)
153 OwnedPlayerFactory(player),
169 ValidateBounds(bounds);
174 Video.ScreenBounds = bounds;
176 Video.WorldBounds = bounds;
192 public void Seek(TimeSpan position) =>
Video.Seek(position);
206 public bool Loop {
get =>
Video.Loop;
set => Video.Loop = value; }
221 set => Video.Volume = value;
227 get =>
Video.IsMuted;
228 set => Video.IsMuted = value;
250 public event EventHandler
Started { add => _player.Started += value;
remove => _player.Started -= value; }
253 public event EventHandler
Paused { add => _player.Paused += value;
remove => _player.Paused -= value; }
256 public event EventHandler
Stopped { add => _player.Stopped += value;
remove => _player.Stopped -= value; }
259 public event EventHandler
Ended { add => _player.Ended += value;
remove => _player.Ended -= value; }
264 add => _player.StateChanged += value;
265 remove => _player.StateChanged -= value;
268 private void InitializeVideo()
272 Add(
Video, keepCurrentOffset:
false, explicitLocalOffsetPx: Vector2.Zero);
285 private static IVideoPlayer DefaultPlayerFactory() =>
new VlcVideoPlayer();
287 private static Func<IVideoPlayer> OwnedPlayerFactory(IVideoPlayer player)
289 ArgumentNullException.ThrowIfNull(player);
293 private static Rectangle ValidateBounds(Rectangle bounds)
295 if (bounds.Width <= 0 || bounds.Height <= 0)
296 throw new ArgumentOutOfRangeException(nameof(bounds), bounds,
"Video widget size must be positive.");
SceneLayer? SceneLayer
Gets the scene layer shared by all children in scene-layer mode.
DirectComposite SetLocalOffset(IDirectCompositeChild child, Vector2 newLocalOffsetPx)
Changes one child's local offset and reapplies its position.
View? View
Gets the view shared by all children in view mode.
virtual DirectComposite Add(IDirectCompositeChild child, bool keepCurrentOffset=true, Vector2? explicitLocalOffsetPx=null)
Adds a composite-compatible direct drawable as a child.
void SetPosition(Vector2 position)
Sets the composite anchor and repositions all children from their stored offsets.
DirectDrawingMode Mode
Gets the coordinate mode shared by the composite and its children.
Draws video frames provided by IVideoPlayer onto the backbuffer. Audio is handled by the IVideoPlayer...
Represents a base class for hosting a render surface, providing functionality for managing rendering ...
A URI, borrowed/owned stream, or GAF asset to open with a video backend.
Defines the contract for a video player that can play, pause, stop, and seek video content.
@ Rectangle
Particles are spawned uniformly within a rectangular area. This is the default distribution.
DirectDrawingMode
Specifies where direct drawing operations are applied within the rendering pipeline.
@ View
Performs direct drawing at the view level using screen-space coordinates.
StretchMode
Defines how video content should be stretched or scaled to fit within its display bounds.
record VideoMetadata(VideoMetadataStatus Status, bool HasAudio, TimeSpan Duration)
An immutable metadata snapshot. Values are authoritative only when status is Ready.