VideoTrackList.onremovetrack

The VideoTrackList onremovetrack event handler is called when the removetrack event occurs, indicating that a video track has been removed from the media element, and therefore also from the VideoTrackList.

The event is passed into the event handler in the form of a TrackEvent object, whose track property identifies the track that was removed from the media element's VideoTrackList.

Note: You can also add a handler for the removetrack event using addEventListener().

Syntax

VideoTrackList.onremovetrack = eventHandler;

Value

Set onremovetrack to a function that accepts as input a TrackEvent object which indicates in its track property which video track has been removed from the media element.

Example

This simple example just fetches the current number of video tracks in the media element whenever a track is removed from the media element.

document.querySelector("my-video").videoTracks.onremovetrack = function(event) {
  myTrackCount = document.querySelector("my-video").videoTracks.length;
};

The current number of video tracks remaining in the media element is obtained from VideoTrackList property length.

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'VideoTrackList: onremovetrack' in that specification.
Living Standard  

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic supportChrome Full support 45
Disabled
Full support 45
Disabled
Disabled From version 45: this feature is behind the enable-experimental-web-platform-features preference (needs to be set to enabled). To change preferences in Chrome, visit chrome://flags.
Edge Full support 12Firefox Full support 33
Disabled
Full support 33
Disabled
Disabled From version 33: this feature is behind the media.track.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE Full support 10Opera Full support 32
Disabled
Full support 32
Disabled
Disabled From version 32: this feature is behind the enable-experimental-web-platform-features preference (needs to be set to enabled).
Safari Full support 6.1WebView Android Full support 45Chrome Android Full support 45
Disabled
Full support 45
Disabled
Disabled From version 45: this feature is behind the enable-experimental-web-platform-features preference (needs to be set to enabled). To change preferences in Chrome, visit chrome://flags.
Edge Mobile Full support YesFirefox Android Full support 33
Disabled
Full support 33
Disabled
Disabled From version 33: this feature is behind the media.track.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
Opera Android Full support 32
Disabled
Full support 32
Disabled
Disabled From version 32: this feature is behind the enable-experimental-web-platform-features preference (needs to be set to enabled).
Safari iOS Full support 7.1Samsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown
User must explicitly enable this feature.
User must explicitly enable this feature.

Document Tags and Contributors

Contributors to this page: sideshowbarker
Last updated by: sideshowbarker,