AudioTrackList: change event

The change event is fired when an audio track is enabled or disabled, for example by changing the track's enabled property.

Bubbles No
Cancelable No
Interface Event
Event handler property onchange

Examples

Using addEventListener():

const videoElement = document.querySelector('video');
videoElement.audioTracks.addEventListener('change', (event) => {
    console.log(`'${event.type}' event fired`);
});

// changing the value of `enabled` will trigger the `change` event
const toggleTrackButton = document.querySelector('.toggle-track');
toggleTrackButton.addEventListener('click', () => {
  const track = videoElement.audioTracks[0];
  track.enabled = !track.enabled;
});

Using the onchange event handler property:

const videoElement = document.querySelector('video');
videoElement.audioTracks.onchange = (event) => {
    console.log(`'${event.type}' event fired`);
};

// changing the value of `enabled` will trigger the `change` event
const toggleTrackButton = document.querySelector('.toggle-track');
toggleTrackButton.addEventListener('click', () => {
  const track = videoElement.audioTracks[0];
  track.enabled = !track.enabled;
});

Specifications

Specification Status
HTML Living Standard
The definition of 'change' in that specification.
Living Standard

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
change eventChrome Full support 37
Disabled
Full support 37
Disabled
Disabled From version 37: 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 79
Disabled
Full support 79
Disabled
Disabled From version 79: this feature is behind the enable-experimental-web-platform-features preference (needs to be set to enabled).
No support 12 — 79
Firefox 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 24
Disabled
Full support 24
Disabled
Disabled From version 24: this feature is behind the enable-experimental-web-platform-features preference (needs to be set to enabled).
Safari Full support 6.1WebView Android No support NoChrome Android Full support 37
Disabled
Full support 37
Disabled
Disabled From version 37: 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.
Firefox 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 24
Disabled
Full support 24
Disabled
Disabled From version 24: this feature is behind the enable-experimental-web-platform-features preference (needs to be set to enabled).
Safari iOS Full support 7Samsung Internet Android No support No

Legend

Full support  
Full support
No support  
No support
User must explicitly enable this feature.
User must explicitly enable this feature.

See also