以下為 HTML5 Video範例
<!DOCTYPE html>
<html>
<body>
<div style="text-align:center">
<button onclick="playPause()">Play/Pause</button>
<button onclick="makeBig()">Big</button>
<button onclick="makeSmall()">Small</button>
<button onclick="makeNormal()">Normal</button>
<br />
<video id="video1">
<source src="mov_bbb.mp4" type="video/mp4" />
<source src="mov_bbb.ogg" type="video/ogg" />
Your browser does not support HTML5 video.
</video>
</div>
<script type="text/javascript">
var myVideo=document.getElementById("video1");
// 撥放/暫停
function playPause()
{
if (myVideo.paused)
myVideo.play();
else
myVideo.pause();
}
// 放大
function makeBig()
{
myVideo.height=(myVideo.videoHeight*2);
}
// 縮小
function makeSmall()
{
myVideo.height=(myVideo.videoHeight/2);
}
// 還原
function makeNormal()
{
myVideo.height=(myVideo.videoHeight);
}
</script>
</body>
</html>

全站熱搜