1 line
30 KiB
JavaScript
1 line
30 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-67a0"],{a4yd:function(e,t,n){"use strict";var a=n("t3Un");t.a={GetCameraList:function(){return Object(a.a)({url:"/fast/GetCameraList",method:"post"})},SetFastMode:function(e){return Object(a.a)({url:"/fast/SetFastMode",method:"post",data:e})},GetFastMode:function(){return Object(a.a)({url:"/fast/GetFastMode",method:"post"})}}},"jyl/":function(e,t,n){"use strict";n.r(t);n("peJW");var a=n("pP4N"),l=n("a4yd"),i={data:function(){return{list:[],autoSchedule:!1}},created:function(){this.GetCameraList(),this.getFastMode()},mounted:function(){},methods:{GetCameraList:function(){var e=this;l.a.GetCameraList().then(function(t){e.list=t.data.data;setTimeout(function(){Object(a.a)()},3e3)})},setFastMode:function(e){var t=0;1==this.autoSchedule&&(t=1);var n={mode:t};l.a.SetFastMode(n).then(function(e){})},getFastMode:function(){var e=this;l.a.GetFastMode().then(function(t){var n=t.data.data;e.autoSchedule=!0,0==n.mode&&(e.autoSchedule=!1)})}}},o=n("KHd+"),d=Object(o.a)(i,function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"container"},[n("el-card",{staticClass:"box-card",staticStyle:{"margin-top":"20px"}},[n("span",{staticStyle:{"font-weight":"bold","font-size":"20px"}},[e._v("自动模式")]),e._v(" "),n("el-switch",{staticStyle:{"margin-left":"100px","font-weight":"bold","font-size":"20px"},attrs:{"active-color":"#0080C0","inactive-color":"#999999","active-text":"启动","inactive-text":"停止"},on:{change:function(t){e.setFastMode(t)}},model:{value:e.autoSchedule,callback:function(t){e.autoSchedule=t},expression:"autoSchedule"}})],1),e._v(" "),n("div",{staticClass:"content",staticStyle:{"margin-top":"20px"},attrs:{id:"device_ipc_content"}},[n("div",{staticClass:"h5-left",staticStyle:{width:"120px"}},[n("ul",{staticClass:"h5-menu-list"},e._l(e.list,function(t,a){return n("li",{attrs:{"data-ip":t.ip,"data-port":t.port,"data-user":t.name,"data-pswd":t.password}},[e._v("\n "+e._s(t.desp))])}))]),e._v(" "),e._m(0),e._v(" "),e._m(1)])],1)},[function(){var e=this.$createElement,t=this._self._c||e;return t("div",{staticClass:"h5-left"},[t("div",{staticClass:"h5-play-wrap"}),this._v(" "),t("div",{staticClass:"h5-form-item fn-clear",staticStyle:{"margin-top":"20px","margin-left":"120px"}},[t("input",{staticClass:"h5-button fn-marl10",staticStyle:{width:"100px"},attrs:{type:"button",value:"抓图","btn-for":"onSnap"}}),this._v(" "),t("input",{staticClass:"h5-button fn-marl10",staticStyle:{width:"100px"},attrs:{type:"button",value:"开始录像","btn-for":"onStartRecord"}}),this._v(" "),t("input",{staticClass:"h5-button fn-marl10",staticStyle:{width:"100px"},attrs:{type:"button",value:"停止录像","btn-for":"onStopRecord"}}),this._v(" "),t("input",{staticClass:"h5-button fn-marl10",staticStyle:{width:"100px"},attrs:{type:"button","btn-for":"onStopPreview",value:"停止设备拉流"}}),this._v(" "),t("input",{staticClass:"h5-button fn-marl10",staticStyle:{width:"100px"},attrs:{type:"button","btn-for":"onLogout",value:"登出当前设备"}})])])},function(){var e=this.$createElement,t=this._self._c||e;return t("div",{staticClass:"h5-right",staticStyle:{display:"none"}},[t("input",{staticStyle:{width:"170px"},attrs:{type:"datetime-local",step:"1",id:"h5_startTime"}}),this._v(" "),t("input",{staticStyle:{width:"170px"},attrs:{type:"datetime-local",step:"1",id:"h5_endTime"}}),this._v(" "),t("select",{staticClass:"h5-select",attrs:{id:"h5_playback_channel"}}),this._v(" "),t("select",{attrs:{id:"h5_stream","sel-for":"onChangeStream"}}),this._v(" "),t("select",{attrs:{id:"h5_channel","sel-for":"onChangeChannel"}})])}],!1,null,null,null);d.options.__file="index.vue";t.default=d.exports},pP4N:function(module,__webpack_exports__,__webpack_require__){"use strict";function ipcFunc(){let new_element=document.createElement("script");new_element.setAttribute("type","text/javascript"),new_element.setAttribute("src","./static/fast/module/PlayerControl.js"),document.body.appendChild(new_element);let $stream,$volume,$canvas,$video,$canvas_ivs,$video_wrap,$videoLoading,WndIndex=0,channel=0,curPage=1,totalPage=1,recordArr=[],canvasSon=null,playerInstance=[],recordInstance=[],talkInstance=[],ivsInstance=[],cutInstance=[],isCuting=!1,downList=[],downItemIndex=0,canvasParam={strokeColor:"#FF0000",title:"",resizeEnable:!1,moveEnable:!1,closeEnable:!0,array:!0,showSize:!1,selectType:"inSide",disappear:!0,selected:!1},curDeviceIndex=0;const lINENUMBER=16;let deviceObject={loginState:[],session:[]},isStartAll=!1,curEnlargeWnd=0,_doc=document.getElementById("device_ipc_content"),playbackOptions={};const init=()=>{let e="";for(var t=0;t<16;t++)e+='<div wnd-index="'+t+'" style="float: left; background-color: #000; position: relative; width: 100%; height: 100%;overflow:hidden;border:1px solid rgb(125,125,125)"><canvas id="h5_canvas_'+t+'" style="width:100%;height:100%;"></canvas><p id="h5_loading_'+t+'" class="video_loading" style="display:none">加载中...</p><video id="h5_video_'+t+'" style="display: none;width:100%;height:100%;position:absolute;top:0;left:0"></video><canvas id="h5_ivs_'+t+'" style="position: absolute;left: 0;top: 0;width: 100%;height: 100%;" width="800" height="600"></canvas></div>';_doc.querySelector(".h5-play-wrap").innerHTML=e,_doc.querySelectorAll(".h5-play-wrap div").forEach((e,t)=>{e.addEventListener("click",function(e){let t=e.target.parentNode.getAttribute("wnd-index")-0;_doc.querySelectorAll(".h5-play-wrap div").forEach(function(e,n){n===t?(e.style.borderColor="rgb(255, 204, 0)",WndIndex=t,curDeviceIndex=e.getAttribute("deviceindex")-0,setVideoDom()):e.style.borderColor="rgb(125, 125, 125)"})})});let n=_doc.querySelectorAll(".h5-menu-list li");deviceObject.loginState=new Array(n.length).fill(!1),deviceObject.session=new Array(n.length).fill(0),n.forEach(function(e,t){console.log("----------------"+t),e.addEventListener("click",async()=>{await onLogout(),curDeviceIndex=t,onLogin()})}),$stream=$("#h5_stream"),$volume=$("#h5_volume"),$video_wrap=_doc.querySelector(".h5-play-wrap"),setVideoDom();let a=_doc.querySelectorAll("input[btn-for]");for(let i of a)i.addEventListener("click",bindClickEvent);let l=_doc.querySelectorAll("select[sel-for]");for(let i of l)i.addEventListener("change",bindChangeEvent);$volume.addEventListener("input",function(e){let t=e.target.value-0;$("#h5_volume_value").innerText=t}),$volume.addEventListener("change",function(e){let t=e.target.value-0;playerInstance[WndIndex]&&playerInstance[WndIndex].setAudioVolume(t)}),$("#h5_first").addEventListener("click",function(){1!=curPage&&(curPage=1,updateTable())}),$("#h5_pre").addEventListener("click",function(){curPage>1&&(curPage-=1,updateTable())}),$("#h5_next").addEventListener("click",function(){curPage<totalPage&&(curPage+=1,updateTable())}),$("#h5_last").addEventListener("click",function(){curPage!=totalPage&&(curPage=totalPage,updateTable())}),$("#h5_goPage").addEventListener("click",function(){let e=$("#h5_goNumber").value-0;curPage!=e&&(curPage=e,updateTable())}),["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","msfullscreenchange"].forEach((e,t)=>{document.addEventListener(e,fullscreenchange,!1)}),onChangeWdnNum()},setVideoDom=()=>{$canvas=$("#h5_canvas_"+WndIndex),$video=$("#h5_video_"+WndIndex),$canvas_ivs=$("#h5_ivs_"+WndIndex),$videoLoading=$("#h5_loading_"+WndIndex);let e=deviceObject.session[curDeviceIndex],t=_doc.querySelector(".h5-menu-list li:nth-child("+(curDeviceIndex+1)+")"),n=t.getAttribute("data-ip"),a=t.getAttribute("data-port");setIP(n+":"+a),0!==e&&_setSession(e)},afterLogin=()=>{deviceObject.loginState[curDeviceIndex]=!0,deviceObject.session[curDeviceIndex]=_getSession(),$stream.options.length=0,$("#h5_playback_channel").options.length=0,$("#h5_channel").options.length=0,RPC.MagicBox.getProductDefinition("MaxExtraStream").then(function(e){let t=e.definition;if($stream.options.add(new Option("主码流",0)),t>1)for(let n=1;n<=t;n++)$stream.options.add(new Option("辅码流"+n,n));else $stream.options.add(new Option("辅码流",1))}),RPC.DevVideoInput.getCollect().then(function(e){let t=e.channels;for(let n=0;n<t;n++)$("#h5_playback_channel").options.add(new Option(n+1,n)),$("#h5_channel").options.add(new Option(n+1,n))});let e=(new Date).toLocaleDateString().split("/"),t=e[1]-0;t<10&&(e[1]="0"+t);let n=e[2]-0;n<10&&(e[2]="0"+n);let a=e.join("-");$("#h5_startTime").value=a+"T00:00",$("#h5_endTime").value=a+"T23:59:59"},onStartAll=async()=>{await onLogoutAll(),curDeviceIndex=0,_doc.querySelector("#h5_ivs_"+curDeviceIndex).click(),isStartAll=!0,onLogin()},onLogin=()=>{let e=_doc.querySelector(".h5-menu-list li:nth-child("+(curDeviceIndex+1)+")"),t=e.getAttribute("data-ip"),n=e.getAttribute("data-port"),a=e.getAttribute("data-user"),l=e.getAttribute("data-pswd"),i=t+":"+n;setIP(i),RPC.login(a,l,!1).then(e=>{setCookie("DWebClientSessionID","",-1),setCookie("DhWebClientSessionID","",-1),RPC.keepAlive(300,6e4,_getSession(),i,WndIndex),afterLogin(),onRealPreview(t,n,a,l)}).catch(e=>{console.log(e),loginError(e),$videoLoading.style.display="",$videoLoading.innerText="打开失败!";let t=_doc.querySelector("[sel-for=onChangeWdnNum]").value-0,n=_doc.querySelector(".h5-menu-list li:nth-child("+(curDeviceIndex+2)+")");1!==t&&null!=n&&isStartAll&&(clickNextWnd(),n.click())})},onRealPreview=(e,t,n,a)=>{if(playerInstance[WndIndex]){playerInstance[WndIndex].stop(),playerInstance[WndIndex].close(),playerInstance[WndIndex]=null;let e=$canvas;"none"===e.style.display&&(e=$video),e.style.display="none"}var l=null;let i=channel+1,o=$stream.value-0;(l=new PlayerControl({wsURL:"ws://"+e+":"+t+"/rtspoverwebsocket",rtspURL:"rtsp://"+e+":"+t+"/cam/realmonitor?channel="+i+"&subtype="+o+"&proto=Private3",username:n,password:a,lessRateCanvas:!0})).on("MSEResolutionChanged",function(e){console.log(e)}),l.on("PlayStart",function(e){console.log(e),$canvas.parentNode.setAttribute("deviceindex",curDeviceIndex),$videoLoading.style.display="none";let t=_doc.querySelector("[sel-for=onChangeWdnNum]").value-0,n=_doc.querySelector(".h5-menu-list li:nth-child("+(curDeviceIndex+2)+")"),a=getLoginState();1!==t&&null!=n&&isStartAll&&a<t*t?(clickNextWnd(),n.click()):isStartAll=!1}),l.on("DecodeStart",function(e){console.log(e),"video"===e.decodeMode?($canvas.style.display="none",$video.style.display=""):($video.style.display="none",$canvas.style.display=""),(canvasSon=new PluginCanvasES6).init($canvas_ivs,function(e){rebackActivateLocalEnlarging(e)}),canvasSon.addChangeShapeEvent(),playerInstance[WndIndex]=l,ivsInstance[WndIndex]=canvasSon}),l.on("GetFrameRate",function(e){console.log("GetFrameRate: "+e)}),l.on("FrameTypeChange",function(e){console.log("FrameTypeChange: "+e)}),l.on("Error",function(e){}),l.on("WorkerReady",function(){l.connect()}),l.init($canvas,$video),$videoLoading.style.display="",$videoLoading.innerText="加载中..."},onPlayBack=(e,t)=>{if(playerInstance[WndIndex]){playerInstance[WndIndex].stop(),playerInstance[WndIndex].close(),playerInstance[WndIndex]=null;let e=$canvas;"none"===e.style.display&&(e=$video),e.style.display="none"}let n=playbackOptions.ip,a=playbackOptions.port,l=playbackOptions.name,i=playbackOptions.pswd,o=null,d=0;(o=new PlayerControl({wsURL:"ws://"+n+":"+a+"/rtspoverwebsocket",rtspURL:"rtsp://"+n+":"+a+"/"+e,username:l,password:i,lessRateCanvas:!0,playbackIndex:t})).on("UpdateCanvas",function(e){let t=o.playbackIndex;0===d&&(d=e.timestamp),$("#h5_curTime_"+t).innerText=e.timestamp-d}),o.on("GetTotalTime",function(e){$("#h5_totalTime_"+o.playbackIndex).innerText=e}),o.on("MSEResolutionChanged",function(e){console.log(e)}),o.on("PlayStart",function(e){console.log(e),$canvas.parentNode.setAttribute("deviceindex",curDeviceIndex),$videoLoading.style.display="none"}),o.on("DecodeStart",function(e){console.log(e),"video"===e.decodeMode?($video.style.display="",$canvas.style.display="none"):($video.style.display="none",$canvas.style.display=""),(canvasSon=new PluginCanvasES6).init($canvas_ivs,function(e){rebackActivateLocalEnlarging(e)}),canvasSon.addChangeShapeEvent(),playerInstance[WndIndex]=o,ivsInstance[WndIndex]=canvasSon}),o.on("GetFrameRate",function(e){console.log("GetFrameRate: "+e)}),o.on("FrameTypeChange",function(e){console.log("FrameTypeChange: "+e)}),o.on("FileOver",function(e){o.close()}),o.on("Error",function(e){}),o.on("WorkerReady",function(){o.connect()}),o.init($canvas,$video),$videoLoading.style.display="",$videoLoading.innerText="加载中..."},getLoginState=()=>{let e=0;return deviceObject.loginState.map(t=>{!0===t&&e++}),e},clickNextWnd=()=>{let e=_doc.querySelector("[sel-for=onChangeWdnNum]").value-0;2===e&&3===WndIndex||3===e&&8===WndIndex||4===e&&15===WndIndex||_doc.querySelector("#h5_ivs_"+(WndIndex+1)).click()},onStopPreview=()=>{if(playerInstance[WndIndex]){playerInstance[WndIndex].stop(),playerInstance[WndIndex].close(),playerInstance[WndIndex]=null;let e=$canvas;"none"===e.style.display&&(e=$video),e.style.display="none"}talkInstance[WndIndex]&&(talkInstance[WndIndex].talk("off"),talkInstance[WndIndex]=null),recordInstance[WndIndex]&&(recordInstance[WndIndex].startRecod(!1),recordInstance[WndIndex]=null),$videoLoading.style.display="none"},onStopAllPreview=()=>{for(let e=0;e<playerInstance.length;e++)if(playerInstance[e]){playerInstance[e].stop(),playerInstance[e].close(),playerInstance[e]=null;let t=$("#h5_canvas_"+e),n=$("#h5_video_"+e),a=t;"none"===a.style.display&&(a=n),a.style.display="none"}talkInstance.forEach(e=>{e&&(e.talk("off"),e=null)}),recordInstance.forEach(e=>{e&&(e.startRecod(!1),e=null)}),_doc.querySelectorAll("[id^=h5_loading_]").forEach(e=>{e.style.display="none"})},onLogout=async()=>{if(null===_doc.querySelector('div[wnd-index="'+WndIndex+'"]').getAttribute("deviceindex"))return;let e=deviceObject.session[curDeviceIndex];0!==e&&(_setSession(e),await RPC.Global.logout().then(function(){if(playerInstance[WndIndex]){playerInstance[WndIndex].stop(),playerInstance[WndIndex].close(),playerInstance[WndIndex]=null;let e=$canvas;"none"===e.style.display&&(e=$video),e.style.display="none"}talkInstance[WndIndex]&&(talkInstance[WndIndex].talk("off"),talkInstance[WndIndex]=null),cutInstance[WndIndex]&&(cutInstance[WndIndex].stop(),cutInstance[WndIndex].close(),cutInstance[WndIndex]=null),recordInstance[WndIndex]&&(recordInstance[WndIndex].startRecod(!1),recordInstance[WndIndex]=null),$videoLoading.style.display="none",deviceObject.session[curDeviceIndex]=0,deviceObject.loginState[curDeviceIndex]=!1,pubsub.publish("_clearTime_",WndIndex)}))},onLogoutAll=async()=>{for(let t=0;t<playerInstance.length;t++)if(playerInstance[t]){playerInstance[t].stop(),playerInstance[t].close(),playerInstance[t]=null;let e=$("#h5_canvas_"+t),n=$("#h5_video_"+t),a=e;"none"===a.style.display&&(a=n),a.style.display="none"}talkInstance.forEach(e=>{e&&(e.talk("off"),e=null)}),recordInstance.forEach(e=>{e&&(e.startRecod(!1),e=null)}),_doc.querySelectorAll("[id^=h5_loading_]").forEach(e=>{e.style.display="none"});let e=deviceObject.session.length;for(let t=0;t<e;t++)if(0!=deviceObject.session[t]){let e=_doc.querySelector(".h5-menu-list li:nth-child("+(t+1)+")"),n=e.getAttribute("data-ip"),a=e.getAttribute("data-port");setIP(n+":"+a),_setSession(deviceObject.session[t]),await RPC.Global.logout().then(()=>{deviceObject.session[t]=0,deviceObject.loginState[t]=!1,_doc.querySelector('div[wnd-index="'+WndIndex+'"]').removeAttribute("deviceindex")})}},onChangeStream=()=>{let e=_doc.querySelector(".h5-menu-list li:nth-child("+(curDeviceIndex+1)+")"),t=e.getAttribute("data-ip"),n=e.getAttribute("data-port"),a=e.getAttribute("data-user"),l=e.getAttribute("data-pswd");onRealPreview(t,n,a,l)},onChangeChannel=()=>{channel=$("#h5_channel").value-0;let e=_doc.querySelector(".h5-menu-list li:nth-child("+(curDeviceIndex+1)+")"),t=e.getAttribute("data-ip"),n=e.getAttribute("data-port"),a=e.getAttribute("data-user"),l=e.getAttribute("data-pswd");onRealPreview(t,n,a,l)},onTurnOnSound=()=>{let e=$volume.value-0;playerInstance[WndIndex]&&playerInstance[WndIndex].setAudioVolume(e)},onTurnSoundOff=()=>{playerInstance[WndIndex]&&playerInstance[WndIndex].setAudioVolume(0)},onStartTalk=()=>{if(null===_doc.querySelector('div[wnd-index="'+WndIndex+'"]').getAttribute("deviceindex"))return;let e=null,t=_doc.querySelector(".h5-menu-list li:nth-child("+(curDeviceIndex+1)+")"),n=channel+1,a=t.getAttribute("data-ip"),l=Number(t.getAttribute("data-port")),i=t.getAttribute("data-user"),o=t.getAttribute("data-pswd");(e=new PlayerControl({wsURL:"ws://"+a+":"+l+"/rtspoverwebsocket",rtspURL:"rtsp://"+a+":"+l+"/cam/realmonitor?channel="+n+"&subtype=5&proto=Private3",username:i,password:o,isTalkService:!0})).talk("on"),talkInstance[WndIndex]=e},onStopTalk=()=>{talkInstance[WndIndex]&&(talkInstance[WndIndex].talk("off"),talkInstance[WndIndex]=null)},onSnap=()=>{playerInstance[WndIndex]&&playerInstance[WndIndex].capture("test")},onStartRecord=()=>{if(null===_doc.querySelector('div[wnd-index="'+WndIndex+'"]').getAttribute("deviceindex"))return;let e=null,t=_doc.querySelector(".h5-menu-list li:nth-child("+(curDeviceIndex+1)+")"),n=channel+1,a=t.getAttribute("data-ip"),l=Number(t.getAttribute("data-port")),i=t.getAttribute("data-user"),o=t.getAttribute("data-pswd"),d=$stream.value-0;(e=new PlayerControl({wsURL:"ws://"+a+":"+l+"/rtspoverwebsocket",rtspURL:"rtsp://"+a+":"+l+"/cam/realmonitor?channel="+n+"&subtype="+d+"&proto=Private3",username:i,password:o})).startRecod(!0),recordInstance[WndIndex]=e,$videoLoading.style.display="",$videoLoading.innerText="录像中!"},onStopRecord=()=>{recordInstance[WndIndex]&&(recordInstance[WndIndex].startRecod(!1),recordInstance[WndIndex]=null,$videoLoading.style.display="none")},onStartCut=()=>{let e=_doc.querySelector("[btn-for=onStartCut]").getAttribute("cutIndex")-0,t=null,n=playbackOptions.ip,a=playbackOptions.port,l=playbackOptions.name,i=playbackOptions.pswd,o="rtsp://"+n+":"+a+"/"+recordArr[e].FilePath,d=$("#h5_cutStartTime").value,r=(new Date(d.replace("T"," ")).getTime()-new Date(recordArr[e].StartTime).getTime())/1e3,c={wsURL:"ws://"+n+":"+a+"/rtspoverwebsocket",rtspURL:o,username:l,password:i,isPrivateProtocol:!1,realm:RPC.realm,speed:16,playback:!0,range:r};(t=new PlayerControl(c)).on("WorkerReady",function(){t.connect()}),t.on("FileOver",function(){console.log("File Over"),t.startCut(!1),isCuting=!1,$("#h5_cut_process").innerText="100%"}),t.on("UpdateTimeStamp",function(e){let n=$("#h5_cutStartTime").value,a=$("#h5_cutEndTime").value,l=new Date(n.replace("T"," ")).getTime()/1e3,i=new Date(a.replace("T"," ")).getTime()/1e3,o=parseInt(100*(1-(i-e.timestamp)/(i-l)));$("#h5_cut_process").innerText=(o>100?100:o)+"%",e.timestamp>=l&&!isCuting&&(t.startCut(!0),isCuting=!0),e.timestamp>=i&&isCuting&&(t.startCut(!1),isCuting=!1,$("#h5_cut_process").innerText="100%")}),t.init($canvas,$video),cutInstance[WndIndex]=t},onStartEnlarge=()=>{if(ivsInstance[WndIndex]){ivsInstance[WndIndex].setRegionNum("rect",1);let e={...canvasParam};ivsInstance[WndIndex].drawStart("rect",e),curEnlargeWnd=WndIndex}},onStartGridEnlarge=()=>{_doc.querySelectorAll("[wnd-index]").forEach((e,t)=>{t===WndIndex?(_doc.querySelector('[wnd-index="'+WndIndex+'"]').style.width="100%",_doc.querySelector('[wnd-index="'+WndIndex+'"]').style.height="100%",_doc.querySelector("#h5_ivs_"+WndIndex).setAttribute("height",300),_doc.querySelector("#h5_ivs_"+WndIndex).setAttribute("width",500),ivsInstance[WndIndex]&&ivsInstance[WndIndex].resize()):e.style.display="none"})},onCloseGridEnlarge=()=>{_doc.querySelectorAll("[wnd-index]").forEach((e,t)=>{e.style.display=""}),onChangeWdnNum()},onStopEnlarge=()=>{let e=$canvas;"none"===e.style.display&&(e=$video),e.style.width="100%",e.style.height="100%",e.style.left=0,e.style.top=0,e.style.position="static"},rebackActivateLocalEnlarging=e=>{if(curEnlargeWnd!=WndIndex)return;let t,n=e.data;n[0][0]===n[1][0]||(t={left:n[0][0],top:n[0][1],right:n[1][0],bottom:n[1][1]});let a=$canvas;if("none"===a.style.display&&(a=$video),t.right<t.left){let e=t.left;t.left=t.right,t.right=e}if(t.bottom<t.top){let e=t.top;t.top=t.bottom,t.bottom=e}let l=$video_wrap.childNodes[WndIndex].clientWidth/8191,i=$video_wrap.childNodes[WndIndex].clientHeight/8191,o=zoomArea(t.left*l,t.top*i,t.right*l,t.bottom*i,$video_wrap.childNodes[WndIndex].clientWidth,$video_wrap.childNodes[WndIndex].clientHeight);a.style.width=o.width+"px",a.style.height=o.height+"px",a.style.left=o.left+"px",a.style.top=o.top+"px",a.style.position="absolute",ivsInstance[WndIndex].removeShapeDrawEvent()},onSetFull=()=>{getFull()?exitfullScreen():setfullScreen()},onChangeWdnNum=()=>{let e=_doc.querySelector("[sel-for=onChangeWdnNum]").value,t=_doc.querySelectorAll("[id^=h5_ivs_]"),n=_doc.querySelectorAll(".h5-play-wrap div");"1"===e?n.forEach(e=>{e.style.width="100%",e.style.height="100%",e.style.borderColor="#000"}):"2"===e?n.forEach((e,t)=>{e.style.width="calc(50% - 2px)",e.style.height="calc(50% - 2px)"}):"3"===e?n.forEach((e,t)=>{e.style.height="calc(33.333% - 2px)",e.style.width="calc(33.333% - 2px)"}):"4"===e&&n.forEach((e,t)=>{e.style.width="calc(25% - 2px)",e.style.height="calc(25% - 2px)"}),t.forEach(e=>{e.setAttribute("width",`${e.parentNode.clientWidth}`),e.setAttribute("height",`${e.parentNode.clientHeight}`)}),ivsInstance.forEach(e=>{e&&e.resize()}),_doc.querySelector("#h5_ivs_0").click()};function $(e){return"#"==e.charAt(0)?document.getElementById(e.substring(1)):"."==e.charAt(0)?_doc.getElementsByClassName(e.substring(1)):_doc.getElementsByTagName(e)}function setStyle(e,t){for(let n in t)e.style[n]=t[n]}function bindClickEvent(event){let $el=event.target,method=$el.getAttribute("btn-for"),disabled=$el.getAttribute("disabled");disabled||eval(method+"()")}function bindChangeEvent(event){let $el=event.target,method=$el.getAttribute("sel-for"),disabled=$el.getAttribute("disabled");disabled||eval(method+"()")}function zoomArea(e,t,n,a,l,i){let o=n-e,d=a-t,r=(e+n)/2,c=(t+a)/2,s=Math.min(l/o,i/d,20),u=l,p=i,h={width:l*s,height:i*s,left:l/2-r*s,top:i/2-c*s};return h.left>0&&(h.left=0),h.left<u-h.width&&(h.left=u-h.width),h.top>0&&(h.top=0),h.top<p-h.height&&(h.top=p-h.height),h}function getFull(){return window.top.document.mozFullScreen||window.top.document.webkitIsFullScreen||window.top.document.msFullscreenElement}function fullscreenchange(){getFull()||exitfullScreen()}function setfullScreen(){let e=window.top.document.documentElement;e.requestFullScreen?e.requestFullScreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullScreen?e.webkitRequestFullScreen():e.msRequestFullscreen&&e.msRequestFullscreen(),handleFullscreen(!0)}function exitfullScreen(){let e=window.top.document.documentElement;e.exitFullscreen?e.exitFullscreen():e.mozCancelFullScreen?e.mozCancelFullScreen():e.webkitCancelFullScreen?e.webkitCancelFullScreen():e.msExitFullscreen&&e.msExitFullscreen(),handleFullscreen(!1)}function handleFullscreen(e){if(e){let e={position:"absolute",left:0,top:0,width:window.screen.width+"px",height:window.screen.height+"px",overflow:"visible"};setStyle($video_wrap,e)}else{setStyle($video_wrap,{position:"relative",overflow:"hidden",width:"500px",height:"300px"})}}const onSearchRecord=async()=>{let e=[],t=0,n=$("#h5_playback_channel").value-0,a=_doc.querySelector(".h5-menu-list li:nth-child("+(curDeviceIndex+1)+")"),l=a.getAttribute("data-ip"),i=a.getAttribute("data-port"),o=a.getAttribute("data-user"),d=a.getAttribute("data-pswd");playbackOptions={ip:l,port:i,name:o,pswd:d};const r=n=>new Promise((a,l)=>{RPC.MediaFileFind.findNextFile(n,{count:100}).then(i=>{Number.isInteger(i.found)?(t+=i.found,e=e.concat([...i.infos]),100===i.found?r(n).then(()=>{a(!0)}).catch(e=>{l(e)}):(recordArr=[...e],s(recordArr.slice(0,lINENUMBER)),u(),c(n),a(!0))):(c(n),a(!0))}).catch(e=>{l(e),c(n)})}),c=e=>new Promise((t,n)=>{RPC.MediaFileFind.close(e).then(()=>{RPC.MediaFileFind.destroy(e),t(!0)}).catch(()=>{n()}).finally(()=>{})}),s=e=>{let t=_doc.querySelector("#h5_table tbody");t.innerHTML="";for(let n=0;n<e.length;n++){let a=e[n].StartTime+" - "+e[n].EndTime,l=Math.round(e[n].Length/1024);t.insertRow(-1).innerHTML=`<td><input type="checkbox" id="h5_check_${n}"></td><td>${n+1}</td><td>${a}</td><td>${l}</td><td><span id="h5_curTime_${n}">--</span><span>/</span><span id="h5_totalTime_${n}">--</span><input type="text" id="h5_goTime_${n}" style="width: 50px;"><input type="button" class="h5-button" id="h5_button_go_${n}" value="GO!"></td>`}_doc.querySelectorAll("[id^=h5_button_go_]").forEach(e=>{e.addEventListener("click",function(t){let n=e.getAttribute("id").split("_")[3]-0;onGoTime(n)})}),_doc.querySelectorAll("[id^=h5_check_]").forEach(function(e){e.addEventListener("click",function(e){if(e.stopPropagation(),e.target.checked){let t=e.target.getAttribute("id").split("_")[2]-0,n=recordArr[t].StartTime.split(" ").join("T"),a=recordArr[t].EndTime.split(" ").join("T");"00"===n.split(":")[2]&&(n=n.substr(0,n.length-3)),"00"===a.split(":")[2]&&(a=a.substr(0,a.length-3)),$("#h5_cutStartTime").value=n,$("#h5_cutEndTime").value=a,_doc.querySelector("[btn-for=onStartCut]").setAttribute("cutIndex",t)}})}),_doc.querySelectorAll("#h5_table tbody tr").forEach(function(e){e.addEventListener("dblclick",function(e){if(e.stopPropagation(),"TD"===e.target.nodeName){let t=e.target.parentNode.childNodes[1].innerText-1,n=recordArr[t].FilePath;onPlayBack(n,t)}})})},u=()=>{totalPage=Math.ceil(t/lINENUMBER),$("#h5_curPage").innerText=curPage,$("#h5_totalPage").innerText=totalPage};let p=[];try{p=await RPC.getDeviceAllInfo("getDeviceAllInfo")}catch(e){console.log(e)}let h=null;h=p.info&&p.info.length>1?"All":p.info&&p.info[0]&&p.info[0].Detail&&p.info[0].Detail[0]&&p.info[0].Detail[0].Path||"/mnt/sd";let v=$("#h5_startTime").value.replace("T"," "),y=$("#h5_endTime").value.replace("T"," ");v.split(" ")[1].split(":").length<3&&(v+=":00"),y.split(" ")[1].split(":").length<3&&(y+=":00"),(e=>new Promise((t,n)=>{RPC.MediaFileFind.instance().then(a=>{let l=a.result;RPC.MediaFileFind.findFile(l,e).then(()=>{r(l).then(()=>{t(!0)}).catch(e=>{n(e)})}).catch(e=>{n(e)})}).catch(e=>{n(e)})}))({condition:{Channel:n,Dirs:[h],StartTime:v,EndTime:y,Flags:null,Events:["*"],Types:["dav"]}}).catch(e=>{if(e&&e.error&&285409409===e.error.code)alert("回放功能需要确保SD卡经过设备认证");else{_doc.querySelector("#h5_table tbody").innerHTML="",$("#h5_curPage").innerText=1,$("#h5_totalPage").innerText=1,alert("无数据")}})},onCheckAll=()=>{let e=$("#h5_checkAll"),t=_doc.querySelectorAll("[id^=h5_check_]"),n=e.checked;t.forEach((e,t)=>{e.checked=n})},onDownload=async()=>{let e=_doc.querySelectorAll("[id^=h5_check_]");downList=[],e.forEach((e,t)=>{let n=e.getAttribute("id").split("_")[2]-0;e.checked&&(recordArr[(curPage-1)*lINENUMBER+n].selfCheckIndex=n,downList.push(recordArr[(curPage-1)*lINENUMBER+n]))}),onStartDownload(downList[downItemIndex=0])},onStartDownload=e=>{let t;e&&(t=e.selfCheckIndex);let n=null,a=_doc.querySelector(".h5-menu-list li:nth-child("+(curDeviceIndex+1)+")"),l=a.getAttribute("data-ip"),i=Number(a.getAttribute("data-port")),o=a.getAttribute("data-user"),d=a.getAttribute("data-pswd"),r={wsURL:"ws://"+l+":"+i+"/rtspoverwebsocket",rtspURL:"rtsp://"+l+":"+i+"/"+recordArr[t].FilePath,username:o,password:d,isPrivateProtocol:!1,realm:RPC.realm,speed:16,playback:!0};(n=new PlayerControl(r)).on("WorkerReady",function(){n.connect()}),n.on("FileOver",function(){n.startCut(!1),isCuting=!1,$("#h5_down_process").innerText="100%",downList[++downItemIndex]&&onStartDownload(downList[downItemIndex])}),n.on("UpdateTimeStamp",function(t){let a=new Date(e.StartTime).getTime()/1e3,l=new Date(e.EndTime).getTime()/1e3,i=parseInt(100*(1-(l-t.timestamp)/(l-a)));$("#h5_down_process").innerText=(i>100?100:i)+"%",t.timestamp>=a&&!isCuting&&(n.startCut(!0),isCuting=!0),t.timestamp>=l&&isCuting&&(n.startCut(!1),isCuting=!1,$("#h5_down_process").innerText="100%",downList[++downItemIndex]&&onStartDownload(downList[downItemIndex]))}),n.init($canvas,$video),cutInstance[WndIndex]=n},updateTable=()=>{$("#h5_checkAll").checked=!1,$("#h5_curPage").innerText=curPage;let e=_doc.querySelector("#h5_table tbody");e.innerHTML="";let t=(curPage-1)*lINENUMBER,n=recordArr.slice(t,t+lINENUMBER);for(let a=0;a<n.length;a++){let l=n[a].StartTime+"-"+n[a].EndTime,i=Math.round(n[a].Length/1024)+"(KB)";e.insertRow(-1).innerHTML=`<td><input type="checkbox" id="h5_check_${a}"></td><td>${t+a+1}</td><td>${l}</td><td>${i}</td><td><span id="h5_curTime_${a}">--</span><span>/</span><span id="h5_totalTime_${a}">--</span><input type="text" id="h5_goTime_${a}" style="width: 50px;"><input type="button" class="h5-button" id="h5_button_go_${a}" value="GO!"></td>`}_doc.querySelectorAll("[id^=h5_check_]").forEach(function(e){e.addEventListener("click",function(e){if(e.stopPropagation(),e.target.checked){let t=e.target.getAttribute("id").split("_")[2]-0,n=recordArr[t].StartTime,a=recordArr[t].EndTime;$("#h5_cutStartTime").value=n,$("#h5_cutEndTime").value=a,_doc.querySelector("[btn-for=onStartCut]").setAttribute("cutIndex",t)}})}),_doc.querySelectorAll("#h5_table tbody tr").forEach(function(e){e.addEventListener("dblclick",function(e){e.stopPropagation();let t=e.target.parentNode.childNodes[1].innerText-1,n=recordArr[t].FilePath;onPlayBack(n,t)})})},onPausePlayback=()=>{playerInstance[WndIndex]&&playerInstance[WndIndex].pause()},onContinuePlayback=()=>{playerInstance[WndIndex]&&playerInstance[WndIndex].play()},onClosePlayback=()=>{if(playerInstance[WndIndex]){playerInstance[WndIndex].stop(),playerInstance[WndIndex].close(),playerInstance[WndIndex]=null;let e=$canvas;"none"===e.style.display&&(e=$video),e.style.display="none"}},onGoTime=e=>{let t=$("#h5_goTime_"+e).value-0;playerInstance[WndIndex]&&playerInstance[WndIndex].playByTime(t)};window.onHandlePTZ=function(e,t){if(null===_doc.querySelector('div[wnd-index="'+WndIndex+'"]').getAttribute("deviceindex"))return;let n=deviceObject.session[curDeviceIndex];_setSession(n);let a=$("#h5_ptz_step").value-0,l=0,i=["GotoPreset","SetPreset","ClearPreset"],o=$("#h5_preset").value-0;["LeftUp","RightUp","LeftDown","RightDown"].indexOf(e)>-1&&(l=a),t?RPC.PTZManager("stop",channel,{code:e,arg1:a,arg2:l,arg3:0}):i.indexOf(e)>-1?RPC.PTZManager("start",channel,{code:e,arg1:o,arg2:0,arg3:0}):RPC.PTZManager("start",channel,{code:e,arg1:a,arg2:l,arg3:0})},init()}__webpack_require__.d(__webpack_exports__,"a",function(){return ipcFunc})},peJW:function(e,t,n){}}]); |