build/live-play.html

91 lines
3.4 KiB
HTML
Raw Permalink 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 lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no">
<meta content="telephone=no" name="format-detection">
<title>头歌考试系统</title>
<style>
* {
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Helvetica Neue, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
}
.reload {
position: absolute;
z-index: 6;
width: 40px;
left: 10px;
top: 12px;
height: 20px;
line-height: 20px;
font-size: 12px;
border-radius: 11px;
background: #0152d9;
text-align: center;
color: #ffffff;
cursor: pointer;
}
</style>
</head>
<body>
<span onclick="window.location.reload()" class="reload">刷新</span>
<div id="id_test_video" style="height: 340px;width: 216px;overflow: hidden;">
</div>
<script>
let liveUrl;
let API_SERVER = "";
if (document.domain === "www.educoder.net" || document.domain === "kepukehuan.educoder.net") {
API_SERVER = "data"
} else {
API_SERVER = document.domain.split(".")[0] + "-data"
}
var Cookie = {
get: function (k) {
return ((new RegExp(["(?:; )?", k, "=([^;]*);?"].join(""))).test(document.cookie) && RegExp["$1"]) || "";
},
set: function (k, v, e, d) {
var date = new Date();
var expiresDays = e;
date.setTime(date.getTime() + expiresDays * 24 * 3600 * 1000);
document.cookie = k + "=" + v + "; expires=" + (e != '' ? date.toGMTString() : "GMT_String") + ";path=/;domain=" + (d || document.domain);
},
del: function (k, d) {
document.cookie = k + "=; expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/;domain=" + (d || _options.domain);
document.cookie = k + "=v; expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/";
}
};
var pattern = /(\w+)=([^\#&]*)/ig;
var parames = {};
location.href.replace(pattern, function (attr, key, value) {
parames[key] = decodeURI(value);
});
</script>
<script src="https://web.sdk.qcloud.com/player/tcplayerlite/release/v2.4.1/TcPlayer-2.4.1.js"
charset="utf-8"></script>
<script type="text/javascript">
if(parames.key % 2 === 0)
parames.video_url = parames.video_url.replace("https://live-stream.educoder.net","https://live-stream2.educoder.net")
var player = new TcPlayer('id_test_video', {
"m3u8": parames.video_url,//请替换成实际可用的播放地址
"flv": parames.video_url,//请替换成实际可用的播放地址
"autoplay": true, //iOS 下 safari 浏览器是不开放这个能力的
// "poster": "http://www.test.com/myimage.jpg",
"live":true,
"wording": {
2032: "请求视频失败,请检查网络",
2048: "请求m3u8文件失败可能是网络错误或者跨域问题"
}
});
player.mute(true);
window.player = player;
</script>
</body>
</html>