Pro/public/static/np/player.html
2026-02-25 01:50:31 +08:00

155 lines
3.6 KiB
HTML

<!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="./v0.5.9/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', '*');
}
NodePlayer.debug(false);
var player = new NodePlayer();
player.setView("video");
player.setBufferTime(0);
player.setVolume(0.0);
function handleMessage(event){
var data = event.data;
videoUrl = data.params.url;
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
}
}
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>