TextTrackList: removeTrack event
The removetrack
event is fired when a track is removed from a TextTrackList
.
Syntax
Use the event name in methods like addEventListener()
, or set an event handler property.
addEventListener('removetrack', event => { })
onremovetrack = event => { }
Event type
An TrackEvent
. Inherits from Event
.
Event properties
In addition to the properties listed below, properties from the parent interface, Event
, are available.
Examples
Using addEventListener()
:
const mediaElement = document.querySelector('video, audio');
mediaElement.textTracks.addEventListener('removetrack', event => {
console.log(`Text track: ${event.track.label} removed`);
});
Using the onremovetrack
event handler property:
const mediaElement = document.querySelector('video, audio');
mediaElement.textTracks.onremovetrack = event => {
console.log(`Text track: ${event.track.label} removed`);
};
Specifications
Specification |
---|
HTML Standard # event-media-removetrack |
HTML Standard # handler-tracklist-onremovetrack |
Browser compatibility
BCD tables only load in the browser
See also
- Related events:
addtrack
,change
- This event on
VideoTrackList
targets:removetrack
- This event on
AudioTrackList
targets:removetrack
- This event on
MediaStream
targets:removetrack
- Media Streams API
- WebRTC