The volumechange
event is fired when the volume has changed.
Bubbles | No |
---|---|
Cancelable | No |
Interface | Event |
Target | Element |
Default Action | None |
Event handler property | GlobalEventHandlers.onvolumechange |
Specification | HTML5 media |
Examples
These examples add an event listener for the HTMLMediaElement's volumechange
event, then post a message when that event handler has reacted to the event firing.
Using addEventListener()
:
const video = document.querySelector('video'); video.addEventListener('volumechange', (event) => { console.log('The volume changed.'); });
Using the onvolumechange
event handler property:
const video = document.querySelector('video'); video.onvolumechange = (event) => { console.log('The volume changed.'); };
Specifications
Specification | Status |
---|---|
HTML Living Standard The definition of 'volumechange media event' in that specification. |
Living Standard |
HTML5 The definition of 'volumechange media event' in that specification. |
Recommendation |
Browser compatibility
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.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
volumechange event | Chrome Full support Yes | Edge Full support 12 | Firefox Full support Yes | IE Full support 9 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support Yes | Chrome Android Full support Yes | Firefox Android Full support Yes | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support Yes |
Legend
- Full support
- Full support
Related Events
HTMLMediaElement: playing event
HTMLMediaElement: waiting event
HTMLMediaElement: seeking event
HTMLMediaElement: seeked event
HTMLMediaElement: ended event
HTMLMediaElement: loadedmetadata event
HTMLMediaElement: loadeddata event
HTMLMediaElement: canplay event
HTMLMediaElement: canplaythrough event
HTMLMediaElement: durationchange event
HTMLMediaElement: timeupdate event
HTMLMediaElement: play event
HTMLMediaElement: pause event
HTMLMediaElement: ratechange event
HTMLMediaElement: volumechange event
HTMLMediaElement: suspend event
HTMLMediaElement: emptied event
HTMLMediaElement: stalled event