HTML5——播放器

有了H5的Video,妈妈再也不用担心我没安Flash插件了

根据Video提供的方法和属性,简单练习了一下,不说废话,直接上图片和代码

<html>
<head>
<title>一明播放器</title>
<style type="text/css">
*{
margin:0px;padding:0px;
}
#v1{
width:400px;
}
#divVideo{
width:400px;height:340px;border:1px solid black;margin:50px auto;
}
input[type="button"]{
width:70px;height:30px;
}
input:first-of-type{
background-color:blue;
}
input:nth-of-type(2){
background-color:red;
}
input:nth-of-type(3){
background-color:pink;
}
</style>
</head>
<body>
<div id="divVideo">
<video controls id="v1">
<source src="Intermission-Walk-in_512kb.mp4"/><br/>
</video>
<input type="button" value="暂停" id="btnPause"/>
<input type="button" value="开始" id="btnPlay"/>
<input type="button" value="重播" id="btnLoop"/>
<input type="button" value="静音" id="btnMuted"/>
</div>
</body>
</html>
<script type="text/javascript">
var btnPause=document.getElementById("btnPause");
var btnPlay=document.getElementById("btnPlay");
var btnLoop=document.getElementById("btnLoop");
var btnMuted=document.getElementById("btnMuted");
var v1=document.getElementById("v1");
v1.poster="1.jpg";
btnPause.onclick=function(){
v1.pause();
}
btnPlay.onclick=function(){
v1.play();
}
btnLoop.onclick=function(){
v1.load();
}
btnMuted.onclick=function(){
v1.muted=!v1.muted;
}
</script>

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值