自制视频播放器

自制是视频播放器

现在HTML5新增了很多视频制作方面的属性,比如控制音量(volume)的,视频进度(duration)的还有全屏(webkitRequestFullScreen)的,等等,很多很多,这就使得当对默认的视频播放器样式 不满意时,自己也可以做一个替换默认样式。

  • 自制播放器样式效果如下:
    自制媒体播放器
    录的比较仓促,媒体文件就一个视频,可以自己选择
    引用的外部文件主要有一些字体文件,jquery包,还有一个兼容HTML5的包
    代码如下:
    head部分
<!-- 引入两个字体包 -->
	<link rel="stylesheet" href="font/mobilephone/iconfont.css">
	<link rel="stylesheet" href="css/font-awesome.css">
	<script src="lib/jquery/jquery-3.4.1.min.js"></script>
	<!-- IE低版本浏览器兼容HTML5 -->
	<!--if lte ie 8>
	    <script src="https://cdn.bootcss.com/html5shiv/r29/html5.js"></script>
	<![endif]-->
	<style>
	.wrap {
		position: relative;
		width: 800px;
		height: 500px;
		margin: 50px auto;
		border: 1px solid #000;
		background: url(images/loading.gif) no-repeat #000 center;
		background-size:  auto 100%;
		overflow: hidden;
	}
	video {
		height: 100%;
		margin: 0 auto;
		display: none;
	}
	.bar {
		position: absolute;
		left: 0px;
		bottom: 0px;
		width: 800px;
		height: 50px;
		background: rgba(0,0,0,0.5);
		display: none;
	}
	.play_btn {
		position: absolute;
		left: 15px;
		top: 20px;
		display: block;
		height: 30px;
		width: 30px;
		font-size: 30px;
		text-align: center;
		line-height: 20px;
		color: #fff;
		cursor: pointer;
	}
	.play_btn:hover {
		color: #0d0;
	}
	.strip {
		position: absolute;
		left: 0px;
		top: 0px;
		height: 3px;
		width: 800px;
		background: rgba(255,255,255,0.2);
		overflow: hidden;
		cursor: pointer;
	}
	.inner_strip {
		width: 0%;
		height: 100%;
		background: #0d0;
	}
	.play_time {
		position: absolute;
		left: 65px;
		height: 50px;
		font: 400 12px/60px "microsoft yahei";
		text-align: center;
		color: #fff;
	}
	.speed {
		position: absolute;
		left: 200px;
		top: 10px;
		height: 40px;
		font: 500 14px/40px "microsoft yehei";
		color: #fff;
		cursor: pointer;
	}
	.speed:hover {
		color: #0d0;
	
  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值