ZhiYeJianKang_PeiXun/Song.Site/Utility/Qiniuyun/demo.html

80 lines
2.5 KiB
HTML
Raw Normal View History

2025-02-20 15:41:53 +08:00
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="format-detection" content="telephone=yes" />
<meta name="format-detection" content="email=no" />
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>直播测试</title>
<script src="qiniu-web-player-1.2.3.js"></script>
<style type="text/css">
*
{
margin: 0px;
padding: 0px;
}
html, body
{
width: 100%;
height: 100%;
}
#player
{
position: absolute;
z-index: 1;
top: 0px;
left: 0px;
}
#info
{
position: absolute;
z-index: 10;
top: 0px;
left: 0px;
color: #fff;
}
</style>
</head>
<body>
<div id="player" style="width: 100%; height: 100%;">
</div>
<div id="info" style="position: absolute; z-index: 100; top: 0px; left: 0px;">
播放时间:<span id="curtime">0</span>
</div>
<script>
var container = document.getElementById("player");
var player = new QPlayer({
url: "http://pili-live-hls.zhibo.weisha100.cn/ceshi5/2020yuandan.m3u8",
container: container,
isLive: true,
autoplay: true,
loggerLevel: 2
});
// 注册 ready 的监听函数,但是只会触发一次
player.once("ready", function () {
//隐藏全屏按钮
var fullbtn = document.getElementsByClassName("qplayer-fullscreen");
for (var i = 0; i < fullbtn.length; i++) {
fullbtn[i].style.display = "none";
}
//隐藏设置按钮(播放倍速也禁用了)
var setbtn = document.getElementsByClassName("qplayer-settings-btn");
for (var i = 0; i < setbtn.length; i++) {
setbtn[i].style.display = "none";
}
});
window.setInterval(function () {
var curtime = document.getElementById("curtime");
curtime.innerHTML = player.currentTime;
}, 10);
</script>
</body>
</html>