1.支持三种视频格式:
2.使用方法
<!--引入单个源文件-->
<video src="movie.ogg" width="320" height="240" controls="controls">
Your browser does not support the video tag.
</video>
<!--引入多个源文件(浏览器将使用第一个可识别的格式)-->
<video width="320" height="240" controls="controls">
<source src="movie.ogg" type="video/ogg">
<source src="movie.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
3.元素属性
其中,preload属性的值可以为三种:
-auto 当页面加载后载入整个视频
-meta 当页面加载后只载入视频的元数据(我想应该是视频的基本信息)
-none 当页面加载后不载入视频
另外我可以自定义按钮,再结合元素的自带方法实现对视频窗口的控制。
比如下面这个w3c上的例子很好:
<!DOCTYPE html>
<html>
<body>
<div style="text-align:center;">
<button onclick="playPause()">播放/暂停</button>
<button onclick="makeBig()">大</button>
<button onclick="makeNormal()">中</button>
<button onclick="makeSmall()">小</button>
<br />
<video id="video1" width="420" style="margin-top:15px;">
<source src="/example/html5/mov_bbb.mp4" type="video/mp4" />
<source src="/example/html5/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.width=560;
}
function makeSmall()
{
myVideo.width=320;
}
function makeNormal()
{
myVideo.width=420;
}
</script>
</body>
</html>
先学这么多啦 :)