W3cubDocs

/Web APIs

TrackEvent: TrackEvent() constructor

The TrackEvent() constructor creates and returns a new TrackEvent object describing an event which occurred on a list of tracks (AudioTrackList, VideoTrackList, or TextTrackList).

Syntax

js

new TrackEvent(type)
new TrackEvent(type, options)

Parameters

type

A string with the name of the event. It is case-sensitive and browsers set it to addtrack or removetrack.

options Optional

An object that, in addition of the properties defined in Event(), can have the following properties:

track Optional

The track to which the event refers; this is null by default, but should be set to a VideoTrack, AudioTrack, or TextTrack as appropriate given the type of track.

Return value

A new TrackEvent object, initialized as described by the inputs to the constructor.

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
TrackEvent 23 14 27 No 15 6 4.4 25 27 14 7 1.5

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/TrackEvent/TrackEvent