代码拉取完成,页面将自动刷新
<html>
<head>
<title>VOA Auto Player</title>
</head>
<body>
<div id="pl_north">
<video id="id_player" width="auto" height="90%" autoplay="autoplay" controls="controls" >
<p>Your browser doesn't support HTML5 video!</p>
<span style="white-space:pre"></span>
</video>
</div>
<div id="pl_south">
<button id="btn_prev"> prev</button>
<button id="btn_next"> next</button>
<button id="btn_loop"> No Loop</button>
</div>
</body>
<script language="javascript">
var listMedia = ['${LIST_OF_MEDIA}'];
var currentIndex = 0;
var isLoop = false;
var video = document.getElementById("id_player");
video.addEventListener('ended', function(){
if(isLoop){
play();
}else{
next();
}
});
document.getElementById("btn_prev").addEventListener('click', function(){
preview();
});
document.getElementById("btn_next").addEventListener('click', function(){
next();
});
document.getElementById("btn_loop").addEventListener('click', function(){
isLoop = !isLoop;
if(isLoop){
this.innerHTML = 'Looping';
}else{
this.innerHTML = 'No Loop';
}
});
function play() {
video.src = listMedia[currentIndex];
video.load();
video.play();
}
function preview(){
currentIndex--;
if(currentIndex < 0){
currentIndex = listMedia.length - 1;
}
play();
}
function next(){
currentIndex++;
if(currentIndex >= listMedia.length){
currentIndex = 0;
}
play();
}
// init
play();
</script>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。