HtmlVideoElement Class

https://html.spec.whatwg.org/multipage/media.html#htmlvideoelement

public sealed class HtmlVideoElement : HtmlMediaElement
Inheritance
HtmlMediaElement HtmlVideoElement

Properties

NameDescription
DisablePictureInPictureGets or sets whether the user agent must not show the video in Picture-in-Picture (https://w3c.github.io/picture-in-picture/#disable-pip): when set, the pending requests fail and the video leaves Picture-in-Picture.
HeightGets or sets the value of the height content attribute.
OnEnterPictureInPictureGets or sets the handler of the enterpictureinpicture event.
OnLeavePictureInPictureGets or sets the handler of the leavepictureinpicture event.
PlaysInlineGets or sets a value indicating whether the element has the playsinline content attribute.
PosterGets or sets the poster content attribute, as a URL resolved against the base URL of the document.
VideoHeightGets the natural height of the video in CSS pixels (https://html.spec.whatwg.org/multipage/media.html#dom-video-videoheight), or 0 when the dimensions are not known (the ready state is HAVE_NOTHING, or the resource has no video).
VideoWidthGets the natural width of the video in CSS pixels (https://html.spec.whatwg.org/multipage/media.html#dom-video-videowidth), or 0 when the dimensions are not known (the ready state is HAVE_NOTHING, or the resource has no video).
WidthGets or sets the value of the width content attribute.

DisablePictureInPicture

PictureInPicture.cs

Gets or sets whether the user agent must not show the video in Picture-in-Picture (https://w3c.github.io/picture-in-picture/#disable-pip): when set, the pending requests fail and the video leaves Picture-in-Picture.

public bool DisablePictureInPicture { get; set; }

Gets or sets the value of the height content attribute.

public uint Height { get; set; }

OnEnterPictureInPicture

PictureInPicture.cs

Gets or sets the handler of the enterpictureinpicture event.

public Action<Event>? OnEnterPictureInPicture { get; set; }

OnLeavePictureInPicture

PictureInPicture.cs

Gets or sets the handler of the leavepictureinpicture event.

public Action<Event>? OnLeavePictureInPicture { get; set; }

Gets or sets a value indicating whether the element has the playsinline content attribute.

public bool PlaysInline { get; set; }

Gets or sets the poster content attribute, as a URL resolved against the base URL of the document.

public string Poster { get; set; }

VideoHeight

VideoElement.cs

Gets the natural height of the video in CSS pixels (https://html.spec.whatwg.org/multipage/media.html#dom-video-videoheight), or 0 when the dimensions are not known (the ready state is HAVE_NOTHING, or the resource has no video).

public uint VideoHeight { get; }

VideoWidth

VideoElement.cs

Gets the natural width of the video in CSS pixels (https://html.spec.whatwg.org/multipage/media.html#dom-video-videowidth), or 0 when the dimensions are not known (the ready state is HAVE_NOTHING, or the resource has no video).

public uint VideoWidth { get; }

Gets or sets the value of the width content attribute.

public uint Width { get; set; }

Methods

NameDescription
CancelVideoFrameCallback(uint)Cancels a callback registered by HtmlVideoElement.RequestVideoFrameCallback (an unknown handle is ignored).
GetVideoPlaybackQuality()Returns the playback quality metrics of the video (https://w3c.github.io/media-playback-quality/#dom-htmlvideoelement-getvideoplaybackquality): the numbers of frames reported by the player of the media backend (MediaPlayer.TotalVideoFrames, MediaPlayer.DroppedVideoFrames; 0 without player), at the current time.
RequestPictureInPicture()Shows the video in a floating window (https://w3c.github.io/picture-in-picture/#request-pip). The task completes with the window once enterpictureinpicture is fired at the element. It fails with a SecurityError DomException when the permissions policy of the document does not allow the picture-in-picture feature, an InvalidStateError when the video has no metadata or no video track, its HtmlVideoElement.DisablePictureInPicture attribute is set, or the user agent cannot open the window, and a NotAllowedError when no element of the document is in Picture-in-Picture and the window has no transient activation (which is consumed). The window is opened by UserAgentUIBackend.OpenPictureInPictureWindowAsync.
RequestVideoFrameCallback(VideoFrameRequestCallback)Registers a callback that runs when a new frame of the video is presented (https://wicg.github.io/video-rvfc/#dom-htmlvideoelement-requestvideoframecallback): in the next rendering update of the window after the frame, before the animation frame callbacks and with the same time. The callback runs once; a callback registered by a callback runs with the next frame.

CancelVideoFrameCallback(uint)

VideoElement.FrameCallbacks.cs

Cancels a callback registered by HtmlVideoElement.RequestVideoFrameCallback (an unknown handle is ignored).

public void CancelVideoFrameCallback(uint handle)

GetVideoPlaybackQuality()

VideoElement.cs

Returns the playback quality metrics of the video (https://w3c.github.io/media-playback-quality/#dom-htmlvideoelement-getvideoplaybackquality): the numbers of frames reported by the player of the media backend (MediaPlayer.TotalVideoFrames, MediaPlayer.DroppedVideoFrames; 0 without player), at the current time.

public VideoPlaybackQuality GetVideoPlaybackQuality()

RequestPictureInPicture()

PictureInPicture.cs

Shows the video in a floating window (https://w3c.github.io/picture-in-picture/#request-pip). The task completes with the window once enterpictureinpicture is fired at the element. It fails with a SecurityError DomException when the permissions policy of the document does not allow the picture-in-picture feature, an InvalidStateError when the video has no metadata or no video track, its HtmlVideoElement.DisablePictureInPicture attribute is set, or the user agent cannot open the window, and a NotAllowedError when no element of the document is in Picture-in-Picture and the window has no transient activation (which is consumed). The window is opened by UserAgentUIBackend.OpenPictureInPictureWindowAsync.

public Task<PictureInPictureWindow> RequestPictureInPicture()

RequestVideoFrameCallback(VideoFrameRequestCallback)

VideoElement.FrameCallbacks.cs

Registers a callback that runs when a new frame of the video is presented (https://wicg.github.io/video-rvfc/#dom-htmlvideoelement-requestvideoframecallback): in the next rendering update of the window after the frame, before the animation frame callbacks and with the same time. The callback runs once; a callback registered by a callback runs with the next frame.

public uint RequestVideoFrameCallback(VideoFrameRequestCallback callback)