MediaStream: removetrack event
The removetrack
event is fired when a new MediaStreamTrack
object has been removed from a MediaStream
.
This event is not cancelable and does not bubble.
Syntax
Use the event name in methods like addEventListener()
, or set an event handler property.
js
addEventListener("removetrack", (event) => {});
onremovetrack = (event) => {};
Event type
A MediaStreamTrackEvent
. Inherits from Event
.
Event properties
Also inherits properties from its parent interface, Event
.
MediaStreamTrackEvent.track
Read only-
A
MediaStreamTrack
object representing the track which was removed from the stream.
Examples
Using addEventListener()
:
js
const stream = new MediaStream();
stream.addEventListener("removetrack", (event) => {
console.log(`${event.track.kind} track removed`);
});
Using the onremovetrack
event handler property:
js
const stream = new MediaStream();
stream.onremovetrack = (event) => {
console.log(`${event.track.kind} track removed`);
};
Specifications
Specification |
---|
Media Capture and Streams # event-mediastream-removetrack |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
removetrack event |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- Partial support
- Partial support
- Has more compatibility info.
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.
See also
- Related events:
addtrack
- This event on
AudioTrackList
targets:removetrack
- This event on
VideoTrackList
targets:removetrack
- Media Capture and Streams API
- WebRTC