1 Star 2 Fork 0

mead/voa feed

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
template.html 1.66 KB
一键复制 编辑 原始数据 按行查看 历史
mead 提交于 2020-04-06 21:09 . source
<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>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/kmboot/voa-feed.git
git@gitee.com:kmboot/voa-feed.git
kmboot
voa-feed
voa feed
master

搜索帮助