TextTrackList: addtrack event
The addtrack
event is fired when a track is added to a TextTrackList
.
Bubbles | No |
---|---|
Cancelable | No |
Interface | TrackEvent |
Event handler property | onaddtrack |
Examples
Using addEventListener()
:
const mediaElement = document.querySelector('video, audio'); mediaElement.textTracks.addEventListener('addtrack', (event) => { console.log(`Text track: ${event.track.label} added`); });
Using the onaddtrack
event handler property:
const mediaElement = document.querySelector('video, audio'); mediaElement.textTracks.onaddtrack = (event) => { console.log(`Text track: ${event.track.label} added`); };
Specifications
No specification found
No specification data found for api.TextTrackList.addTrack_event
.
Check for problems with this page or contribute a missing spec_url
to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.
Browser compatibility
No compatibility data found for api.TextTrackList.addTrack_event
.
Check for problems with this page or contribute missing data to mdn/browser-compat-data.
See also
- Related events:
removetrack
,change
- This event on
VideoTrackList
targets:addtrack
- This event on
AudioTrackList
targets:addtrack
- This event on
MediaStream
targets:addtrack
- Media Streams API
- WebRTC
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/TextTrackList/addtrack_event