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
trackEvent = new TrackEvent(type, eventInfo);
Parameters
type
- The type of track event which is described by the object:
"addtrack"
or"removetrack"
. eventInfo
Optional- An optional dictionary providing additional information configuring the new event; it can contain the following fields in any combination:
track
Optional- The track to which the event refers; this is
null
by default, but should be set to aVideoTrack
,AudioTrack
, orTextTrack
as appropriate given the type of track. bubbles
Optional- A Boolean indicating whether the event bubbles or not.
cancelable
Optional- A Boolean indicating whether or not the event can be canceled.
composed
Optional- A Boolean indicating whether or not the event will trigger listeners outside of a shadow root; see
Event.composed
for more details.
Return value
A newly-created TrackEvent
object, initialized as described by the inputs to the constructor.
Specifications
Specification | Status | Comment |
HTML Living StandardThe definition of 'TrackEvent()' in that specification. | Living Standard | Initial definition. |
HTML5The definition of 'TrackEvent()' in that specification. | Recommendation | Initial definition. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
No compatibility data found. Please contribute data for "api.TrackEvent.TrackEvent" (depth: 1) to the MDN compatibility data repository.
TrackEvent() by Mozilla Contributors is licensed under CC-BY-SA 2.5.