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 StandardThe definition of 'volumechange media event' in that specification. | Living Standard |
| HTML5The 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.
Update compatibility data on GitHub
| 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 eventHTMLMediaElement: waiting eventHTMLMediaElement: seeking eventHTMLMediaElement: seeked eventHTMLMediaElement: ended eventHTMLMediaElement: loadedmetadata eventHTMLMediaElement: loadeddata eventHTMLMediaElement: canplay eventHTMLMediaElement: canplaythrough eventHTMLMediaElement: durationchange eventHTMLMediaElement: timeupdate eventHTMLMediaElement: play eventHTMLMediaElement: pause eventHTMLMediaElement: ratechange eventHTMLMediaElement: volumechange eventHTMLMediaElement: suspend eventHTMLMediaElement: emptied eventHTMLMediaElement: stalled event
See also
HTMLMediaElement: volumechange event by Mozilla Contributors is licensed under CC-BY-SA 2.5.