W3cubDocs

/Web APIs

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.

js

addEventListener("removetrack", (event) => {});

onremovetrack = (event) => {};

Event type

Event properties

In addition to the properties listed below, properties from the parent interface, Event, are available.

track Read only

The TextTrack object to which the event refers.

Examples

Using addEventListener():

js

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:

js

const mediaElement = document.querySelector("video, audio");

mediaElement.textTracks.onremovetrack = (event) => {
  console.log(`Text track: ${event.track.label} removed`);
};

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
removeTrack_event 33 18 31 No 20≤12.1–15 7 4.4 33 31 20≤12.1–14 7 2.0

See also

© 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/TextTrackList/removeTrack_event