<!doctype html>
|
<html lang="zh-cn" xmlns:th=http://www.thymeleaf.org>
|
<head>
|
<title></title>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
<meta http-equiv="Pragma" content="no-cache"/>
|
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate"/>
|
<meta http-equiv="Expires" content="0"/>
|
<style>
|
body {
|
display: unset;
|
margin: 0;
|
}
|
</style>
|
</head>
|
<body>
|
<div>
|
<div id="divPlugin"></div>
|
</div>
|
</body>
|
<script th:inline="javascript">
|
var ip = [[${data.ip}]];
|
var port = [[${data.port}]];
|
var loginId = [[${data.loginId}]];
|
var pwd = [[${data.pwd}]];
|
var chanNum = [[${data.chanNum}]];
|
var length = [[${length}]];
|
var width = [[${width}]];
|
</script>
|
<script th:src="@{../../static/js/jquery.min.js}"></script>
|
<script th:src="@{../../static/plugins/layui/layui.js}"></script>
|
<script th:src="@{../../static/plugins/hikweb4/webVideoCtrl.js}"></script>
|
<script th:inline="javascript">
|
|
var g_iWndIndex = 0; //可以不用设置这个变量,有窗口参数的接口中,不用传值,开发包会默认使用当前选择窗口
|
var layer;
|
$(function () {
|
layui.use(['layer'], function () {
|
layer = layui.layer;
|
});
|
|
// 检查插件是否已经安装过
|
if (-1 == WebVideoCtrl.I_CheckPluginInstall()) {
|
alert("您还未安装过插件,双击开发包目录里的WebComponents.exe安装!");
|
return;
|
}
|
|
// 初始化插件参数及插入插件
|
WebVideoCtrl.I_InitPlugin(length, width, {
|
iWndowType: 1,
|
cbSelWnd: function (xmlDoc) {
|
g_iWndIndex = $(xmlDoc).find("SelectWnd").eq(0).text();
|
}
|
});
|
WebVideoCtrl.I_InsertOBJECTPlugin("divPlugin");
|
|
|
// 检查插件是否最新
|
if (-1 == WebVideoCtrl.I_CheckPluginVersion()) {
|
alert("检测到新的插件版本,双击开发包目录里的WebComponents.exe升级!");
|
return;
|
}
|
clickLogin();
|
});
|
|
// 登录
|
function clickLogin() {
|
var szIP = ip,
|
szPort = port,
|
szUsername = loginId,
|
szPassword = pwd,
|
chanNum = chanNum;
|
if ("" == szIP || "" == szPort) {
|
return;
|
}
|
var iRet = WebVideoCtrl.I_Login(szIP, 1, szPort, szUsername, szPassword, {
|
success: function (xmlDoc) {
|
setTimeout(function () {
|
clickStartRealPlay(szIP, chanNum);
|
}, 10);
|
},
|
error: function () {
|
layer.msg("登录失败");
|
}
|
});
|
if (-1 == iRet) {
|
layer.msg("登录失败");
|
}
|
}
|
|
// 开始预览
|
function clickStartRealPlay(ip, chanNum) {
|
var oWndInfo = WebVideoCtrl.I_GetWindowStatus(g_iWndIndex),
|
szIP = ip,
|
iStreamType = parseInt("1", 10),
|
iChannelID = parseInt(chanNum, 10),
|
bZeroChannel = true,
|
szInfo = "";
|
|
if ("" == szIP) {
|
return;
|
}
|
if (oWndInfo != null) {// 已经在播放了,先停止
|
WebVideoCtrl.I_Stop();
|
}
|
var iRet = WebVideoCtrl.I_StartRealPlay(szIP, {
|
iStreamType: iStreamType,
|
iChannelID: iChannelID,
|
bZeroChannel: bZeroChannel
|
});
|
if (0 == iRet) {
|
szInfo = "开始预览成功!";
|
} else {
|
szInfo = "开始预览失败!";
|
}
|
layer.msg(szInfo);
|
}
|
</script>
|
</html>
|