CSS:
.player {
width: 720px;
height: 360px;
margin: 0 auto;
background: #000 url(../images/loading.gif) center/300px no-repeat;
position: relative;
}
video {
display: none;
height: 100%;
margin: 0 auto;
3.播放功能
让我们开始写javascript代码吧,首先我们先获取要用到的DOM元素:
var video = document.querySelector("video");
var isPlay = document.querySelector(".switch");
var expand = document.querySelector(".expand");
var progress = document.querySelector(".progress");
var loaded = document.querySelector(".progress > .loaded");
var currPlayTime = document.querySelector(".timer > .current");
var totalTime = document.querySelector(".timer > .total");