fuyang-jieshou/public/demo.html

72 lines
2.1 KiB
HTML

<!DOCTYPE HTML>
<html>
<body>
<video id="pre" width="100%" height="100%" controls="controls" autoplay="autoplay">
<source src="" type="video/mp4">
Your browser does not support the video tag.
</video>
<script type="text/javascript">
// import md5 from 'js-md5'
// APPKEY = "f8db0c75";
// SECRET = "41455e9d614643569a53bd338d095062";
// OPENAPI_IP_PORT_HTTP = "http://127.0.0.1:80";
// ITF_ADDRESS_GET_DEFAULT_USER_UUID = "/openapi/service/base/user/getDefaultUserUuid";
// ITF_ADDRESS_GET_CAMERAS = "/openapi/service/vss/res/getCameras";
var para = getParams(window.location.href);
console.log(para["CameraUuid"])
document.getElementById("pre").src="http://10.20.146.131:6713/mag/hls/"+para["CameraUuid"]+"/0/live.m3u8";
// var data1 = testGetDefaultUserUUID();
// var data2 = testGetCameras();
// function testGetDefaultUserUUID() {
// url = OPENAPI_IP_PORT_HTTP + ITF_ADDRESS_GET_DEFAULT_USER_UUID;
// data = { "appkey": APPKEY, "time": Date.now() };
// str = JSON.stringify(data);
// callurl = url + "?token=" + md5(url + str + SECRET);
// $.ajax({ /* url 地址可以是 /get-json/ 的方式 * 也可以是 http://www.qfedu.com/get-json/ 的方式 */
// url: callurl,
// type: 'POST',
// async: false,
// dataType: 'json',
// data: str,
// success: function (res) {
// // 成功处理逻辑
// console.log(res)
// }, error: function (res) {
// // 错误时处理逻辑
// console.log(res)
// }
// });
// }
// function testGetCameras() {
// url = OPENAPI_IP_PORT_HTTP + ITF_ADDRESS_GET_CAMERAS;
// data = { "appkey": APPKEY, "time": Date.now() ,"pageNo": 1,"pageSize":1000};
// }
function getParams(url) {
const regex = /[?&]([^=#]+)=([^&#]*)/g;
const params = {};
let match;
while (match = regex.exec(url)) {
params[decodeURIComponent(match[1])] = decodeURIComponent(match[2]);
}
return params;
}
</script>
</body>
</html>