var layer;
|
var timer;
|
$(function () {
|
layui.use(['layer'], function () {
|
layer = layui.layer;
|
});
|
|
if(cameraData.playAddr){
|
//播放视频
|
$('#easyPlayer').attr('video-title',cameraData.name);
|
$('#easyPlayer').attr('video-url',cameraData.playAddr);
|
|
//定时器-保活直播
|
if (timer) clearInterval(timer);
|
timer = setInterval(function () {
|
keepAlive();
|
}, 15*1000);
|
}
|
});
|
|
|
//--------------------------视频管理------------------------//
|
/**
|
* 保活,msg参数为了防止浏览器缓存
|
*/
|
function keepAlive() {
|
var data = {
|
playType: cameraData.playType,
|
sn: cameraData.sn,
|
ip: cameraData.ipIn,
|
msg: Math.random()
|
};
|
$.ajax({
|
type: 'POST',
|
url: "../../basic/security/keep-alive",
|
dataType: 'JSON',
|
contentType: "application/json;charset=UTF-8",
|
data: JSON.stringify(data),
|
success: function (result) {
|
},
|
error: function (result) {
|
}
|
});
|
}
|
|
/**
|
* 播放还是暂停
|
*/
|
function playStop() {
|
var videL = $('#easyPlayer');
|
if (videL.paused) {
|
videL.play();
|
} else {
|
videL.pause();
|
}
|
}
|
/**
|
* 云台控制 -转向控制
|
* @param tag 执行命令 1=上,2=下,3=左,4=右,5=左上,6=左下,7=右上,8=右下,0=停止,9=变倍小,10 = 变倍加
|
*
|
*/
|
function mouseDownPTZControl(tag) {
|
|
if ("01" == cameraData.type) {
|
layer.msg("枪机摄像头不支持云台控制!");
|
return;
|
}
|
|
layer.msg("开始调用云平台……",
|
{time: 3000, shift: 5, offset: "rb"},
|
function () {
|
});
|
|
var data = {
|
playType: cameraData.playType,
|
sn: cameraData.sn,
|
ip: cameraData.ipIn,
|
command: tag
|
};
|
$.ajax({
|
type: 'POST',
|
url: "../../basic/security/ptz-media",
|
dataType: 'JSON',
|
contentType: "application/json;charset=UTF-8",
|
data: JSON.stringify(data),
|
success: function (result) {
|
if ("ERROR" == result.code) {
|
layer.alert(result.msg);
|
} else {
|
layer.msg("执行成功……",
|
{time: 3000, shift: 5, offset: "rb"},
|
function () {
|
});
|
}
|
},
|
error: function (result) {
|
layer.alert(result.msg);
|
}
|
});
|
}
|
|
/**
|
* 云台控制 -转向停止
|
* @param tag
|
*/
|
function mouseUpPTZControl() {
|
if ("01" == cameraData.type) {
|
return;
|
}
|
|
var data = {
|
playType: cameraData.playType,
|
sn: cameraData.sn,
|
ip: cameraData.ipIn,
|
command: "0"
|
};
|
$.ajax({
|
type: 'POST',
|
url: "../../basic/security/ptz-media",
|
dataType: 'JSON',
|
contentType: "application/json;charset=UTF-8",
|
data: JSON.stringify(data),
|
success: function (result) {
|
if ("ERROR" == result.code) {
|
layer.alert(result.msg);
|
}
|
},
|
error: function (result) {
|
layer.alert(result.msg);
|
}
|
});
|
}
|
|
/**
|
* 云台控制 -预置位置调用
|
*/
|
function clickGoPreset() {
|
layer.msg("开始调用云平台……",
|
{time: 3000, shift: 5, offset: "rb"},
|
function () {
|
});
|
|
var data = {
|
playType: cameraData.playType,
|
sn: cameraData.sn,
|
ip: cameraData.ipIn,
|
command: "2",
|
preset: 1
|
};
|
$.ajax({
|
type: 'POST',
|
url: "../../basic/security/video-preset",
|
dataType: 'JSON',
|
contentType: "application/json;charset=UTF-8",
|
data: JSON.stringify(data),
|
success: function (result) {
|
if ("ERROR" == result.code) {
|
layer.alert(result.msg);
|
} else {
|
layer.msg("执行成功……",
|
{time: 3000, shift: 5, offset: "rb"},
|
function () {
|
});
|
}
|
},
|
error: function (result) {
|
layer.alert(result.msg);
|
}
|
});
|
}
|
|
/**
|
* PTZZoomout 变倍 +
|
* @constructor
|
*/
|
function PTZZoomout() {
|
if ("01" == cameraData.type) {
|
layer.msg("枪机摄像头不支持云台控制!");
|
return;
|
}
|
|
layer.msg("开始调用云平台……",
|
{time: 3000, shift: 5, offset: "rb"},
|
function () {
|
});
|
|
var data = {
|
playType: cameraData.playType,
|
sn: cameraData.sn,
|
ip: cameraData.ipIn,
|
command: "10"
|
};
|
$.ajax({
|
type: 'POST',
|
url: "../../basic/security/ptz-media",
|
dataType: 'JSON',
|
contentType: "application/json;charset=UTF-8",
|
data: JSON.stringify(data),
|
success: function (result) {
|
if ("ERROR" == result.code) {
|
layer.alert(result.msg);
|
} else {
|
layer.msg("执行成功……",
|
{time: 3000, shift: 5, offset: "rb"},
|
function () {
|
});
|
}
|
},
|
error: function (result) {
|
layer.alert(result.msg);
|
}
|
});
|
}
|
|
/**
|
* PTZZoomout 变倍 -
|
* @constructor
|
*/
|
function PTZZoomIn() {
|
if ("01" == cameraData.type) {
|
layer.msg("枪机摄像头不支持云台控制!");
|
return;
|
}
|
|
layer.msg("开始调用云平台……",
|
{time: 3000, shift: 5, offset: "rb"},
|
function () {
|
});
|
|
var data = {
|
playType: cameraData.playType,
|
sn: cameraData.sn,
|
ip: cameraData.ipIn,
|
command: "9"
|
};
|
$.ajax({
|
type: 'POST',
|
url: "../../basic/security/ptz-media",
|
dataType: 'JSON',
|
contentType: "application/json;charset=UTF-8",
|
data: JSON.stringify(data),
|
success: function (result) {
|
if ("ERROR" == result.code) {
|
layer.alert(result.msg);
|
} else {
|
layer.msg("执行成功……",
|
{time: 3000, shift: 5, offset: "rb"},
|
function () {
|
});
|
}
|
},
|
error: function (result) {
|
layer.alert(result.msg);
|
}
|
});
|
}
|
|
/**
|
* PTZZoomout 变倍停止
|
* @constructor
|
*/
|
function PTZZoomStop() {
|
}
|