572 lines
16 KiB
JavaScript
572 lines
16 KiB
JavaScript
|
|
var token = null;
|
|||
|
|
var token1 = null;
|
|||
|
|
var storageId = "";
|
|||
|
|
var startTime ="";
|
|||
|
|
var endTime = "";
|
|||
|
|
var storageType = 0;//初始值,1为表示可录像,点击后变为2,表示可下载
|
|||
|
|
var storageVideoScreen=0;
|
|||
|
|
$(function(){
|
|||
|
|
connect2();
|
|||
|
|
connect();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
function getPhoto(){
|
|||
|
|
// console.log("getPhoto selectedScreen="+selectedScreen);
|
|||
|
|
var canvas = document.getElementById("huaImg");
|
|||
|
|
var video = document.getElementById(selectedScreen);
|
|||
|
|
let ctx = canvas.getContext('2d');
|
|||
|
|
canvas.width = 1080;
|
|||
|
|
canvas.height = 720;
|
|||
|
|
ctx.drawImage(video, 0, 0, 1080, 720); // 将video中的数据绘制到canvas里
|
|||
|
|
saveImage(canvas, new Date().getTime() + '.png'); // 存储图片到本地
|
|||
|
|
}
|
|||
|
|
function saveImage(canvas, filename) {
|
|||
|
|
let image = canvas.toDataURL('image/png').replace('image/png', 'image/octet-stream');
|
|||
|
|
saveAs(image, filename || new Date().getTime() + '.png');
|
|||
|
|
}
|
|||
|
|
function storageVideo(){
|
|||
|
|
console.log("storageType=="+storageType);
|
|||
|
|
if(storageVideoScreen == 0){
|
|||
|
|
storageVideoScreen = selectedScreen;
|
|||
|
|
}else{
|
|||
|
|
console.log("storageVideoScreen=="+storageVideoScreen);
|
|||
|
|
console.log("selectedScreen=="+selectedScreen);
|
|||
|
|
if(storageVideoScreen != selectedScreen){
|
|||
|
|
layer.alert("开始录制和结束录制请确保是同一个视频!!!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
var num = parseInt(storageType%2);
|
|||
|
|
if(num ==0){
|
|||
|
|
$("#videotape").css("background-image","url('../../img/video/videoRecord.png')");
|
|||
|
|
startstorage();
|
|||
|
|
}else{
|
|||
|
|
$("#videotape").css("background-image","url('../../img/video/videoRecord.png')");
|
|||
|
|
stopmanual(storageId);
|
|||
|
|
storageVideoScreen =0;
|
|||
|
|
}
|
|||
|
|
storageType++;
|
|||
|
|
console.log("num=="+num);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function stopmanual(id) {
|
|||
|
|
layer.msg('结束录像,正在准备下载,请稍后。。。');
|
|||
|
|
let pId = null;
|
|||
|
|
let idex = 0;
|
|||
|
|
var pathType = 0;
|
|||
|
|
var useToken = '';
|
|||
|
|
$.each(playBallList, function (index, item) {
|
|||
|
|
if (!isEmpty(item)) {
|
|||
|
|
if (selectedScreen === item.selectedScreen) {
|
|||
|
|
if (item.start && item.myPlayer !== null) {
|
|||
|
|
pId = item.puid;
|
|||
|
|
pathType = item.pathType;
|
|||
|
|
useToken = item.token;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
endTime = Date.parse(new Date())/1000+10;
|
|||
|
|
console.log("endTime="+endTime);
|
|||
|
|
console.log("storageId="+id);
|
|||
|
|
setTimeout(function () {
|
|||
|
|
requestPost('CSS/C_CSS_StopManualStorage?token=' + useToken, {
|
|||
|
|
id: id
|
|||
|
|
}, rv => {
|
|||
|
|
console.log("getQxVideoList1==============")
|
|||
|
|
setTimeout(function () {
|
|||
|
|
getQxVideoList();
|
|||
|
|
},1000)
|
|||
|
|
},pathType);
|
|||
|
|
},1000)
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function getQxVideoList(){
|
|||
|
|
let pId = null;
|
|||
|
|
let idex = 0;
|
|||
|
|
let useToken = '';
|
|||
|
|
let pathType = 0;
|
|||
|
|
$.each(playBallList, function (index, item) {
|
|||
|
|
if (!isEmpty(item)) {
|
|||
|
|
if (selectedScreen === item.selectedScreen) {
|
|||
|
|
if (item.start && item.myPlayer !== null) {
|
|||
|
|
pId = item.puid;
|
|||
|
|
useToken = item.token;
|
|||
|
|
pathType = item.pathType;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
var startTime = getTodayStartTime()+"";
|
|||
|
|
var endTime = getTodayEndTime()+"";
|
|||
|
|
requestGetWithParam('CSS/C_CSS_QueryStorageFiles?token=' + useToken, {
|
|||
|
|
idx: idex,
|
|||
|
|
puid:pId,
|
|||
|
|
begin:startTime,
|
|||
|
|
end:endTime,
|
|||
|
|
offset:'0',
|
|||
|
|
count:'200'
|
|||
|
|
}, rv => {
|
|||
|
|
var resultJson = JSON.parse(rv.responseText);
|
|||
|
|
if(resultJson == "{}" || rv.responseText == "{}"){
|
|||
|
|
layer.alert("暂无云视频!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
var files = resultJson.File;
|
|||
|
|
var filesLength = files.length;
|
|||
|
|
var sTime = '';
|
|||
|
|
var eTime = '';
|
|||
|
|
console.log("files="+JSON.stringify(files));
|
|||
|
|
var isArray = Array.isArray(files)
|
|||
|
|
if(isArray){
|
|||
|
|
for(var i=0;i<files.length;i++){
|
|||
|
|
if(i==(files.length-1)){
|
|||
|
|
var fi = files[i];
|
|||
|
|
sTime = fi.Begin;
|
|||
|
|
eTime = fi.End;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
console.log("sTime111="+sTime);
|
|||
|
|
console.log("eTime111="+eTime);
|
|||
|
|
}else{
|
|||
|
|
sTime = files.Begin;
|
|||
|
|
eTime = files.End;
|
|||
|
|
console.log("sTime222="+sTime);
|
|||
|
|
console.log("eTime222="+eTime);
|
|||
|
|
}
|
|||
|
|
mp4Transcode(pId,sTime,eTime,pathType,useToken);
|
|||
|
|
console.log("files="+files);
|
|||
|
|
},pathType);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function mp4Transcode(pId,sTime,eTime,pathType,useToken){
|
|||
|
|
console.log("mp4Transcod================");
|
|||
|
|
requestPost('CSS/transcode?token=' + useToken, {
|
|||
|
|
idx: 0,
|
|||
|
|
puid:pId,
|
|||
|
|
beginUTCSecond:sTime,
|
|||
|
|
endUTCSecond:eTime,
|
|||
|
|
retentionMinutes:5
|
|||
|
|
}, rv => {
|
|||
|
|
var resultJson = JSON.parse(rv.responseText);
|
|||
|
|
var transcodeId = resultJson.transcodeId;
|
|||
|
|
console.log("------------------------------------------------------------")
|
|||
|
|
var timer1=setTimeout(function(){
|
|||
|
|
mp4TranscodeProgress(transcodeId,pathType,useToken);
|
|||
|
|
},5000);
|
|||
|
|
},pathType);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function mp4TranscodeProgress(transcodeId,pathType,useToken){
|
|||
|
|
console.log("mp4TranscodeProgress================");
|
|||
|
|
requestGetWithParam('CSS/transcodeProgress?token=' + useToken, {
|
|||
|
|
transcodeId: transcodeId
|
|||
|
|
}, rv => {
|
|||
|
|
var resultJson = JSON.parse(rv.responseText);
|
|||
|
|
var ErrorCode = resultJson.ErrorCode;
|
|||
|
|
var msg = resultJson.msg;
|
|||
|
|
var reMsg = "transcode "+transcodeId+" done";
|
|||
|
|
console.log("mp4TranscodeProgress resultJson================"+JSON.stringify(resultJson));
|
|||
|
|
console.log("mp4TranscodeProgress resultJson================"+resultJson);
|
|||
|
|
console.log("mp4TranscodeProgress transcodeId================"+ErrorCode);
|
|||
|
|
console.log("mp4TranscodeProgress msg================"+msg);
|
|||
|
|
console.log("mp4TranscodeProgress reMsg================"+reMsg);
|
|||
|
|
if(msg==reMsg && ErrorCode==0){
|
|||
|
|
// clearInterval(timer1);
|
|||
|
|
if (pathType === 2){
|
|||
|
|
location.href="http://192.168.0.100:1854/icvs/CSS/downloadTranscodeFile?token="+useToken+"&transcodeId="+transcodeId
|
|||
|
|
}else {
|
|||
|
|
location.href="http://192.168.0.100:9585/icvs/CSS/downloadTranscodeFile?token="+useToken+"&transcodeId="+transcodeId
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},pathType);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function getTodayStartTime(){
|
|||
|
|
var startTime = toDayExchange()+" 00:00:00";
|
|||
|
|
var date = new Date(startTime);
|
|||
|
|
var longDateStar = Date.parse(date)/1000;
|
|||
|
|
console.log("getTodayStartTime="+longDateStar);
|
|||
|
|
return longDateStar;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function getTodayEndTime(){
|
|||
|
|
var endTime = toDayExchange()+" 23:59:59";
|
|||
|
|
var date = new Date(endTime);
|
|||
|
|
var longDateEnd = Date.parse(date)/1000;
|
|||
|
|
console.log("getTodayEndTime="+longDateEnd);
|
|||
|
|
return longDateEnd;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
function toDayExchange() {
|
|||
|
|
var date = new Date()
|
|||
|
|
var Y = date.getFullYear() + '-'
|
|||
|
|
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
|
|||
|
|
var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' '
|
|||
|
|
// var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'
|
|||
|
|
// var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':'
|
|||
|
|
// var s = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds())
|
|||
|
|
return Y + M + D
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//开始云录像
|
|||
|
|
function startstorage() {
|
|||
|
|
layer.msg('开始录像。');
|
|||
|
|
startTime = Date.parse(new Date())/1000-10;
|
|||
|
|
let pId = null;
|
|||
|
|
let idex = 0;
|
|||
|
|
let useToken = '';
|
|||
|
|
let pathType = 0;
|
|||
|
|
$.each(playBallList, function (index, item) {
|
|||
|
|
if (!isEmpty(item)) {
|
|||
|
|
if (selectedScreen === item.selectedScreen) {
|
|||
|
|
if (item.start && item.myPlayer !== null) {
|
|||
|
|
pId = item.puid;
|
|||
|
|
useToken = item.token;
|
|||
|
|
pathType = item.pathType;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
console.log("清晰录像++++");
|
|||
|
|
console.log("useToken++++"+useToken);
|
|||
|
|
console.log("pathType++++"+pathType);
|
|||
|
|
requestPost('CSS/C_CSS_StartManualStorage?token=' + useToken, {
|
|||
|
|
puid: pId,
|
|||
|
|
idx: idex,
|
|||
|
|
duration: 5,
|
|||
|
|
reserveDay: 30,
|
|||
|
|
fileLength: 15,
|
|||
|
|
type: 0
|
|||
|
|
}, rv => {
|
|||
|
|
var respJSON = JSON.parse(rv.responseText);
|
|||
|
|
console.log("respJSON====="+respJSON);
|
|||
|
|
console.log("respJSON(((====="+JSON.stringify(respJSON));
|
|||
|
|
storageId = respJSON.Param.ID;
|
|||
|
|
},pathType);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
//获取设备列表
|
|||
|
|
function fetchDevice(offset, count) {
|
|||
|
|
var self = this;
|
|||
|
|
|
|||
|
|
//获取设备列表的接口
|
|||
|
|
var router = 'CAS/C_CAS_QueryPUIDSets?offset=' + offset + '&count=' + count + '&token=' + token;
|
|||
|
|
requestGet(router, rv => {
|
|||
|
|
var respJSON = rv.responseJSON;
|
|||
|
|
if (respJSON.constructor != Array) {
|
|||
|
|
respJSON = [respJSON];
|
|||
|
|
}
|
|||
|
|
device_list = respJSON;
|
|||
|
|
|
|||
|
|
//把设备加载到指定的位置
|
|||
|
|
//console.log("device_list="+JSON.stringify(device_list));
|
|||
|
|
addDevice(device_list);
|
|||
|
|
if (device_list.length == count) {
|
|||
|
|
offset += count;
|
|||
|
|
fetchDevice(offset, count);
|
|||
|
|
} else {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function addDevice(device_list){
|
|||
|
|
$.each(device_list, function (index, item) {
|
|||
|
|
let puId = item.$;
|
|||
|
|
let online = item.OnlineFlag;
|
|||
|
|
if(online == '1'){
|
|||
|
|
onLineBallList.push({
|
|||
|
|
puid: puId,
|
|||
|
|
online: online
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
// console.log("onLineBallList="+JSON.stringify(onLineBallList));
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//创建平台连接
|
|||
|
|
function connect() {
|
|||
|
|
var self = this;
|
|||
|
|
var params = {
|
|||
|
|
"address": _cf.connParams.address,
|
|||
|
|
"port": _cf.connParams.port,
|
|||
|
|
"user": _cf.connParams.user,
|
|||
|
|
"password": _cf.connParams.password,
|
|||
|
|
"epid": _cf.connParams.epid,
|
|||
|
|
"fixaddr": _cf.connParams.bfix
|
|||
|
|
}
|
|||
|
|
requestPost('login', params, function (rv) {
|
|||
|
|
let self = this;
|
|||
|
|
var result = {
|
|||
|
|
errcode: -1,
|
|||
|
|
token: ''
|
|||
|
|
}
|
|||
|
|
var respJSON = JSON.parse(rv.responseText);
|
|||
|
|
if (respJSON.hasOwnProperty('errcode')) {
|
|||
|
|
result.errcode = respJSON.errcode;
|
|||
|
|
}
|
|||
|
|
if (respJSON.hasOwnProperty('token')) {
|
|||
|
|
result.token = respJSON.token;
|
|||
|
|
result.errcode = 0;
|
|||
|
|
token = result.token;
|
|||
|
|
console.log("token="+token)
|
|||
|
|
localStorage.setItem("token2",token);
|
|||
|
|
// fetchDevice(0,100);
|
|||
|
|
}
|
|||
|
|
},1)
|
|||
|
|
}
|
|||
|
|
function connect2() {
|
|||
|
|
var self = this;
|
|||
|
|
var params = {
|
|||
|
|
"address": _cf_1.connParams.address,
|
|||
|
|
"port": _cf_1.connParams.port,
|
|||
|
|
"user": _cf_1.connParams.user,
|
|||
|
|
"password": _cf_1.connParams.password,
|
|||
|
|
"epid": _cf_1.connParams.epid,
|
|||
|
|
"fixaddr": _cf_1.connParams.bfix
|
|||
|
|
}
|
|||
|
|
requestPost('login', params, function (rv) {
|
|||
|
|
let self = this;
|
|||
|
|
var result = {
|
|||
|
|
errcode: -1,
|
|||
|
|
token: ''
|
|||
|
|
}
|
|||
|
|
var respJSON = JSON.parse(rv.responseText);
|
|||
|
|
if (respJSON.hasOwnProperty('errcode')) {
|
|||
|
|
result.errcode = respJSON.errcode;
|
|||
|
|
}
|
|||
|
|
if (respJSON.hasOwnProperty('token')) {
|
|||
|
|
result.token = respJSON.token;
|
|||
|
|
result.errcode = 0;
|
|||
|
|
token1 = result.token;
|
|||
|
|
console.log("token1="+token1)
|
|||
|
|
localStorage.setItem("token1",token1);
|
|||
|
|
// fetchDevice(0,100);
|
|||
|
|
}
|
|||
|
|
},2)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//post请求
|
|||
|
|
function requestPost(router, params, callback,type) {
|
|||
|
|
console.log('requestPost params='+JSON.stringify(params));
|
|||
|
|
var self = this;
|
|||
|
|
var url = _cf.q2http_url + router;
|
|||
|
|
if (type === 2){
|
|||
|
|
url = _cf_1.q2http_url + router;
|
|||
|
|
}
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'post',
|
|||
|
|
url: url,
|
|||
|
|
data: params,
|
|||
|
|
traditional: true,
|
|||
|
|
dataType: 'json',
|
|||
|
|
async: true,
|
|||
|
|
complete: function (rv) {
|
|||
|
|
console.log(JSON.stringify(rv));
|
|||
|
|
if (typeof callback == 'function') callback(rv)
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//get请求
|
|||
|
|
function requestGet(router, callback) {
|
|||
|
|
var self = this;
|
|||
|
|
var url = _cf.q2http_url + router;
|
|||
|
|
if (type === 2){
|
|||
|
|
url = _cf_1.q2http_url + router;
|
|||
|
|
}
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'get',
|
|||
|
|
url: url,
|
|||
|
|
dataType: 'json',
|
|||
|
|
async: true,
|
|||
|
|
complete: function (rv) {
|
|||
|
|
if (typeof callback == 'function') callback(rv)
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//get请求
|
|||
|
|
function requestGetWithParam(router, params,callback,type) {
|
|||
|
|
var self = this;
|
|||
|
|
var url = _cf.q2http_url + router;
|
|||
|
|
if (type === 2){
|
|||
|
|
url = _cf_1.q2http_url + router;
|
|||
|
|
}
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'get',
|
|||
|
|
url: url,
|
|||
|
|
dataType: 'json',
|
|||
|
|
data:params,
|
|||
|
|
async: true,
|
|||
|
|
complete: function (rv) {
|
|||
|
|
if (typeof callback == 'function') callback(rv)
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
/*********************云台控制****************/
|
|||
|
|
function ptz(type) {
|
|||
|
|
|
|||
|
|
let pId = null;
|
|||
|
|
let idex = 0;
|
|||
|
|
let useToken = '';
|
|||
|
|
let pathType = '';
|
|||
|
|
//视频替换
|
|||
|
|
$.each(playBallList, function (index, item) {
|
|||
|
|
if (!isEmpty(item)) {
|
|||
|
|
if (selectedScreen === item.selectedScreen) {
|
|||
|
|
if (item.start && item.myPlayer !== null) {
|
|||
|
|
pId = item.puid;
|
|||
|
|
useToken = item.token;
|
|||
|
|
pathType = item.pathType;
|
|||
|
|
console.log("useToken=============="+useToken)
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
console.log("pId="+pId)
|
|||
|
|
console.log("sssssss="+selectedScreen)
|
|||
|
|
if(type == 'TurnUp'){
|
|||
|
|
turncontrol(pId,idex,'up',useToken,pathType);
|
|||
|
|
}else if(type == 'TurnDown'){
|
|||
|
|
turncontrol(pId,idex,'down',useToken,pathType);
|
|||
|
|
}else if(type == 'TurnLeft'){
|
|||
|
|
turncontrol(pId,idex,'left',useToken,pathType);
|
|||
|
|
}else if(type == 'TurnRight'){
|
|||
|
|
turncontrol(pId,idex,'right',useToken,pathType);
|
|||
|
|
}else if(type == 'ZoomInPicture'){
|
|||
|
|
//放大
|
|||
|
|
zoomcontrol(pId,idex,'zoomin',useToken,pathType);
|
|||
|
|
}else if(type == 'ZoomOutPicture'){
|
|||
|
|
//缩小
|
|||
|
|
zoomcontrol(pId,idex,'zoominout',useToken,pathType);
|
|||
|
|
}else if(type == 'MakeFocusFar'){
|
|||
|
|
//远焦
|
|||
|
|
focuscontrol(pId,idex,'faraway',useToken,pathType);
|
|||
|
|
}else if(type == 'MakeFocusNear'){
|
|||
|
|
//近焦
|
|||
|
|
focuscontrol(pId,idex,'near',useToken,pathType);
|
|||
|
|
}else if(type == 'StopFocusMove'){
|
|||
|
|
focuscontrol(pId,idex,'stop',useToken,pathType);
|
|||
|
|
}else if(type == 'StopPictureZoom'){
|
|||
|
|
zoomcontrol(pId,idex,'stop',useToken,pathType);
|
|||
|
|
}else{
|
|||
|
|
turncontrol(pId,idex,'stop',useToken,pathType);
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
//清新云台上下左右
|
|||
|
|
//旋转平台功能
|
|||
|
|
async function turncontrol(puid,idx,option,useToken,pathType) {
|
|||
|
|
if (option == "up") {
|
|||
|
|
$("#balltop").css("background-image","url('../../../img/video/ydj/s.png')");
|
|||
|
|
await requestPost('PTZ/C_PTZ_Turn?token=' + useToken, {
|
|||
|
|
puid: puid,
|
|||
|
|
idx: idx,
|
|||
|
|
motion: 'up'
|
|||
|
|
}, async (rv) => {
|
|||
|
|
},pathType);
|
|||
|
|
} else if (option == "down") {
|
|||
|
|
$("#ballbuttom").css("background-image","url('../../../img/video/ydj/x.png')");
|
|||
|
|
var number = "down";
|
|||
|
|
await requestPost('PTZ/C_PTZ_Turn?token=' + useToken, {
|
|||
|
|
puid: puid,
|
|||
|
|
idx: idx,
|
|||
|
|
motion: 'down'
|
|||
|
|
}, rv => {
|
|||
|
|
},pathType);
|
|||
|
|
} else if (option == "left") {
|
|||
|
|
$("#ballleft").css("background-image","url('../../../img/video/ydj/z.png')");
|
|||
|
|
var number = "left";
|
|||
|
|
await requestPost('PTZ/C_PTZ_Turn?token=' + useToken, {
|
|||
|
|
puid: puid,
|
|||
|
|
idx: idx,
|
|||
|
|
motion: 'left'
|
|||
|
|
}, rv => {
|
|||
|
|
},pathType);
|
|||
|
|
} else if (option == "right") {
|
|||
|
|
var number = "right";
|
|||
|
|
$("#ballright").css("background-image","url('../../../img/video/ydj/y.png')");
|
|||
|
|
await requestPost('PTZ/C_PTZ_Turn?token=' + useToken, {
|
|||
|
|
puid: puid,
|
|||
|
|
idx: idx,
|
|||
|
|
motion: 'right'
|
|||
|
|
}, rv => {
|
|||
|
|
},pathType);
|
|||
|
|
} else if (option == "stop") {
|
|||
|
|
var number = "stop";
|
|||
|
|
console.log("stop----------------");
|
|||
|
|
requestPost('PTZ/C_PTZ_Turn?token=' + useToken, {
|
|||
|
|
puid: puid,
|
|||
|
|
idx: idx,
|
|||
|
|
motion: 'stop'
|
|||
|
|
}, rv => {
|
|||
|
|
console.log("stop++++++++++++++++");
|
|||
|
|
$("#balltop").css("background-image","url('../../../img/video/wdj/s.png')");
|
|||
|
|
$("#ballbuttom").css("background-image","url('../../../img/video/wdj/x.png')");
|
|||
|
|
$("#ballleft").css("background-image","url('../../../img/video/wdj/z.png')");
|
|||
|
|
$("#ballright").css("background-image","url('../../../img/video/wdj/y.png')");
|
|||
|
|
},pathType);
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
//缩放功能
|
|||
|
|
function zoomcontrol(puid,idx,option,useToken,pathType) {
|
|||
|
|
let self = this;
|
|||
|
|
let params = {
|
|||
|
|
puid: puid,
|
|||
|
|
idx: idx,
|
|||
|
|
}
|
|||
|
|
if (option == "stop") {
|
|||
|
|
//停止缩放接口
|
|||
|
|
requestPost('PTZ/C_PTZ_StopPictureZoom?token=' + useToken, params, rv => {
|
|||
|
|
var respJSON = rv.responseJSON;
|
|||
|
|
},pathType)
|
|||
|
|
$("#big").css("background-image","url('../../img/video/scale01.png')");
|
|||
|
|
$("#small").css("background-image","url('../../img/video/scale02.png')");
|
|||
|
|
} else if (option == "zoomin") {
|
|||
|
|
//放大图像接口
|
|||
|
|
$("#big").css("background-image","url('../../img/video/scale01.png')");
|
|||
|
|
requestPost('PTZ/C_PTZ_ZoomInPicture?token=' + useToken, params, rv => {},pathType)
|
|||
|
|
} else {
|
|||
|
|
$("#small").css("background-image","url('../../img/video/scale02.png')");
|
|||
|
|
//缩小图像接口
|
|||
|
|
requestPost('PTZ/C_PTZ_ZoomOutPicture?token=' + useToken, params, rv => {},pathType)
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
function focuscontrol(puid,idx,option,useToken,pathType) {
|
|||
|
|
let params = {
|
|||
|
|
puid: puid,
|
|||
|
|
idx: idx,
|
|||
|
|
}
|
|||
|
|
if (option == "near") {
|
|||
|
|
$("#jfocus").css("background-image","url('../../img/video/focus01.png')");
|
|||
|
|
requestPost('PTZ/C_PTZ_MakeFocusNear?token=' + useToken, params, rv => {
|
|||
|
|
console.log(rv)
|
|||
|
|
},pathType)
|
|||
|
|
} else if (option == "faraway") {
|
|||
|
|
$("#yfocus").css("background-image","url('../../img/video/focus02.png')");
|
|||
|
|
requestPost('PTZ/C_PTZ_MakeFocusFar?token=' + useToken, params, rv => {
|
|||
|
|
console.log(rv)
|
|||
|
|
},pathType)
|
|||
|
|
} else {
|
|||
|
|
requestPost('PTZ/C_PTZ_StopFocusMove?token=' + useToken, params, rv => {
|
|||
|
|
console.log(rv)
|
|||
|
|
},pathType)
|
|||
|
|
|
|||
|
|
$("#yfocus").css("background-image","url('../../img/video/focus01.png')");
|
|||
|
|
$("#jfocus").css("background-image","url('../../img/video/focus02.png')");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|