VideoTrackList: addtrack event
The addtrack
event is fired when a track is added to a VideoTrackList
.
Bubbles | No |
---|---|
Cancelable | No |
Interface | TrackEvent |
Event handler property | onaddtrack |
Examples
Using addEventListener()
:
const videoElement = document.querySelector('video'); videoElement.videoTracks.addEventListener('addtrack', (event) => { console.log(`Video track: ${event.track.label} added`); });
Using the onaddtrack
event handler property:
const videoElement = document.querySelector('video'); videoElement.videoTracks.onaddtrack = (event) => { console.log(`Video track: ${event.track.label} added`); };
Specifications
Specification |
---|
HTML Standard (HTML) # event-media-addtrack |
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 | |
addtrack_event |
37 |
79
12-79
|
33 |
10 |
24 |
7 |
No |
37 |
33 |
24 |
7 |
No |
See also
- Related events:
removetrack
,change
- 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/VideoTrackList/addtrack_event