In JavaScript:
object.onvolumechange = function(){
myScript};
This example uses the HTML DOM to assign an "onvolumechange" event to a video element.
Try to change the volume in the bottom right corner.
<!DOCTYPE html> <html> <body> <video controls id="myVideo"> <source src="video.mp4" type="video/mp4"> <source src="video.ogg" type="video/ogg"> Your browser does not support HTML5 video. </video>// ww w . ja va 2 s. c o m <p id="demo"></p> <script> document.getElementById("myVideo").onvolumechange = function() {myFunction()}; function myFunction() { document.getElementById("demo").innerHTML = "The volume has been changed!"; } </script> </body> </html>