<!DOCTYPE html>
<html>
<body>
<button onclick="changeSource()" type="button">改变视频</button>
<br />
<br />
<video id="video1" controls="controls" autoplay="autoplay">
<source id="mp4_src" src="/example/html5/mov_bbb.mp4" type="video/mp4">
<source id="ogg_src" src="/example/html5/mov_bbb.ogg" type="video/ogg">
Your browser does not support HTML5 video.
</video>
<script>
myVid=document.getElementById("video1");
function changeSource()
{
isSupp=myVid.canPlayType("video/mp4");
if (isSupp=="")
{
myVid.src="movie.ogg";
}
else
{
myVid.src="movie.mp4";
}
myVid.load();
}
</script>
</body>
</html>