VttCue Class

A WebVTT cue (https://w3c.github.io/webvtt/#the-vttcue-interface): the cue of a WebVTT file, or a cue created to be added to a text track with TextTrack.AddCue.

public sealed class VttCue : TextTrackCue
Inheritance
TextTrackCue VttCue

Constructors

NameDescription
VttCue(double, double, string)Creates a cue (https://w3c.github.io/webvtt/#dom-vttcue-vttcue).

VttCue(double, double, string)

VttCue.cs

Creates a cue (https://w3c.github.io/webvtt/#dom-vttcue-vttcue).

public VttCue(double startTime, double endTime, string text)

Parameters

startTime double
The start time of the cue, in seconds.
endTime double
The end time of the cue, in seconds (positive infinity for an unbounded cue).
text string
The cue text.

Exceptions

ArgumentException
endTime is negative infinity or NaN.

See also

Properties

NameDescription
AlignGets or sets the alignment of the text of the cue (https://w3c.github.io/webvtt/#dom-vttcue-align).
LineGets or sets the line of the cue (https://w3c.github.io/webvtt/#dom-vttcue-line): a number, or auto.
LineAlignGets or sets the alignment of the line of the cue (https://w3c.github.io/webvtt/#dom-vttcue-linealign).
PositionGets or sets the position of the cue (https://w3c.github.io/webvtt/#dom-vttcue-position): a percentage, or auto.
PositionAlignGets or sets the alignment of the position of the cue (https://w3c.github.io/webvtt/#dom-vttcue-positionalign).
RegionGets or sets the region of the cue (https://w3c.github.io/webvtt/#dom-vttcue-region), or null.
SizeGets or sets the size of the cue box, a percentage of the video (https://w3c.github.io/webvtt/#dom-vttcue-size).
SnapToLinesGets or sets a value indicating whether the line of the cue is a number of lines, rather than a percentage of the dimensions of the video (https://w3c.github.io/webvtt/#dom-vttcue-snaptolines).
TextGets or sets the cue text, in raw unparsed form (https://w3c.github.io/webvtt/#dom-vttcue-text).
VerticalGets or sets the writing direction of the cue (https://w3c.github.io/webvtt/#dom-vttcue-vertical).

Gets or sets the alignment of the text of the cue (https://w3c.github.io/webvtt/#dom-vttcue-align).

public AlignSetting Align { get; set; }

Gets or sets the line of the cue (https://w3c.github.io/webvtt/#dom-vttcue-line): a number, or auto.

public LineAndPositionSetting Line { get; set; }

LineAlign

VttCue.cs

Gets or sets the alignment of the line of the cue (https://w3c.github.io/webvtt/#dom-vttcue-linealign).

public LineAlignSetting LineAlign { get; set; }

Position

VttCue.cs

Gets or sets the position of the cue (https://w3c.github.io/webvtt/#dom-vttcue-position): a percentage, or auto.

public LineAndPositionSetting Position { get; set; }

Property value

LineAndPositionSetting

Exceptions

DomException
An IndexSizeError when the value is negative or greater than 100.

See also

PositionAlign

VttCue.cs

Gets or sets the alignment of the position of the cue (https://w3c.github.io/webvtt/#dom-vttcue-positionalign).

public PositionAlignSetting PositionAlign { get; set; }

Region

VttCue.cs

Gets or sets the region of the cue (https://w3c.github.io/webvtt/#dom-vttcue-region), or null.

public VttRegion? Region { get; set; }

Gets or sets the size of the cue box, a percentage of the video (https://w3c.github.io/webvtt/#dom-vttcue-size).

public double Size { get; set; }

Property value

double

Exceptions

DomException
An IndexSizeError when the value is negative or greater than 100.

See also

SnapToLines

VttCue.cs

Gets or sets a value indicating whether the line of the cue is a number of lines, rather than a percentage of the dimensions of the video (https://w3c.github.io/webvtt/#dom-vttcue-snaptolines).

public bool SnapToLines { get; set; }

Gets or sets the cue text, in raw unparsed form (https://w3c.github.io/webvtt/#dom-vttcue-text).

public string Text { get; set; }

Vertical

VttCue.cs

Gets or sets the writing direction of the cue (https://w3c.github.io/webvtt/#dom-vttcue-vertical).

public DirectionSetting Vertical { get; set; }

Methods

NameDescription
GetCueAsHtml()Returns the cue text as a document fragment of HTML elements and other nodes (https://w3c.github.io/webvtt/#dom-vttcue-getcueashtml): the WebVTT cue text parsing rules, then the WebVTT cue text DOM construction rules. The nodes belong to the document of the current global object.
GetCueAsHtml(Document)Returns the cue text as a document fragment of HTML elements and other nodes that belong to a document.

GetCueAsHtml overloads

GetCueAsHtml()

VttCue.cs

Returns the cue text as a document fragment of HTML elements and other nodes (https://w3c.github.io/webvtt/#dom-vttcue-getcueashtml): the WebVTT cue text parsing rules, then the WebVTT cue text DOM construction rules. The nodes belong to the document of the current global object.

public DocumentFragment GetCueAsHtml()

GetCueAsHtml(Document)

VttCue.cs

Returns the cue text as a document fragment of HTML elements and other nodes that belong to a document.

public DocumentFragment GetCueAsHtml(Document document)
Parameters
document Document
The node document of the nodes.
Returns

DocumentFragment