HTML5 自制本地网页视频播放器

时间:2023-03-09 08:06:47
HTML5 自制本地网页视频播放器
HTML5初试:本地视频用网页打开啦半个广告都可以没有,看来暴风什么的快要淘汰了。
视频格式还是有要求的,看来要备一个转码器。

格式

IE

Firefox

Opera

Chrome

Safari

Ogg

No

3.5+

10.5+

5.0+

No

MPEG 4

9.0+

No

No

5.0+

3.0+

WebM

No

4.0+

10.6+

6.0+

No

 <!DOCTYPE html>
<html>
<body> <div style="text-align:center;">
<button onclick="playPause()">播放/暂停</button>
<button onclick="makeNormal()">中</button>
<button onclick="makeSmall()">小</button>
<button onclick="makeBig()">大</button>
<br />
11 <video id="video1" width="1000" controls="controls style="margin-top:15px;" >
<source src="G:\录像片段\速度与激情7 720p mp4.mp4" type="video/mp4" />
<!-- <source src="G:\录像片段\名侦探柯南 业火的向日葵.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=1400;
} function makeSmall()
{
myVideo.width=600;
} function makeNormal()
{
myVideo.width=1000;
}
</script> </body>
</html>