let dtree, util, tree; let noNum = 0, num = 0, all = 0; let type = 'city'; let winDom = 'videoPlayer1'; /** * 播放视频 * @param {Object} winNum * @param {Object} devCode * @param {Object} devName * @param videoType 视频类型 */ function playVideo(winNum, devCode, devName, videoType) { videos.closeAllVideo(); destoryVideo(flvPlayer); if (videoType ==='to-2') { QXPlayVideo(devCode, '0', winDom) } else if (videoType ==='to-1') { TYPlayVideo(1, devCode, "") }else{ QXPlayVideo(devCode, '0', winDom) } } /** * 云台控制 * @param devCode */ function playControl() { let key; //点击事件 let btn = $('[lay-event=control]'); btn.unbind(); btn.mousedown(function (event) { if (videoObject.playState) { if (videoObject.videoType !== 'to-1') { key = qxControlType[$(this).attr('id')]; if (key[2]) { turnControl(key[0], videoObject.devCode).then(r => { }); } else { qxControl(videoObject.devCode, key[1]) } } else { key = controlType[$(this).attr('id')][0] videos.videoControl(videoObject.devCode, key, 5, 5); } } event.stopPropagation(); }).mouseup(function (event) { if (videoObject.playState) { if (videoObject.videoType !== 'to-1') { key = qxControlType[$(this).attr('id')]; if (key[2]) { turnControl(key[3], videoObject.devCode).then(r => { }); } else { qxControl(videoObject.devCode, key[3]) } } else { key = controlType[$(this).attr('id')][1] videos.videoControl(videoObject.devCode, key, 5, 5); } } else { layer.msg("请先播放视频....", {icon: 0}); } event.stopPropagation(); }); } let numA = ""; let up = "W"; let down = "S"; let left = "A"; let right = "D"; let amplify = "Q"; let shrink = "E"; let farFocus = "R"; let nearFocus = "T"; let photoLocal = "F"; let videoLocal = "G"; let escape = "Escape"; //键盘监听事件——本地截屏 document.onkeydown = function (event) { console.log("开启监听") up = isEmpty(localStorage.getItem("up")) ? "W" : localStorage.getItem("up"); down = isEmpty(localStorage.getItem("down")) ? "S" : localStorage.getItem("down"); left = isEmpty(localStorage.getItem("left")) ? "A" : localStorage.getItem("left"); right = isEmpty(localStorage.getItem("right")) ? "D" : localStorage.getItem("right"); amplify = isEmpty(localStorage.getItem("amplify")) ? "Q" : localStorage.getItem("amplify"); shrink = isEmpty(localStorage.getItem("shrink")) ? "E" : localStorage.getItem("shrink"); farFocus = isEmpty(localStorage.getItem("farFocus")) ? "R" : localStorage.getItem("farFocus"); nearFocus = isEmpty(localStorage.getItem("nearFocus")) ? "T" : localStorage.getItem("nearFocus"); photoLocal = isEmpty(localStorage.getItem("photoLocal")) ? "F" : localStorage.getItem("photoLocal"); videoLocal = isEmpty(localStorage.getItem("videoLocal")) ? "G" : localStorage.getItem("videoLocal"); escape = isEmpty(localStorage.getItem("escape")) ? "Escape" : localStorage.getItem("escape"); let e = event || window.event || arguments.callee.caller.arguments[0]; if (numA !== e.code.replaceAll("Key",'')) { whichkey(event); } numA = e.code.replaceAll("Key",''); }; function whichkey(event) { let e = event || window.event || arguments.callee.caller.arguments[0]; if (e.code === escape && e) { let esc = localStorage.getItem('esc'); if(esc){ closePage(); // localStorage.removeItem('esc'); }else{ configure(); } } else if (e && e.code.replaceAll("Key",'') === photoLocal) { // Ctrl_B screenshot(); } else if (e && e.code.replaceAll("Key",'') === videoLocal) { // Ctrl_B $("#videoLocal").click() } else if (e && e.code.replaceAll("Key",'') === up) { // Ctrl_B controlDown("up"); } else if (e && e.code.replaceAll("Key",'') === down) { // Ctrl_B controlDown("down"); } else if (e && e.code.replaceAll("Key",'') === left) { // Ctrl_B controlDown("left"); } else if (e && e.code.replaceAll("Key",'') === right) { // Ctrl_B controlDown("right"); } else if (e && e.code.replaceAll("Key",'') === amplify) { // Ctrl_B controlDown("amplify"); } else if (e && e.code.replaceAll("Key",'') === shrink) { // Ctrl_B controlDown("shrink"); } else if (e && e.code.replaceAll("Key",'') === farFocus) { // Ctrl_B controlDown("farFocus"); } else if (e && e.code.replaceAll("Key",'') === nearFocus) { // Ctrl_B controlDown("nearFocus"); } } document.onkeyup = function (event) { numA = ""; let e = event || window.event || arguments.callee.caller.arguments[0]; if (e && e.code.replaceAll("Key",'') === up) { // Ctrl_B controlUp("up"); } else if (e && e.code.replaceAll("Key",'') === down) { // Ctrl_B controlUp("down"); } else if (e && e.code.replaceAll("Key",'') === left) { // Ctrl_B controlUp("left"); } else if (e && e.code.replaceAll("Key",'') === right) { // Ctrl_B controlUp("right"); } else if (e && e.code.replaceAll("Key",'') === amplify) { // Ctrl_B controlUp("amplify"); } else if (e && e.code.replaceAll("Key",'') === shrink) { // Ctrl_B controlUp("shrink"); } else if (e && e.code.replaceAll("Key",'') === farFocus) { // Ctrl_B controlUp("farFocus"); } else if (e && e.code.replaceAll("Key",'') === nearFocus) { // Ctrl_B controlUp("nearFocus"); } } function controlDown(type) { let key; if (videoObject.playState) { if (videoObject.videoType === 'to-2') { key = qxControlType[type]; if (key[2]) { console.log(key[2]); turnControl(key[0], videoObject.devCode).then(r => { }); } else { console.log(key[3]); qxControl(videoObject.devCode, key[1]) } } else { key = controlType[type][0] console.log(key); videos.videoControl(videoObject.devCode, key, 5, 5); } } else { layer.msg("请先播放视频....", {icon: 0}); } } function controlUp(type) { let key; if (videoObject.playState) { if (videoObject.videoType === 'to-2') { key = qxControlType[type]; if (key[2]) { turnControl(key[3], videoObject.devCode).then(r => { }); } else { qxControl(videoObject.devCode, key[3]) } } else { key = controlType[type][0] videos.videoControl(videoObject.devCode, key, 5, 5); } } else { layer.msg("请先播放视频....", {icon: 0}); } } function configure() { let height = '90%', width = '30%'; let layerIndex = parent.layer.open({ id: "configure", title: ['快捷键设置', 'font-size:18px;'], type: 2, shade: 0.1, shadeClose: false, maxmin: false, content: '../../html/video/configure.html', area: [width, height], move:false, success:function(){ if(indexArr){ indexArr.push({'type':'parent','index':layerIndex}); } }, end: function (layero, index) { if(indexArr && indexArr.length > 0){ indexArr.forEach(function(item,index){ if(item.index === layerIndex) indexArr.splice(index,1); }) $('#startTime').focus(); } } }); }