Class VideoTrackList
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
The VideoTrackList interface is used to represent a list of the video tracks contained within a {{HTMLElement("video")}} element, with each track represented by a separate VideoTrack object in the list.
[Value("VideoTrackList")]
public class VideoTrackList : EventTarget
- Inheritance
-
VideoTrackList
- Inherited Members
Remarks
Retrieve an instance of this object with 'HTMLMediaElement.VideoTracks'. The individual tracks can be accessed using array syntax or functions such as {{jsxref("Array.forEach", "forEach()")}} for example.
Constructors
VideoTrackList()
public VideoTrackList()
Properties
Length
The read-only VideoTrackList
property length returns the number of entries in theVideoTrackList, each of which is a VideoTrack representing
one video track in the media element.
[Value("length")]
public ulong Length { get; }
Property Value
- ulong
A number indicating how many video tracks are included in the
VideoTrackList. Each track can be accessed by treating theVideoTrackListas an array of objects of type VideoTrack.
Remarks
A value of 0 indicates that there are no
video tracks in the media.
Onaddtrack
[Value("onaddtrack")]
public EventHandlerNonNull Onaddtrack { get; set; }
Property Value
Onchange
[Value("onchange")]
public EventHandlerNonNull Onchange { get; set; }
Property Value
Onremovetrack
[Value("onremovetrack")]
public EventHandlerNonNull Onremovetrack { get; set; }
Property Value
SelectedIndex
The read-only VideoTrackList
property selectedIndex returns the index of the
currently selected track, if any, or -1 otherwise.
[Value("selectedIndex")]
public long SelectedIndex { get; }
Property Value
- long
A number indicating the index of the currently selected track, if any, or
-1otherwise.
Remarks
Methods
GetTrackById(string)
The VideoTrackList methodgetTrackById() returns the first
VideoTrack object from the track list whose Id matches the specified string.
[Value("getTrackById")]
public VideoTrack? GetTrackById(string id)
Parameters
idstring
Returns
- VideoTrack
A VideoTrack object indicating the first track found within the
VideoTrackListwhoseidmatches the specified string. If no
match is found, this method returnsnull.The tracks are searched in their natural order; that is, in the order defined by the
media resource itself, or, if the resource doesn't define an order, the relative order
in which the tracks are declared by the media resource.
Remarks
This lets you find a specified track if
you know its ID string.