PC/dist/static/player.html
2026-01-26 23:20:48 +08:00

166 lines
3.9 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="renderer" content="webkit">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">
<title>player</title>
<style type="text/css">
*{
padding: 0;
margin: 0;
}
body{
overflow: hidden;
width: 100vw;
height: 100vh;
}
canvas{
display: block;
width: 100%;
height: 100%;
}
.spinner {
position: absolute;
top: 50%;
left: 50%;
width: 50px;
height: 50px;
text-align: center;
font-size: 10px;
z-index: 999;
margin-left: -25px;
margin-top: -25px;
}
.spinner > div {
background-color: #67CF22;
height: 100%;
width: 3px;
display: inline-block;
-webkit-animation: stretchdelay 1.2s infinite ease-in-out;
animation: stretchdelay 1.2s infinite ease-in-out;
}
.spinner .rect2 {
-webkit-animation-delay: -1.1s;
animation-delay: -1.1s;
}
.spinner .rect3 {
-webkit-animation-delay: -1.0s;
animation-delay: -1.0s;
}
.spinner .rect4 {
-webkit-animation-delay: -0.9s;
animation-delay: -0.9s;
}
.spinner .rect5 {
-webkit-animation-delay: -0.8s;
animation-delay: -0.8s;
}
@-webkit-keyframes stretchdelay {
0%, 40%, 100% { -webkit-transform: scaleY(0.4) }
20% { -webkit-transform: scaleY(1.0) }
}
@keyframes stretchdelay {
0%, 40%, 100% {
transform: scaleY(0.4);
-webkit-transform: scaleY(0.4);
} 20% {
transform: scaleY(1.0);
-webkit-transform: scaleY(1.0);
}
}
</style>
</head>
<body oncontextmenu="return false;">
<canvas width="1280" height="760" id="video"></canvas>
<div class="spinner" id="loading">
<div class="rect1"></div>
<div class="rect2"></div>
<div class="rect3"></div>
<div class="rect4"></div>
<div class="rect5"></div>
</div>
</body>
<script type="text/javascript" src="NodePlayer-full.min.js"></script>
<script type="text/javascript">
var videoUrl='';
var isfirst=true;
window.onload=function(){
window.addEventListener("message",this.handleMessage);
window.parent.postMessage('start', '*');
runEvery10Sec();
}
NodePlayer.debug(false);
var player = new NodePlayer();
player.setView("video");
player.setBufferTime(3000); // 3秒缓冲减少卡顿
player.setVolume(0.0);
function handleMessage(event){
var data = event.data;
videoUrl = data.params.url;
console.log(data)
switch (data.cmd) {
case 'Hall':
player.start(data.params.url);
document.getElementById("video").style.visibility="visible";
break;
case 'Play':
player.start(data.params.url);
document.getElementById("video").style.visibility="visible";
break;
case 'Refresh':
player.stop();
document.getElementById("loading").style.display="block";
player.start(data.params.url);
break;
case 'Switch':
player.stop();
document.getElementById("loading").style.display="block";
player.start(data.params.url);
break;
case 'isOff':
autoStop=false;
player.stop();
document.getElementById("video").style.visibility="hidden";
break
}
}
// 自动重新执行
function runEvery10Sec(){
setTimeout(runEvery10Sec,60*1000*9);
if(isfirst!=true){
player.start(videoUrl);
console.log("自动重新播放"+videoUrl);
}
isfirst=false;
}
player.on("videoInfo", () => {
setTimeout(function(){
document.getElementById("loading").style.display="none";
},1000)
});
player.on("error", () => {
console.log("链接超时");
setTimeout(function(){
document.getElementById("loading").style.display="block";
},1000)
});
player.on("stop", () => {
console.log("已经暂停!");
});
</script>
</html>