The removetrack
event is fired when a video track is removed from a VideoTrackList
.
The removetrack
event is fired when a video track is removed from a VideoTrackList
.
Use the event name in methods like addEventListener()
, or set an event handler property.
js
addEventListener("removetrack", (event) => {}); onremovetrack = (event) => {};
A TrackEvent
. Inherits from Event
.
In addition to the properties listed below, properties from the parent interface, Event
, are available.
track
Read only
The newly-removed VideoTrack
the event is in reference to.
Using addEventListener()
:
js
const videoElement = document.querySelector("video"); videoElement.videoTracks.addEventListener("removetrack", (event) => { console.log(`Video track: ${event.track.label} removed`); });
Using the onremovetrack
event handler property:
js
const videoElement = document.querySelector("video"); videoElement.videoTracks.onremovetrack = (event) => { console.log(`Video track: ${event.track.label} removed`); };
Specification |
---|
HTML Standard # event-media-removetrack |
HTML Standard # handler-tracklist-onremovetrack |
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 |
37 | 7912–79 | 33 | 10 | 24 | 7 | No | 37 | No | No | 7 | No |
addtrack
, change
AudioTrackList
targets: removetrack
MediaStream
targets: removetrack
© 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/VideoTrackList/removetrack_event