<html>
<body>
<video id="myVideo1" width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
您的浏览器不支持 video 标签。
</source></source></video>
<video id="myVideo2" width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
您的浏览器不支持 video 标签。
</source></source></video><br>
<button onclick="setMedGroup()" type="button">为两段视频设置媒体组合</button>
<button onclick="getMedGroup()" type="button">获取两段视频的媒体组合</button>
<script>
var x = document.getElementById("myVideo1");
var y = document.getElementById("myVideo2");
function setMedGroup()
{
x.mediaGroup = "test";
y.mediaGroup = "test";
}
function getMedGroup()
{
alert("视频 1 媒体组合: " + x.mediaGroup +
". 视频 2 媒体组合: " + y.mediaGroup);
}
</script>
</body>
</html>