1、简易播放器:
控制条的实现:
<style>
*{
margin: 0px;
padding: 0px;
}
.video_player{
position: relative;
width: 1000px;
height: 500px;
margin: 0px auto;
}
video{
position: absolute;
width: 1000px;
height: 500px;
left: 0px;
top: 0px;
}
.menu{
position: absolute;
width: 100%;
height: 50px;
background-color: rgba(0,0,0,0.5);
bottom: 0px;
display: none;
}
</style>
</head>
<body>
<div class="video_player">
<!--video与audio是一样的,只比audio多一个视频,方法都一样 -->
<video src="contenteditable.mov" controls></video><!-- 加controls才能有播放栏 -->
<div class="menu"></div>
</div>
<script>
var videoPlayer = document.getElementsByClassName("video_player")[0];
var menu = document.getElementsByClassName('menu')[0];
videoPlayer.onmouseenter = function() {
menu.style.display = "block";
}
videoPlayer.onmouseleave = function(){
menu.style.display = "none";
}
</script>
</body>