<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟学堂</title>
</head>
<body>
<p>尝试改变视频的音量。</p>
<video id="myVideo" width="320" height="176" controls>
<source src="mov_bbb.mp4" type="video/mp4">
<source src="mov_bbb.ogg" type="video/ogg">
您的浏览器不支持 HTML5 video 标签。
</video>
<script>
var vid = document.getElementById("myVideo");
vid.addEventListener("volumechange", function()
{
alert("音量已改变");
});
</script>
</body>
</html>