diff --git a/public/lib/WSPlayer/WSPlayer.js b/public/lib/WSPlayer/WSPlayer.js
index 18779b8..2d70e77 100644
--- a/public/lib/WSPlayer/WSPlayer.js
+++ b/public/lib/WSPlayer/WSPlayer.js
@@ -1 +1 @@
-var __defProp=Object.defineProperty,__defNormalProp=(e,t,s)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,__publicField=(e,t,s)=>(__defNormalProp(e,"symbol"!=typeof t?t+"":t,s),s);!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).WSPlayer={})}(this,(function(e){"use strict";const t={websocketPorts:{realmonitor:"realmonitor-websocket",playback:"playback-websocket",realmonitor_ws:"9100",playback_ws:"9320",realmonitor_wss:"9102",playback_wss:"9322"},errorVideoInfo:{100:"浏览器资源不足",101:"当前浏览器不支持硬解码",102:"硬解码播放失败",103:"硬解码播放延时超过8秒",104:"硬解码失败",201:"当前音频无法播放",202:"websocket连接错误",203:"文件播放完成",401:"该用户无操作权限",404:"请求超时或未找到",405:"播放超时",406:"视频流类型解析失败,请检查通道配置",407:"请求超时",408:"请求超时或码流不支持",409:"服务未推送码流",410:"视频流异常断开",411:"录像播放完成",457:"时间设置错误",503:"WS连接地址错误,非当前连接的ICC服务器返回",504:"对讲失败",701:"Chrome版本低,请升级到最新的Chrome版本",702:"Firefox版本低,请升级到最新的Firefox版本",703:"Edge版本低,请升级到最新的Edge版本",defaultErrorMsg:"播放失败,请检查配置"},errorInfo:{101:"所选通道离线,无法播放",102:"登录权限过期,查询实时预览rtsp失败",103:"获取实时预览rtsp失败",104:"操作失败,请稍后重试",105:"通道休眠,正在唤醒中,请稍后再试",106:"请传入rtsp地址和websocket地址",107:"当前未传records录像文件, 将无法拖动进度条",108:"请求超时,请稍后重试",201:"所选通道未查询到录像文件",202:"查询录像文件列表失败",203:"查询录像rtsp失败",204:"{0}倍速无法播放音频",205:"通道休眠,正在唤醒中,请稍后再试",206:"当前倍速不支持",301:"正在对讲,无法关闭音频",302:"其他设备对讲中,无法开启音频",303:"其他设备对讲中,无法开启对讲",304:"查询对讲rtsp失败",305:"http协议不支持对讲",306:"设备对讲失败",307:"不支持PCM音频格式对讲",308:"不支持ARM音频格式对讲",309:"不支持G711u音频格式对讲",310:"不支持G726音频格式对讲",311:"不支持AAC音频格式对讲",312:"不支持G722音频格式对讲",402:"该用户无播放权限",501:"解码库未初始化完成,请稍后播放!",502:"解码库未初始化完成,请稍后对讲!",503:"请检查创建播放器时,播放器容器是否存在",601:"所操作播放器不存在",602:"所选播放器正在本地录像中,不可重复本地录像",603:"所选播放器未播放录像,不可本地录像",604:"所选播放器未开始本地录像,不可操作关闭本地录像",605:"时间跳转播放传参错误",606:"设置自适应拉伸传参错误",607:"实时预览不支持倍速播放",608:"需传入正确的{0}方法:{1}",609:"超出当前设置最大窗口布局数量",610:"操作自定义窗口布局失败:{0}",611:"实时预览不支持播放方法",612:"实时预览不支持暂停方法",613:"实时预览不支持跳转播放",614:"当前窗口未播放实时预览画面, 无法进行对讲",701:"云台被用户{0}锁定,无法操作",702:"控制云台三维定位失败{0}",703:"控制云台{0}{1}失败{2}",704:"控制云台方向失败{0}",30000001:"SDP初始化失败",30000002:"接入服务内部错误(信令建立过程)",30000101:"请求失败",30000102:"拉流过程异常中断",30000103:"接入服务内部异常(码流传输过程)",30000104:"老设备回放时登入设备失败",30000105:"设备离线",30000106:"通道离线",30000107:"设备被删除",30000108:"通道被删除",30001001:"创建子链接失败",30001002:"设备不支持",30001003:"设备资源不足",30001004:"查询不到录像",30001005:"设备返回超时",30001006:"超过最大连接数",30002001:"拒绝对讲",30002002:"对讲被其他客户端打开,请稍后重试",30002003:"资源冲突",30002004:"不支持的语音编码格式",30002005:"无权限",30002006:"请求对讲失败",30002007:"请求喊话失败",30003001:"码率超限"},windowDefaultCustomDivision:{2:[{lStep:0,tStep:0,wStep:50,hStep:100},{lStep:50,tStep:0,wStep:50,hStep:100}],3:[{wStep:50,hStep:100,tStep:0,lStep:0},{wStep:50,hStep:50,tStep:0,lStep:50},{wStep:50,hStep:50,tStep:50,lStep:50}],6:[{wStep:66,hStep:66,tStep:0,lStep:0,selectIndex:0},{wStep:34,hStep:33,tStep:0,lStep:66,selectIndex:1},{wStep:34,hStep:33,tStep:33,lStep:66,selectIndex:2},{wStep:33,hStep:34,tStep:66,lStep:0,selectIndex:3},{wStep:33,hStep:34,tStep:66,lStep:33,selectIndex:4},{wStep:34,hStep:34,tStep:66,lStep:66,selectIndex:5}],8:[{wStep:75,hStep:75,tStep:0,lStep:0,selectIndex:0},{wStep:25,hStep:25,tStep:0,lStep:75,selectIndex:1},{wStep:25,hStep:25,tStep:25,lStep:75,selectIndex:2},{wStep:25,hStep:25,tStep:50,lStep:75,selectIndex:3},{wStep:25,hStep:25,tStep:75,lStep:0,selectIndex:4},{wStep:25,hStep:25,tStep:75,lStep:25,selectIndex:5},{wStep:25,hStep:25,tStep:75,lStep:50,selectIndex:6},{wStep:25,hStep:25,tStep:75,lStep:75,selectIndex:7}]},iconConfig:[{key:"refreshReplay",labelKey:"wsPlayer.refreshReplay",buttonParentClass:"ws-refresh-replay",buttonIconClass:"opt-icon refresh-replay-icon"},{key:"drawTriangle",labelKey:"wsPlayer.drawTriangle",buttonParentClass:"ws-draw-triangle",buttonIconClass:"opt-icon draw-triangle-icon off"},{key:"talkIcon",labelKey:"wsPlayer.talk",buttonParentClass:"ws-talk",buttonIconClass:"opt-icon talk-icon off"},{key:"localRecordIcon",labelKey:"wsPlayer.recording",buttonParentClass:"ws-record",buttonIconClass:"opt-icon record-icon"},{key:"audioIcon",labelKey:"wsPlayer.sound",buttonParentClass:"ws-audio",buttonIconClass:"opt-icon audio-icon off"},{key:"snapshotIcon",labelKey:"wsPlayer.capture",buttonParentClass:"ws-capture",buttonIconClass:"opt-icon capture-icon"}],_translate(e,t,s){Object.keys(this[e]).forEach((i=>{let r=t.$t(`${s}${i}`);r&&(this[e][i]=r)}))},updateLocale(e){this._translate("errorInfo",e,"wsPlayer.error."),this._translate("errorVideoInfo",e,"wsPlayer.play.error."),this.iconConfig.forEach((t=>{t.label=e.$t(t.labelKey)}))},transParam:8192,contentPadding:16,tagHeight:50,contentTop:64,lineHeight:24},s="Opera",i="Chrome",r="Firefox",a="Edge",l="Edg",n="IE",o="Safari",c="UOS",d="Qaxbrowser";function h(e){const{userAgent:t}=navigator;return t.split(e)[1].split(".")[0].slice(1)}function p(){return function(){let e=new Date;return[e.getFullYear(),e.getMonth()+1,e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()]}().join("_")}const y={checkBrowser:function(){const e=function(){const{userAgent:e}=navigator;return e.includes("UOS")?i:e.includes("Qaxbrowser")?d:e.includes("Edge")?a:e.includes("Edg")?l:e.includes("Firefox")?r:e.includes("Chrome")?i:e.includes("Safari")?o:e.includes("compatible")&&e.includes("MSIE")&&e.includes("Opera")?n:e.includes("Opera")?s:""}(),t=navigator.userAgent.includes("x64")||navigator.userAgent.includes("x86_64")||navigator.userAgent.includes("aarch64")?64:32,p=h(e);let y=!1,u=0;switch(e){case i:y=p>=91&&64===t,u=701;break;case r:y=p>=97,u=702;break;case a:case l:y=p>=91,u=703;break;case c:y=h("Chrome")>=91,u=704;break;case d:y=h("Chrome")>=91,u=705;break;default:y=0}return{isVersionCompliance:y,browserType:e,errorCode:u}},validFunction:function(e){return"[object Function]"===toString.call(e)},mergeObject:function e(){let t={};for(let i=0;i{s=0}),t))}},debounce:function(e,t){let s;return function(){s&&clearTimeout(s),s=setTimeout((()=>{e.apply(this,arguments),s=0}),t)}},getToday12Time:function(){let e=new Date;return e.setHours(12,0,0),e.getTime()/1e3},uint8ArraysToFileUrl:function(e,t="video/mp4"){let s=e.map((e=>e.buffer)),i=e.map((e=>e.offset));const r=s.reduce(((e,t)=>e+t.length),0),a=new Uint8Array(r);s.forEach(((e,t)=>{let s=i[t];if(!(e instanceof Uint8Array))throw new TypeError("Expected an ArrayBuffer");a.set(e,s)}));const l=new Blob([a],{type:t});return{blob:l,file:new File([l],"video_"+p()+("video/mp4"===t?".mp4":".dav"),{type:t}),blobUrl:URL.createObjectURL(l)}},watchDomObserver:function(e,t){const s=new ResizeObserver((e=>{e.forEach((e=>{t&&t()}))}));return s.observe(e[0]),s}};var u=globalThis&&globalThis.__assign||function(){return u=Object.assign||function(e){for(var t,s=1,i=arguments.length;s{s=s.replace(`{${t}}`,e)})),s}},C=function(e,t,s,i){console.log("PlayStart",t),this.closeCRaw(),this.setLoading(!1,"playing",e.closeReason),"video"===t.decodeMode?(this.videoElem.style.display="",this.canvasElem.style.display="none"):(this.videoElem.style.display="none",this.canvasElem.style.display=""),this.customDomElem&&this.customDomElem.css("display",""),this.updateAdapter(e.playerAdapter,t),this.width=t.width,this.height=t.height,WSPlayerJQ.$(".stream-info",this.$el).text(`${t.encodeMode?`${t.encodeMode}, `:""}${t.width?`${t.width}*`:""}${t.height?t.height:""}${"video"===t.decodeMode?`, ${T.$t("wsPlayer.decode.hardware")}`:`, ${T.$t("wsPlayer.decode.software")}`}`),WSPlayerJQ.$(".ws-draw-triangle",this.$el).removeClass(s?"off":"on").addClass(s?"on":"off"),N.call(this,s,100*this.wsPlayer.wsPlayerIndex+this.initIndex,i)},b=function(e,t,s){try{let i="";if(this.wsPlayer.setWSUrl)i=this.wsPlayer.setRedirectWSUrl(e.wsURL,t);else if(s){let s=i=t.split("rtsp://")[1].split("/")[0];i=e.wsURL.split("serverIp=")[0]+"serverIp="+s}else i=e.wsURL.split("://")[0]+t.split("rtsp://")[1].split("/")[0];self.playSDK.StartPullStream({strRtspvUri:i,strRtspvUrl:t,strSourceId:"",bTalkService:!1,nRange:0,nShortTimeout:this.wsPlayer.rtspResponseTimeout||8,nRtspResponseTimeout:this.wsPlayer.rtspResponseTimeout+2||10})}catch(i){console.log("redirect_ws_err:",i)}},D=function(e){if(1==localStorage.WSPlayerLogLevel&&console.log("浏览器资源nPort",e),e>160){this.chromeResourceOutOfMemory=!0,console.warn("浏览器资源不足, 请等待3-5秒后重试"),this.wsPlayer.sendMessage("chromeMemoryOut",{channelData:self.options.channelData,channelInfo:{...options},selectIndex:self.index,message:"浏览器资源不足, 请等待3-5秒后重试"});let e=setTimeout((()=>{this.wsPlayer.close(this.currentIndex,"chromeMemoryOut"),clearTimeout(e)}),10),t=setTimeout((()=>{this.chromeResourceOutOfMemory=!1,clearTimeout(t)}),3e3)}else this.playSDK.nPlayPort=e,window.wsPlayerManager.bindPlayer(this.playSDK.nPlayPort,this.playSDK),window.wsPlayerManager.bindCanvasPlayer(this.canvasId,this.playSDK)},k=function(e){if(this.wsPlayer.config.recordCb||!this.wsPlayer.config.downloadMp4Record){if(this.localRecordbufferLength>e.offset){try{this.localRecordbufferLength+=e.length,this.localRecordList.push({offset:e.offset,buffer:e.data});let{blob:t,file:s,blobUrl:i,form:r}=y.uint8ArraysToFileUrl(this.localRecordList,this.wsPlayer.config.downloadMp4Record?"video/mp4":"application/octet-stream");this.wsPlayer.sendMessage("localRecordFile",{channelData:this.options.channelData,channelInfo:{...this.options},selectIndex:this.options.index,blob:t,file:s,blobUrl:i,form:r})}catch(t){console.log("localRecordFileFailed",t)}return this.localRecordList=[],void(this.localRecordbufferLength=0)}this.localRecordbufferLength+=e.length,this.localRecordList.push({offset:e.offset,buffer:e.data}),this.wsPlayer.sendMessage("localRecordBuf",{channelData:this.options.channelData,channelInfo:{...this.options},selectIndex:this.index,recordBuf:{...e}})}},R=function(e,s,i,r,a){if(5===Number(i))try{let e=new Uint8Array(s),i=new TextDecoder("utf-8").decode(e),r=JSON.parse(i);if(r.Events){if(!r.Events[0].Data)return;let e=r.Events[0].Data.RealtimeData.filter((e=>null!==e)),{curCRawMap:s,curInfoMap:i}=this.getCRawArr(e);if(self.isFirstInfo){console.log("第一次接收"),self.LastCRawMap=s,self.LastCRawInfo=i;let r=self.cRawCanvasElem.clientWidth,a=self.cRawCanvasElem.clientHeight,l=document.createDocumentFragment(),n=$("#"+self.cRawCanvasId);for(let s=0;s{W.call(this,e,t,s,i),clearTimeout(r)}),50);return}this.playSDK.Init({canvasElem:this.canvasElem,videoElem:this.videoElem,ivsCanvasElem:this.ivsCanvasElem,bPlayBack:t,strDecodeFilePath:`${this.wsPlayer.prefixUrl}/WSPlayer/singleThread`},null,this.wsPlayer.config.isWebView);const{platform:r}=navigator;0==r.indexOf("iPhone")?this.playSDK.SetDecodeMode(!1,!1):this.playSDK.SetDecodeMode(s,i),!t&&L.call(this),this.playSDK.m_rtspvHandle=this.playSDK.StartPullStream({strRtspvUri:e.wsURL,strRtspvUrl:e.rtspURL,strSourceId:"",bTalkService:!1,nRange:0,nShortTimeout:this.wsPlayer.rtspResponseTimeout||8,nRtspResponseTimeout:this.wsPlayer.rtspResponseTimeout+2||10}),null!=this.playSDK.m_rtspvHandle&&window.wsPlayerManager.bindHandlePlayer(this.playSDK.m_rtspvHandle,this.playSDK)},E=function(e,s){const{onlyLoadSingleLib:i,useH264MSE:r,useH265MSE:a,useNginxProxy:l,openIvs:n,ivsTypeArr:o}=e;let c=this;this.playSDK=new window.PlaySDKInterface(!i),this.setLogLevel(),this.playSDK.SetCallBack("StreamRedirect",(function(e){b.call(c,s,e,l)})),this.playSDK.SetCallBack("GetPlayPort",(e=>{D.call(c,e)})),this.playSDK.SetCallBack("PlayStart",(e=>{C.call(c,s,e,n,o),c.talkWSUrl=s.wsURL,c.wsPlayer.sendMessage("realSuccess",{channelData:{...s.channelData||{}},channelInfo:{...s},selectIndex:s.selectIndex,customDomId:c.customDomId,streamInfo:{...e}})})),this.playSDK.SetCallBack("DecodeStart",(e=>{})),this.playSDK.SetCallBack("Disconnect",(()=>{c.isclosing=!1,c.isError?c.setLoading(!1,"closed"):c.setStatus("streamError",{errorCode:"410",description:"Video Stream Abnormality"})})),this.playSDK.SetCallBack("VideoFrameInfo",(e=>{c.wsPlayer.sendMessage("getVideoFrameInfo",{channelData:c.options.channelData,channelInfo:c.options,selectIndex:c.index,audioFrameInfo:e})})),this.playSDK.SetCallBack("AudioFrameInfo",(e=>{c.wsPlayer.sendMessage("getAudioFrameInfo",{channelData:c.options.channelData,channelInfo:c.options,selectIndex:c.index,audioFrameInfo:e})})),this.playSDK.SetCallBack("CapturePicDataCallBack",(e=>{if(c.wsPlayer.config.picCapCb)try{const t=c.playSDK.GetCurrentFrameInfo();c.wsPlayer.sendMessage("picCap",{channelData:c.options.channelData,channelInfo:{...s},selectIndex:c.index,base64Img:c.currentWindowPlaying?this.uint8ArrayToBase64(e):"",imgBuf:e,timeStamp:t.utcTimeStamp})}catch(t){console.log("picCap_error",t)}})),this.playSDK.SetCallBack("RecordDataInfo",(e=>{k.call(c,e)})),this.playSDK.SetCallBack("IVSDrawData",((e,t,s,i,r)=>{R.call(this,e,t,s,i,r)})),this.playSDK.SetCallBack("Error",(e=>{if(c.playSDK&&![101,102,103,104,204].includes(Number(e.errorCode))){switch(c.isError=!0,c.setLoading(!1),console.log("Error: "+JSON.stringify(e)),c.setStatus("error",e),String(e.errorCode)){case"100":let e=setTimeout((()=>{c.setLoading(!1,"closed"),c.close(!1,!1,"closed","playSDKError"),clearTimeout(e)}));this.wsPlayer.sendMessage("chromeMemoryOut",{channelData:c.options.channelData,channelInfo:{...s},selectIndex:c.index,message:"浏览器资源不足, 请等待3-5秒后重试"});break;case"409":console.log("%c 服务未推送码流排查步骤:\n1、是否设备离线\n2、是否服务异常导致\n3、设备播放是否为辅码流,辅码流无法播放,可进入平台客户端播放录像查看。\n","color: #fff; background: #07c160;font-size: 18px;")}c.wsPlayer.sendMessage("realError",{selectIndex:s.selectIndex,channelData:{...s.channelData||{}},channelInfo:{...s}},{code:e.errorCode,msg:t.errorVideoInfo[e.errorCode]})}})),W.call(this,s,0,r,a)},M=function(e,s){let i=this;const{useH264MSE:r,useH265MSE:a,onlyLoadSingleLib:l,useNginxProxy:n,ivsTypeArr:o,openIvs:c}=e;this.playSDK=new window.PlaySDKInterface(!l),this.setLogLevel(),this.playSDK.SetCallBack("StreamRedirect",(function(e){b.call(i,s,e,n)})),this.playSDK.SetCallBack("GetPlayPort",(e=>{D.call(i,e)})),this.playSDK.SetCallBack("PlayStart",(e=>{C.call(i,s,e,c,o),i.wsPlayer.selectIndex===i.index&&(WSPlayerJQ.$(".ws-record-play",i.wsPlayer.$el).css({display:"none"}),WSPlayerJQ.$(".ws-record-pause",i.wsPlayer.$el).css({display:"block"})),this.isFirstInfo=!0,i.wsPlayer.sendMessage("recordSuccess",{selectIndex:s.selectIndex,channelData:{...s.channelData||{}},channelInfo:{...s},customDomId:i.customDomId,streamInfo:{...e}})})),this.playSDK.SetCallBack("DecodeStart",(e=>{i.DecodeStart&&i.wsPlayer.config.playCenterRecordByTime&&(i.DecodeStart(),i.DecodeStart=null)})),this.playSDK.SetCallBack("Disconnect",(()=>{i.isError?i.setLoading(!1,"closed"):i.setStatus("streamError",{errorCode:"410",description:"Video Stream Abnormality"})})),this.playSDK.SetCallBack("VideoFrameInfo",(e=>{"playing"===i.status&&i.wsPlayer.__setPlayingTime(i.index,e.nYear,e.nMonth,e.nDay,e.nHour,e.nMinute,e.nSecond),i.wsPlayer.sendMessage("getVideoFrameInfo",{channelData:i.options.channelData,channelInfo:i.options,selectIndex:i.index,videoFrameInfo:e,timeStamp:new Date(e.nYear,e.nMonth-1,e.nDay,e.nHour,e.nMinute,e.nSecond).getTime()/1e3})})),this.playSDK.SetCallBack("AudioFrameInfo",(e=>{i.wsPlayer.sendMessage("getAudioFrameInfo",{channelData:i.options.channelData,channelInfo:i.options,selectIndex:i.index,audioFrameInfo:e})})),this.playSDK.SetCallBack("CapturePicDataCallBack",(e=>{if(i.wsPlayer.config.picCapCb)try{const t=i.playSDK.GetCurrentFrameInfo();i.wsPlayer.sendMessage("picCap",{channelData:i.options.channelData,channelInfo:{...s},selectIndex:i.index,base64Img:i.currentWindowPlaying?this.uint8ArrayToBase64(e):"",imgBuf:e,timeStamp:t.utcTimeStamp})}catch(t){console.log("picCap_error",t)}})),this.playSDK.SetCallBack("RecordDataInfo",(e=>{k.call(i,e)})),this.playSDK.SetCallBack("PlayBackStreamRange",(e=>{try{this.options&&"url"===s.playType&&i.wsPlayer.setTimeLine(s.records),i.wsPlayer.sendMessage("getPlayBackStreamRange",{channelData:i.options.channelData,channelInfo:i.options,selectIndex:i.index,recordRange:e})}catch(t){console.log("playback_range_error",t)}})),this.playSDK.SetCallBack("StreamPlayOver",(e=>{if(console.log("回放播放完成",e),i.options.playRecordByFile)i.wsPlayer.playNextRecordByFile(i.index,(()=>{i.setStatus("recordFinish",{errorCode:"411",description:"Record Finished"})}));else{if(!i.options.playRecordByTime){let e="",t=i.options.ssId,s=i.options.ssIdList||[];if(t&&(e=s[s.indexOf(t)+1]),e)return void i.wsPlayer.playNextRecord(i.index,e)}i.setStatus("recordFinish",{errorCode:"411",description:"Record Finished"})}})),this.playSDK.SetCallBack("IVSDrawData",((e,t,s,i,r)=>{R.call(this,e,t,s,i,r)})),this.playSDK.SetCallBack("Error",(e=>{if(i.playSDK){if(i.isError=!0,[101,102,103,104,204,408].includes(Number(e.errorCode)))return;i.setLoading(!1),console.log("Error: "+JSON.stringify(e)),i.setStatus("error",e),i.wsPlayer.sendMessage("recordError",{selectIndex:s.selectIndex,channelData:{...s.channelData||{}},channelInfo:{...s}},{code:e.errorCode,msg:t.errorVideoInfo[e.errorCode]})}})),W.call(this,s,1,r,a),this.timeLong=s.endTime-s.startTime;let d=this.timeLong%60,h=parseInt(this.timeLong/60)%60,p=parseInt(this.timeLong/3600)%60;this.timeLongStr=`${p>0?p+":":""}${h<10?"0"+h:h}:${d<10?"0"+d:d}`,WSPlayerJQ.$(".time-long",this.$el).text(this.timeLongStr),this.setStatus("ready")},_=function(e,s){this.wsPlayer.isTalking=!0,this.isTalking=!0,WSPlayerJQ.$(".talk-icon",this.$el).removeClass("off").addClass("on");let i=this;this.talkPlaySDK=new window.PlaySDKInterface(!this.wsPlayer.config.onlyLoadSingleLib),this.setLogLevel(),this.talkPlaySDK.SetCallBack("GetPlayPort",(e=>{this.talkPlaySDK.nPlayPort=e,window.wsPlayerManager.bindPlayer(this.talkPlaySDK.nPlayPort,this.talkPlaySDK)})),this.talkPlaySDK.SetCallBack("AVTalkDataSendSuccess",(t=>{WSPlayerJQ.$(".ws-talking",this.$el).html(`${T.$t("wsPlayer.talking")}`),i.wsPlayer.sendMessage("talkSuccess",{selectIndex:e.selectIndex,channelData:{...this.options.channelData||{}},channelInfo:this.options})})),this.talkPlaySDK.SetCallBack("Error",(s=>{i.wsPlayer.sendMessage("talkError",{selectIndex:e.selectIndex,channelData:{...this.options.channelData||{}},channelInfo:this.options},{code:s.errorCode,msg:t.errorVideoInfo[s.errorCode]}),i.stopTalk()})),this.talkPlaySDK.SetCallBack("Disconnect",(e=>{i.stopTalk&&i.stopTalk()})),this.talkPlaySDK.Init({canvasElem:null,videoElem:null,ivsCanvasElem:null,bPlayBack:0,strDecodeFilePath:`${this.wsPlayer.prefixUrl}/WSPlayer/singleThread`});let r=this.talkPlaySDK.StartPullStream({strRtspvUri:e.wsURL||this.talkWSUrl,strRtspvUrl:e.rtspURL+"&trackID=501",strSourceId:"",bTalkService:!0,nRange:0,nShortTimeout:this.wsPlayer.rtspResponseTimeout||8,nRtspResponseTimeout:this.wsPlayer.rtspResponseTimeout+2||10,bBroadcast:Boolean(e.gbDevice)});null!=r&&window.wsPlayerManager.bindHandlePlayer(r,this.talkPlaySDK),"4"===String(s)?this.talkPlaySDK.StartTalk(1):this.talkPlaySDK.StartTalk(0),window.wsPlayerManager.bindPlayer(this.talkPlaySDK.nPlayPort,this.talkPlaySDK),WSPlayerJQ.$(".ws-talking",this.$el).html(`${T.$t("wsPlayer.establishTalk")}`),WSPlayerJQ.$(".ws-talking",this.$el).css({visibility:"visible"}),this.openVolume()},J=function(){if(window.wsAudioPlayer)window.wsAudioPlayer.manualResume("fromTalk");else{let e=setInterval((()=>{window.wsAudioPlayer&&(window.wsAudioPlayer.manualResume("fromTalk"),clearInterval(e))}),100)}},Q=function(e){this.playSDK&&(0===e?(this.playSDK.SetSoundState(!1),WSPlayerJQ.$(".ws-audio",this.$el).removeClass("on").addClass("off"),WSPlayerJQ.$(".audio-icon",this.$el).removeClass("on").addClass("off")):(this.playSDK.SetSoundState(!0),this.playSDK.SetVolume(e>1?1:e),J(),WSPlayerJQ.$(".ws-audio",this.$el).removeClass("off").addClass("on"),WSPlayerJQ.$(".audio-icon",this.$el).removeClass("off").addClass("on")))},N=function(e,t,s){if(this.playSDK)try{e?(this.ivsCanvasElem.style.display="block",this.playSDK.OpenIVS(t),this.playSDK.SetIvsLanguageEnvi("en"===localStorage.getItem("language")?1:0),s.includes(1)||this.playSDK.SetIvsEnable(3,0),s.includes(2)||(this.playSDK.SetIvsEnable(1,0),this.playSDK.SetIvsEnable(14,0))):(this.ivsCanvasElem.style.display="none",this.playSDK.CloseIVS())}catch(i){console.log("set_ivsDraw_error:",i)}};let z=[],F=[];const B=function(e,t,s){return new Promise(((i,r)=>{let a=(e=e.map((e=>t+"://"+e))).filter((e=>z.includes(e)));if(a.length)return void i(a[0]);if(e.every((e=>F.includes(e))))return void r({code:-105,message:T.$t("wsPlayer.auto.recognition.failed")});let l=0,n=t=>{let a,o=new WebSocket(t),c=!1;o.onopen=()=>{c=!0,z.push(t),clearTimeout(a),o.close(),i(e[l-1])},o.onerror=()=>{F.push(t),clearTimeout(a),c=!1,l>=e.length?r({code:-105,message:T.$t("wsPlayer.auto.recognition.failed")}):n(e[l++])},a=setTimeout((()=>{F.push(t),!c&&o.close()}),1e3*s)};n(e[l++])}))},A=function(e,s){if(this.intranetMap)for(let t in this.intranetMap)t.includes(s)&&(s=this.intranetMap[t]);if(!s)return void console.warn("please configure 【streamServerIp】 in new PlayerManager({...})");if(s.includes(":"))return`${e}://${s}`;let i="";return i="wss"===e?"real"===this.type?t.websocketPorts.realmonitor_wss:t.websocketPorts.playback_wss:"real"===this.type?t.websocketPorts.realmonitor_ws:t.websocketPorts.playback_ws,`${e}://${s}:${i}`},U=function(e,s,i){let r="";s.match(/\d{1,3}(\.\d{1,3}){3}/g)&&(r=s.split("//")[1].split(":")[0]);let a="real"===this.type?t.websocketPorts.realmonitor:t.websocketPorts.playback;return this.proxyServerIp?`${e}://${this.proxyServerIp}/${a}?serverIp=${i||r}`:(console.warn("please configure 【proxyServerIp】 in new PlayerManager({...})\n now i use 【location.host】 instead of 【proxyServerIp】 or set configure【localStorage.wsplayerProxyIp】"),`${e}://${localStorage.wsplayerProxyIp||location.host}/${a}?serverIp=${i||r}`)},K=function(e){let{rtspURL:t,streamServerIp:s,wsList:i,playType:r,wssDirect:a,talkData:l}=e;return new Promise(((e,a)=>{if("url"===r)return void e();if(localStorage.wsUrl)return void e(localStorage.wsUrl);if(this.setWSUrl)return void e(this.setWSUrl(i));let l=this.wsProtocol||(this.isHttps?"wss":"ws");"DEVTOOL"===this.ENV&&this.config.useNginxProxy?e(U.call(this,"wss",t,s||this.streamServerIp)):B(i,l,this.WS_TIMEOUT).then((t=>{e(t)})).catch((i=>{if(console.warn(i.message),this.isHttps&&this.config.useNginxProxy&&this.proxyServerIp)return void e(U.call(this,"wss",t,"ICC"===this.ENV&&s||this.streamServerIp||s));let r=A.call(this,l,this.streamServerIp||s);r&&e(r)}))}))},V=function(){let e=parseInt(this.config.maxNum,10);this.maxWindow=e>16?25:e>9?16:e>8?9:e>6?8:e>4?6:e},O=function(e){let t=100/e,s=[];for(var i=0;ithis.maxWindow&&(r=this.maxWindow),this.showNum!==r&&(this.showNum=r,!s&&this.sendMessage("windowNumChanged",this.showNum),setTimeout((()=>{this.__updatePlayerWindow()}),200))},j=function(e,t){let s=WSPlayerJQ.$(`#${this.el} .wsplayer-item`);q(s,this.config.maxNum),H(s,JSON.parse(e)),this.showNum=e,!t&&this.sendMessage("windowNumChanged",this.showNum),setTimeout((()=>{this.__updatePlayerWindow()}),200)},Y=function(e,t,s){WSPlayerJQ.$(`#${this.el}-${t}`).css({top:`${e[s].tStep}%`,left:`${e[s].lStep}%`,width:`${e[s].wStep}%`,height:`${e[s].hStep}%`}),WSPlayerJQ.$(`#${this.el}-${s}`).css({top:`${e[t].tStep}%`,left:`${e[t].lStep}%`,width:`${e[t].wStep}%`,height:`${e[t].hStep}%`});let i=WSPlayerJQ.$(`#${this.el}-${t} .default-status`).css("transform"),r=WSPlayerJQ.$(`#${this.el}-${s} .default-status`).css("transform");WSPlayerJQ.$(`#${this.el}-${t} .default-status`).css({transform:r}),WSPlayerJQ.$(`#${this.el}-${s} .default-status`).css({transform:i}),WSPlayerJQ.$(`#${this.el}-${t}`).attr("id",`${this.el}-temp`),WSPlayerJQ.$(`#${this.el}-${s}`).attr("id",`${this.el}-${t}`).removeClass(`wsplayer-item-${s}`).addClass(`wsplayer-item-${t}`),WSPlayerJQ.$(`#${this.el}-temp`).attr("id",`${this.el}-${s}`).removeClass(`wsplayer-item-${t}`).addClass(`wsplayer-item-${s}`);let a=this.playerList[t];this.playerList[t]=this.playerList[s],this.playerList[s]=a,this.playerList[t].index=t,this.playerList[t].currentIndex=t,this.playerList[t].domId=`${this.el}-${s}`,this.playerList[s].index=s,this.playerList[s].currentIndex=s,this.playerList[s].domId=`${this.el}-${t}`},G=function(e){if(this.currentDragWindowIndex<0||this.currentDragWindowIndex===e)return void(this.currentDragWindowIndex=-1);let s=[];s="number"==typeof this.showNum?t.windowDefaultCustomDivision[this.showNum]?t.windowDefaultCustomDivision[this.showNum]:O(Math.sqrt(this.showNum)):JSON.parse(this.showNum),Y.call(this,s,this.currentDragWindowIndex,e),this.sendMessage("dragWindow",{dragIndex:this.currentDragWindowIndex,dropIndex:e}),this.currentDragWindowIndex===this.selectIndex&&this.setSelectIndex(e),this.currentDragWindowIndex=-1,setTimeout((()=>{this.__updatePlayerWindow()}),200)},Z=function(e){K.call(this,e).then((t=>{e.wsURL=e.wsURL||t,e.playerAdapter=e.playerAdapter||this.playerAdapter;let s=this.playerList[e.selectIndex];s.playType=e.playType,"number"==typeof this.showNum&&e.selectIndex+1{e.wsURL=t})).catch((()=>{})).finally((()=>{t.startTalk(e)}))},te=function(e,t={}){return new Promise(((s,i)=>{let r=this.playerList[e.selectIndex];r?(r.playType=e.playType,K.call(this,e).then((i=>{e.wsURL=e.wsURL||i,e.playerAdapter=e.playerAdapter||this.playerAdapter,WSPlayerJQ.$(".ws-record-play",this.$el).css({display:"none"}),WSPlayerJQ.$(".ws-record-pause",this.$el).css({display:"block"});for(let e in t)r[e]=t[e];r&&r.init(e),s()}))):i()}))};class se{constructor(e){this.$el=null,this.canvasElem=null,this.videoElem=null,this.wrapperDomId=e.wrapperDomId,this.i18n=e.locale,this.isclosing=!1,this.domId=e.wrapperDomId+"-"+e.index,this.canvasId=`${this.domId}-livecanvas`,this.ivsCanvasId=`${this.domId}-ivs-livecanvas`,this.cRawCanvasId=`${this.domId}-cRaw-livecanvas`,this.pztCanvasId=`${this.domId}-pzt-livecanvas`,this.videoId=`${this.domId}-liveVideo`,this.wsPlayer=e.wsPlayer,this.index=e.index,this.initIndex=e.index,this.firstTime=0,this.isAudioPlay=!1,this.speed=1,this.localRecordList=[],this.localRecordbufferLength=0}initDom(){let e=this.getTemplate(),t=WSPlayerJQ.$(e);this.wsPlayer.$wrapper.append(t[0]),this.$el=WSPlayerJQ.$("#"+this.domId),this.canvasElem=document.getElementById(this.canvasId)||{},this.ivsCanvasElem=document.getElementById(this.ivsCanvasId)||{},this.cRawCanvasElem=document.getElementById(this.cRawCanvasId)||{},this.pztCanvasElem=document.getElementById(this.pztCanvasId)||{},this.videoElem=document.getElementById(this.videoId),this.showIcons=this.wsPlayer.config.showIcons||{},this.showIconNum=7,this.showIcons.streamChangeSelect||this.setDomHiddenDeep(WSPlayerJQ.$(".select-container",this.$el),!1),this.showIcons.replayIcon||(this.setDomHiddenDeep(WSPlayerJQ.$(".ws-refresh-replay",this.$el),!1),this.showIconNum--),this.showIcons.ivsIcon||(this.setDomHiddenDeep(WSPlayerJQ.$(".ws-draw-triangle",this.$el),!1),this.showIconNum--),this.setTalkIconShow(),this.showIcons.audioIcon||(this.setDomHiddenDeep(WSPlayerJQ.$(".ws-audio",this.$el),!1),this.showIconNum--),this.showIcons.snapshotIcon||(this.setDomHiddenDeep(WSPlayerJQ.$(".ws-capture",this.$el),!1),this.showIconNum--),this.showIcons.localRecordIcon||(this.setDomHiddenDeep(WSPlayerJQ.$(".ws-record",this.$el),!1),this.showIconNum--),this.showIcons.closeIcon||(this.setDomHiddenDeep(WSPlayerJQ.$(".ws-close",this.$el),!1),this.showIconNum--),this.showMoreIcon=!1}setTalkIconShow(){let{talkIcon:e}=this.wsPlayer.config.showIcons||{},t=location.protocol;e&&"https:"===t&&"real"===this.wsPlayer.type?WSPlayerJQ.$(".ws-talk",this.$el).css({display:""}):(this.setDomHiddenDeep(WSPlayerJQ.$(".ws-talk",this.$el),!1),this.showIconNum--)}initMouseEvent(){this.$el.click((e=>{this.wsPlayer.setSelectIndex(this.index),this.$el.siblings().removeClass("selected").addClass("unselected"),this.$el.removeClass("unselected").addClass("selected")})),this.$el.dblclick((e=>{if(1===this.wsPlayer.options.config.maxNum)return;if(1!==this.wsPlayer.showNum){this.wsPlayer.beforeShowNum=this.wsPlayer.showNum;let e=WSPlayerJQ.$(`#${this.wrapperDomId} .wsplayer-item`);q(e,this.wsPlayer.options.config.maxNum),WSPlayerJQ.$(`#${this.wrapperDomId}-${this.index}`).css({top:0,left:0,width:"100%",height:"100%",visibility:"visible"}),this.wsPlayer.showNum=1}else this.wsPlayer.setPlayerNum(this.wsPlayer.beforeShowNum,!0);this.wsPlayer.setSelectIndex(this.index),this.$el.siblings().removeClass("selected").addClass("unselected"),this.$el.removeClass("unselected").addClass("selected");let t=setTimeout((()=>{this.wsPlayer.__updatePlayerWindow(),clearTimeout(t)}),200);this.wsPlayer.sendMessage("dblclickWindow",{selectIndex:this.index,showNum:this.wsPlayer.showNum,channelInfo:{...this.options},channelData:this.options&&this.options.channelData})})),WSPlayerJQ.$(".ws-audio",this.$el).click((e=>{if(this.currentWindowPlaying){if(this.wsPlayer.isTalking&&this.isTalking&&this.gbTalk);else if(this.wsPlayer.isTalking)return void this.wsPlayer.sendErrorMessage(this.isTalking?"301":"302");if(this.isAudioPlay)this.closeVolume();else{if("record"===this.wsPlayer.type&&![.25,.5,1,1.25,1.5,2,4].includes(Number(this.speed)))return void this.wsPlayer.sendErrorMessage("204",{insert:[this.speed]});this.openVolume()}}})),WSPlayerJQ.$(".ws-refresh-replay",this.$el).click((e=>{"url"===this.wsPlayer.playerList[this.index].playType?this.wsPlayer.sendMessage("refreshReplay",{selectIndex:this.options.selectIndex,channelInfo:{...this.options},channelData:{...this.options.channelData||{}}}):"real"===this.wsPlayer.type?this.wsPlayer.playRealVideo({channelList:[{...this.options.channelData}],streamType:this.options.streamType,windowIndex:this.index,closeReason:"refreshWindow"}):this.wsPlayer.playRecordVideo({channelList:[{...this.options.channelData}],startTime:this.options.startTime,endTime:this.options.endTime,recordSource:this.options.recordSource,streamType:this.options.streamType,recordType:this.options.recordType,windowIndex:this.index,playRecordByFile:this.options.playRecordByFile,closeReason:"refreshWindow"})})),WSPlayerJQ.$(".ws-draw-triangle",this.$el).click((e=>{this.currentWindowPlaying&&(e.target.getAttribute("class").includes("off")?(WSPlayerJQ.$(".ws-draw-triangle",this.$el).removeClass("off").addClass("on"),WSPlayerJQ.$(".draw-triangle-icon",this.$el).removeClass("off").addClass("on"),N.call(this,!0,100*this.wsPlayer.wsPlayerIndex+this.options.selectIndex,this.wsPlayer.config.ivsTypeArr)):(WSPlayerJQ.$(".ws-draw-triangle",this.$el).removeClass("on").addClass("off"),WSPlayerJQ.$(".draw-triangle-icon",this.$el).removeClass("on").addClass("off"),this.playSDK.CloseIVS()))}));WSPlayerJQ.$(".ws-talk",this.$el).click(y.throttle((e=>{if(this.currentWindowPlaying)if("http:"!==location.protocol)if(this.wsPlayer.isTalking&&!this.isTalking)this.wsPlayer.sendErrorMessage("303");else if(this.isTalking)this.stopTalk();else{const{selectIndex:e,channelData:t}=this.options;if(this.options&&"url"===this.options.playType)return void this.wsPlayer.sendMessage("notifyTalk",{selectIndex:e,channelData:{...t},channelInfo:{...this.options}});J(),this.setAuthority({channelCode:this.options.channelData?this.options.channelData.channelCode:this.options.channelId,function:"3"},(()=>{this.wsPlayer.__startTalk(this.options.channelData,this.index)}),(s=>{1103===s.code&&this.wsPlayer.sendErrorMessage(401,{selectIndex:e,channelData:{...t},type:"talk"})}))}else this.wsPlayer.sendErrorMessage("305")}),2e3)),WSPlayerJQ.$(".ws-capture",this.$el).click((e=>{this.currentWindowPlaying&&this.setAuthority({channelCode:this.options.channelData?this.options.channelData.channelCode:this.options.channelId,function:"4"},(()=>{this.picCap()}),(e=>{1103===e.code&&this.wsPlayer.sendErrorMessage(401,{type:"capture"})}))})),WSPlayerJQ.$(".ws-close",this.$el).click((e=>{this.close(!1,!1,"closed","btnClick")})),WSPlayerJQ.$(".ws-record",this.$el).click((e=>{if(!this.currentWindowPlaying)return;let t=(this.options.channelData||{}).name||this.i18n.$t("wsPlayer.recording");this.isRecording?this.stopRecord("btnClick"):"playing"===this.status&&this.setAuthority({channelCode:this.options.channelData?this.options.channelData.channelCode:this.options.channelId,function:"8"},(()=>{this.isRecording=!0,this.startRecord(`${this.i18n.$t("wsPlayer.video")}_${t}_${y.getDateFormatByUnderline()}`),WSPlayerJQ.$(".ws-record",this.$el).addClass("recording")}),(e=>{1103===e.code&&this.wsPlayer.sendErrorMessage(401,{type:"record"})}))})),WSPlayerJQ.$(".more-icon",this.$el).click((e=>{this.showMoreIcon=!this.showMoreIcon,this.setDomVisible(WSPlayerJQ.$(".opt-icons-vertical",this.$el),this.showMoreIcon)})),WSPlayerJQ.$(".cRaw-container",this.$el).click((e=>{let t=e.target.dataset&&e.target.dataset.pid;if(t){"hidden"===WSPlayerJQ.$(`#${t} .ws-tag-content`,this.$el).css("visibility")?(this.setTagContentPosition(t),WSPlayerJQ.$(`#${t} .ws-tag-content`,this.$el).css("visibility","visible"),WSPlayerJQ.$(`#${t} .ws-tag-title`,this.$el).css("max-width","180px")):(WSPlayerJQ.$(`#${t} .ws-tag-content`,this.$el).css("visibility","hidden"),WSPlayerJQ.$(`#${t} .ws-tag-title`,this.$el).css("max-width",""))}})),this.wsPlayer.config.draggable&&(this.$el.on("mousedown",(e=>{this.wsPlayer.currentDragWindowIndex=this.currentIndex,e.preventDefault()})),this.$el.on("mouseup",(e=>{G.call(this.wsPlayer,this.currentIndex),e.preventDefault()})))}setLoading(e,t,s){this.spinner&&this.spinner.stop(),e&&["playing","pause"].includes(this.status)&&this.close(!1,!1,"closed",s||"changeStream"),t&&this.setStatus(t),e&&(this.spinner=new w({color:"#ffffff"}).spin(this.$el[0]))}picCap(e){let t=e;if(!t){let e=(this.options.channelData||{}).name||"";t=`${this.i18n.$t("wsPlayer.capture")}_${e}_${y.getDateFormatByUnderline()}`}this.playSDK.CapturePic(this.wsPlayer.config.picCapCb?null:t+".png")}startRecord(e,t,s){const{downloadMp4Record:i,localRecordSize:r}=this.wsPlayer.config;let a="boolean"==typeof s?s:i;a=!localStorage.playSDKLogLevel&&a;let l=t||r,n=`${e}.${a?"mp4":"dav"}`;this.playSDK.StartRecord(a?5:0,l,this.wsPlayer.config.recordCb?null:n)}stopRecord(e){this.isRecording=!1,this.playSDK.StopRecord(),WSPlayerJQ.$(".ws-record",this.$el).removeClass("recording")}closeOtherAudio(){this.wsPlayer.playerList.forEach((e=>{e.isAudioPlay&&e.closeVolume()}))}openVolume(e=1){this.closeOtherAudio(),Q.call(this,e),this.isAudioPlay=!0}closeVolume(){Q.call(this,0),this.isAudioPlay=!1}setAuthority(e,t,s){this.wsPlayer.fetchChannelAuthority?this.wsPlayer.fetchChannelAuthority(e).then((e=>{e.data.result&&t()})).catch((e=>{s(e)})):t()}showMsgInWindow(e){this.setDomVisible(this.defaultStatus,!1),WSPlayerJQ.$(".wsplayer-error-message",this.$el).text(e),this.setDomVisible(this.error,!0)}play(){this.playSDK.Pause(0),this.playSDK.SetSpeed(this.speed),this.setStatus("playing"),WSPlayerJQ.$(".ws-record-play",this.wsPlayer.$el).css({display:"none"}),WSPlayerJQ.$(".ws-record-pause",this.wsPlayer.$el).css({display:""})}pause(){this.playSDK.Pause(1),this.setStatus("pause"),WSPlayerJQ.$(".ws-record-pause",this.wsPlayer.$el).css({display:"none"}),WSPlayerJQ.$(".ws-record-play",this.wsPlayer.$el).css({display:""})}close(e=!1,t=!1,s="closed",i="unknown"){if(this.currentWindowPlaying=!1,this.setDomVisible(WSPlayerJQ.$(".play-pause-wrapper",this.$el),!1),this.videoElem.style.display="none",this.canvasElem.style.display="none",this.ivsCanvasElem.style.display="none",this.customDomElem&&this.customDomElem.css("display","none"),this.wsPlayer.playerList.forEach((e=>{e.closeCRaw()})),this.isTalking&&!t&&this.stopTalk(),this.speed=1,this.index===this.wsPlayer.selectIndex&&("real"===this.wsPlayer.type?!e&&this.wsPlayer.setPtzChannel():(this.wsPlayer.setTimeLine([]),this.wsPlayer.__setPlaySpeed(),WSPlayerJQ.$(".ws-record-play",this.wsPlayer.$el).css({display:""}),WSPlayerJQ.$(".ws-record-pause",this.wsPlayer.$el).css({display:"none"}))),this.isRecording&&this.stopRecord("closeVideo"),this.wsPlayer.config.openIvs&&this.playSDK)try{this.playSDK.CloseIVS()}catch(r){console.debug("关闭规则线")}this.spinner&&this.spinner.stop(),WSPlayerJQ.$(".stream-info",this.$el).text(""),this.wsPlayer.videoClosed(this.index,e,{...this.options&&this.options.channelData||{}},this.customDomId,i),this.isclosing=["windowDestroy"].includes(i),this.playSDK&&(this.playSDK.StopPullStream(),this.playSDK.Stop(),window.wsPlayerManager.unbindPlayer(this.playSDK.nPlayPort),window.wsPlayerManager.unbindHandlePlayer(this.playSDK.m_rtspvHandle),window.wsPlayerManager.unbindCanvasPlayer(this.canvasId)),e||(this.playSDK=null,this.options=null),this.setStatus(s)}setDomVisible(e,t){e&&e.css({visibility:t?"visible":"hidden"})}setDomDisplay(e,t){e&&e.css({display:t?"":"none"})}setDomHiddenDeep(e,t){e&&(t?e.removeClass("hidden-deep"):e.addClass("hidden-deep"))}setLogLevel(){this.playSDK.SetPrintLogLevel&&this.playSDK.SetPrintLogLevel(localStorage.playSDKLogLevel)}uint8ArrayToBase64(e){if(!e||0===e.byteLength)return"";let t="",s=e.byteLength;for(let i=0;io?l=t/s+"px":s{this.wsPlayer.playerList.forEach((e=>{"playing"===e.status&&e.setCRawTagsPos()})),clearTimeout(e)}),100)}}renderDefaultStats(){let e=WSPlayerJQ.$(".default-status",this.$el),t=e.width(),s=e.height(),i=WSPlayerJQ.$(".wsplayer-error-message",this.$el);t&&s&&(t<100||s<100?(e.css({transform:"scale(0.3)"}),i.css({transform:"scale(0.3)"})):t<200||s<200?(e.css({transform:"scale(0.5)"}),i.css({transform:"scale(0.5)"})):(e.css({transform:"scale(1)"}),i.css({transform:"scale(1)"})))}getCRawTemplate(e=!1,t,s,i,r,a,l){let n=t.split("|"),o="",c="";for(let p=0;p${n[p]}
`;let{prefixUrl:d}=this.wsPlayer,h=`\n \n
\n
\n
\n
\n ${s}\n
\n
\n ${o}\n
\n
`;return c=e?h:`\n \n ${h}\n
`,c}setTagContentPosition(e){if(!e)return;let t=WSPlayerJQ.$(`#${this.cRawCanvasId}`,this.$el).outerHeight(),s=WSPlayerJQ.$(`#${this.cRawCanvasId}`,this.$el).outerWidth(),i=WSPlayerJQ.$(`#${e}`,this.$el),r=i[0].offsetTop,a=i[0].offsetLeft,l=t-r-i.innerHeight(),n=WSPlayerJQ.$(`#${e} .ws-tag-content`,this.$el),o=n.innerHeight(),c=n.innerWidth(),d=64;ll&&(d=-o);let h=42;a+h+c>s&&(h=s-a-c),WSPlayerJQ.$(`#${e} .ws-tag-content`,this.$el).css("top",`${d}px`),WSPlayerJQ.$(`#${e} .ws-tag-content`,this.$el).css("left",`${h}px`)}getCRawArr(e){let t={},s={};for(let i=0;i!s.includes(e))),a=s.filter((t=>!e.includes(t))),l=e.filter((e=>s.includes(e)));if(r.length)for(let t=0;t28*this.showIconNum+i)this.setDomDisplay(WSPlayerJQ.$(".more-icon",this.$el),!1),this.setDomDisplay(WSPlayerJQ.$(".stream-info",this.$el),!0),t.iconConfig.forEach(((e,t)=>{this.setDomDisplay(WSPlayerJQ.$(`.opt-icons > .${e.buttonParentClass}`,this.$el),!0)}));else if(r>28*this.showIconNum)this.setDomDisplay(WSPlayerJQ.$(".more-icon",this.$el),!1),this.setDomDisplay(WSPlayerJQ.$(".stream-info",this.$el),!1),t.iconConfig.forEach(((e,t)=>{this.setDomDisplay(WSPlayerJQ.$(`.opt-icons > .${e.buttonParentClass}`,this.$el),!0)}));else{let e=Math.floor(r/28);this.setDomDisplay(WSPlayerJQ.$(".stream-info",this.$el),!1),this.setDomDisplay(WSPlayerJQ.$(".more-icon",this.$el),!0),t.iconConfig.forEach(((t,s)=>{e>s+2?(this.setDomDisplay(WSPlayerJQ.$(`.opt-icons > .${t.buttonParentClass}`,this.$el),!0),this.setDomDisplay(WSPlayerJQ.$(`.opt-icons-vertical > .${t.buttonParentClass}`,this.$el),!1)):(this.setDomDisplay(WSPlayerJQ.$(`.opt-icons > .${t.buttonParentClass}`,this.$el),!1),this.setDomDisplay(WSPlayerJQ.$(`.opt-icons-vertical > .${t.buttonParentClass}`,this.$el),!0))}))}}}const ie=[3600,1800,900,300];const re=class{constructor(e){this.records=e.records||[],this.currentTime=Number(e.currentTime),this.getCurrentTime=e.getCurrentTime,this.rulerCanvas=null,this.rulerCtx=null,this.canvas_middle_length=0,this.rulerLength=e.rulerLength||{short:15,middle:25,long:40},this.canvasBgColor="transparent",this.rulerColor="#afafaf",this.textColor="#fff",this.recordsColor="#318efd",this.alarmRecordsColor="#f64153",this.cursorColor="#fff",this.oldScaleInfo={scale_step:this.scale_step,scale_step_offsetX:this.scale_step_offsetX},this.scale_step=5*e.rulerScale||10,this.scale_step_offsetX=this.scale_step%30,this.time_ruler_line=ie[0],this.move_1px_time=1,this.moveCurrentTime=0,this.move_offset=0,this.isMouseDown=!1,this.initRuler(e)}initRuler(e){if(!e.canvasId)return e.onError&&e.onError({code:801,message:"请传入canvas的id"});this.rulerCanvas=document.querySelector(e.canvasId),this.rulerCtx=this.rulerCanvas.getContext("2d"),this.canvas_middle_length=Math.floor(this.rulerCanvas.width/2),this.initDrawLine(),this.addEventListener()}initDrawLine(){this.clearRuler(),this.rulerCtx.fillStyle=this.canvasBgColor,this.rulerCtx.fillRect(0,0,this.rulerCanvas.width,this.rulerCanvas.height),this.setScaleStepOffset(),this.setMoveTime(),!this.isMouseDown&&this.getMoveOffset(),this.renderRecordList(),this.renderLeftRuler(),this.renderRightRuler(),this.drawMarkRuler()}updateProgress(e){e&&(e.currentTime||e.records&&e.records.length)?(this.records=e.records||this.records,this.currentTime=e.currentTime||this.records&&this.records[0]&&this.records[0].startTime||this.currentTime,this.initDrawLine()):(this.currentTime=this.currentTime||0,this.records=[],this.initDrawLine())}addEventListener(){let e,t=null;const s=e=>{e.preventDefault&&e.preventDefault(),t=null,this.isMouseDown=!1,0!==this.moveCurrentTime&&(this.currentTime=this.currentTime-this.moveCurrentTime,this.moveCurrentTime=0,this.initDrawLine(),this.getCurrentTime&&this.getCurrentTime(parseInt(this.currentTime)))},i=e=>{e.preventDefault&&e.preventDefault(),t=null,this.isMouseDown=!1,this.currentTime=this.currentTime-this.moveCurrentTime,this.moveCurrentTime=0,this.initDrawLine()},r=e=>{e.preventDefault&&e.preventDefault(),this.isMouseDown||(this.oldScaleInfo={scale_step:this.scale_step,scale_step_offsetX:this.scale_step_offsetX},(e.deltaY<0||e.wheelDelta>0)&&(this.scale_step+=5,this.scale_step>=120&&(this.scale_step=115)),(e.deltaY>0||e.wheelDelta<0)&&(this.scale_step-=5,this.scale_step<10&&(this.scale_step=10)),this.initDrawLine())},a=s=>{if(s.preventDefault&&s.preventDefault(),s.touches&&2===s.touches.length&&null!==t){this.isMouseDown=!1;const e=s.touches[0],i=s.touches[1],a=this.calculateDistance(e,i);return r({wheelDelta:a/t-1}),void(t=a)}if(this.isMouseDown){let t=0;"movementX"in s?t=s.movementX:(t=(s.touches[0].clientX-e)/5,e=s.touches[0].clientX),this.move_offset+=t,this.moveCurrentTime+=t*this.move_1px_time,this.initDrawLine()}};this.rulerCanvas.addEventListener("touchstart",(s=>{if(s.preventDefault&&s.preventDefault(),s.touches&&2===s.touches.length){const e=s.touches[0],i=s.touches[1];t=this.calculateDistance(e,i)}else e=s.touches[0].clientX,this.isMouseDown=!0})),this.rulerCanvas.addEventListener("mousedown",(t=>{e=t.clientX,this.isMouseDown=!0})),this.rulerCanvas.addEventListener("touchmove",function(e,t=160){var s,i,r=0;return function(){var a=+new Date;s=this,i=arguments,a-r>t&&(e.apply(s,i),r=a)}}(a)),this.rulerCanvas.addEventListener("mousemove",a),this.rulerCanvas.addEventListener("mouseup",s),this.rulerCanvas.addEventListener("touchend",s),this.rulerCanvas.addEventListener("mouseleave",i),this.rulerCanvas.addEventListener("touchleave",i),this.rulerCanvas.addEventListener("mouseout",i),this.rulerCanvas.addEventListener("mousewheel",r);let l=()=>{this.rulerCanvas.width===this.rulerCanvas.getBoundingClientRect().width&&this.rulerCanvas.height===this.rulerCanvas.getBoundingClientRect().height||(this.rulerCanvas.width=this.rulerCanvas.getBoundingClientRect().width,this.rulerCanvas.height=this.rulerCanvas.getBoundingClientRect().height,this.canvas_middle_length=Math.floor(this.rulerCanvas.width/2),this.initDrawLine()),window.requestAnimationFrame(l)};window.requestAnimationFrame(l)}calculateDistance(e,t){return t.clientX-e.clientX}clearRuler(){this.rulerCtx&&this.rulerCtx.clearRect(0,0,this.rulerCanvas.width,this.rulerCanvas.height)}setScaleStepOffset(){this.scale_step_offsetX=this.scale_step%30,this.scale_step_offsetX<10&&(this.scale_step_offsetX=10)}setMoveTime(){this.time_ruler_line=ie[Math.floor((this.scale_step+1)/30)],this.move_1px_time=this.time_ruler_line/10/this.scale_step_offsetX}getMoveOffset(){this.move_offset=-Math.floor(this.currentTime%this.time_ruler_line/this.move_1px_time)}renderLeftRuler(){let e=0;for(;e<=this.canvas_middle_length+this.move_offset;){let t=this.canvas_middle_length+this.move_offset-e;e/this.scale_step_offsetX%10==0?(this.drawRulerLine(t,this.rulerLength.long),this.rulerCtx.fillStyle=this.textColor,this.rulerCtx.fillText(this.getRenderTime(0-e),t,this.rulerLength.long+10)):e/this.scale_step_offsetX%10==5?this.drawRulerLine(t,this.rulerLength.middle):this.drawRulerLine(t,this.rulerLength.short),e+=this.scale_step_offsetX}}renderRightRuler(){let e=0;for(;e<=this.canvas_middle_length-this.move_offset;){let t=this.canvas_middle_length+this.move_offset+e;e/this.scale_step_offsetX%10==0?(this.drawRulerLine(t,this.rulerLength.long),this.rulerCtx.fillStyle=this.textColor,this.rulerCtx.fillText(this.getRenderTime(e),t,this.rulerLength.long+10)):e/this.scale_step_offsetX%10==5?this.drawRulerLine(t,this.rulerLength.middle):this.drawRulerLine(t,this.rulerLength.short),e+=this.scale_step_offsetX}}getRenderTime(e){let t=this.currentTime-this.currentTime%this.time_ruler_line;return this.formatter(1e3*(t+e*this.move_1px_time),"HH:mm")}drawRulerLine(e,t,s=this.rulerColor){this.rulerCtx.beginPath(),this.rulerCtx.strokeStyle=s,this.rulerCtx.moveTo(e,0),this.rulerCtx.lineTo(e,t),this.rulerCtx.stroke(),this.rulerCtx.closePath()}renderRecordList(){let e=this.records.filter((e=>!e.isImportant)),t=this.records.filter((e=>e.isImportant));this.renderRecordOnCanvas(e,"records"),this.renderRecordOnCanvas(t,"alarmRecords")}renderRecordOnCanvas(e,t){let s=this.currentTime-this.moveCurrentTime,i=s-this.canvas_middle_length*this.move_1px_time,r=s+this.canvas_middle_length*this.move_1px_time,a=0;this.rulerCtx.beginPath(),e.forEach((e=>{e.endTimer||(e.endTimei?(a=e.startTimei&&e.startTimer?r:e.endTime,this.rulerCtx.fillStyle=this[`${t}Color`],this.rulerCtx.fillRect(this.canvas_middle_length-(s-e.startTime)/this.move_1px_time,0,(a-e.startTime)/this.move_1px_time,this.rulerCanvas.height)):e.startTimer&&(this.rulerCtx.fillStyle=this[`${t}Color`],this.rulerCtx.fillRect(0,0,this.rulerCanvas.width,this.rulerCanvas.height)))})),this.rulerCtx.closePath()}drawMarkRuler(){this.rulerCtx.beginPath(),this.rulerCtx.strokeStyle=this.cursorColor,this.rulerCtx.moveTo(this.canvas_middle_length-2,0),this.rulerCtx.lineTo(this.canvas_middle_length+2,0),this.rulerCtx.lineTo(this.canvas_middle_length,8),this.rulerCtx.lineTo(this.canvas_middle_length-2,0),this.rulerCtx.stroke(),this.rulerCtx.fillStyle=this.cursorColor,this.rulerCtx.fill(),this.rulerCtx.closePath(),this.rulerCtx.fillStyle=this.textColor,this.rulerCtx.fillText(this.formatter(1e3*(this.currentTime-this.moveCurrentTime),"YYYY-MM-DD HH:mm:ss"),this.canvas_middle_length-55,this.rulerCanvas.height-10)}addZero(e){return e<10?"0"+e:e}formatter(e,t){let s=(e=new Date(e)).getFullYear(),i=this.addZero(e.getMonth()+1),r=this.addZero(e.getDate()),a=this.addZero(e.getHours()),l=this.addZero(e.getMinutes()),n=this.addZero(e.getSeconds()),o="";switch(t){case"YYYY-MM-DD HH:mm:ss":o=`${s}-${i}-${r} ${a}:${l}:${n}`;break;case"HH:mm":o=`${a}:${l}`}return o}},ae=100;let le,ne,oe=null,ce=20,de={},he=!0,pe="",ye={x:0,y:0},ue=[],me={},we={},fe=0,Pe="",ge=()=>{try{le.removeEventListener("selectstart",ve),le.removeEventListener("mousemove",Se),le.removeEventListener("mouseup",$e),le.addEventListener("selectstart",ve),le.addEventListener("mousemove",Se),le.addEventListener("mouseup",$e)}catch(e){let t=setTimeout((()=>{ge(),clearTimeout(t)}),300)}};function ve(e){return e.preventDefault(),!1}function Se(e){if(!pe)return;e.preventDefault();let t=ne.getBoundingClientRect(),s=t.width/ae,i=t.height/ae;switch(pe){case"right-border":if(ye.x+=e.movementX,fe!==Math.round(ye.x/s)){if(fe=Math.round(ye.x/s),we.lStep+fe<=0)return void(fe=1-we.lStep);if(we.lStep+fe>=ae)return void(fe=ae-we.lStep-1);document.querySelector("#division-move-line").style.left=1*(we.lStep+fe)+"%"}break;case"bottom-border":if(ye.y+=e.movementY,fe!==Math.round(ye.y/i)){if(fe=Math.round(ye.y/i),we.tStep+fe<=0)return void(fe=1-we.tStep);we.tStep+fe>=ae&&(fe=ae-we.tStep-1),document.querySelector("#division-move-line").style.top=1*(we.tStep+fe)+"%"}}}function $e(e){if(pe){e.preventDefault();let t=[],s=!0;switch(pe){case"right-border":if(!fe)return;let{l_window:e,r_window:i}=me;if(t=[...e.map((e=>(e.wStep-=fe,e.lStep+=fe,e.wStep<1&&(s=!1),e))),...i.map((e=>(e.wStep+=fe,e.wStep<1&&(s=!1),e)))],!s)return pe="",document.querySelector("#division-move-line").remove(),ke(),void de.onError(oe.$t("wsPlayer.drag.tip"));t.forEach((e=>ue[e.selectIndex]=e));break;case"bottom-border":if(!fe)return;let{t_window:r,b_window:a}=me;if(t=[...r.map((e=>(e.hStep-=fe,e.tStep+=fe,e.hStep<1&&(s=!1),e))),...a.map((e=>(e.hStep+=fe,e.hStep<1&&(s=!1),e)))],!s)return pe="",document.querySelector("#division-move-line").remove(),ke(),void de.onError(oe.$t("wsPlayer.drag.tip"));t.forEach((e=>ue[e.selectIndex]=e))}pe="",ke()}}function xe(e=[]){if(!e.length||1===e.length)return ue=[{wStep:ae,hStep:ae,tStep:0,lStep:0,selectIndex:0}],ue;e=e.sort(((e,t)=>e.tStep-t.tStep));for(let t=0;te[t+1].lStep){let s={...e[t]};e[t]={...e[t+1]},e[t+1]=s}return e.map(((e,t)=>(e.selectIndex=t,e)))}function Ie(e,t){let s=document.querySelector("#temp-preview-line");s.style.display="block",s.style.background="#1d79f4",s.style.opacity=.4,"col"===t&&(s.style.left=`${Math.floor(e.lStep+e.wStep/2)}%`,s.style.top=`${e.tStep}%`,s.style.width="2px",s.style.height=`${e.hStep}%`),"raw"===t&&(s.style.left=`${e.lStep}%`,s.style.top=`${Math.floor(e.tStep+e.hStep/2)}%`,s.style.width=`${e.wStep}%`,s.style.height="2px")}function Te(e,t){ue.length!==ce?1===e.wStep&&1===e.hStep||("col"===t&&(ue.push({...e,lStep:e.lStep+Math.floor(e.wStep/2),wStep:Math.ceil(e.wStep/2)}),ue[e.selectIndex]={...e,wStep:Math.floor(e.wStep/2)}),"raw"===t&&(ue.push({...e,tStep:e.tStep+Math.floor(e.hStep/2),hStep:Math.ceil(e.hStep/2)}),ue[e.selectIndex]={...e,hStep:Math.floor(e.hStep/2)}),ke()):de.onError(oe.$t("wsPlayer.custom.player.max.support.tip",[ce]))}function Ce(e,t){let s="";return"x"===t&&(s=``),"y"===t&&(s=``),s}function be(e){return``}function De(e=[]){he=!1;let t=[];e.forEach((e=>{t.push(be({selectIndex:e.selectIndex,width:1*e.wStep,height:1*e.hStep,top:1*e.tStep,left:1*e.lStep}))})),ne.innerHTML=t.join("")+'',e.forEach((e=>{document.querySelector(`#dom-item-${e.selectIndex}-btn-raw`).addEventListener("click",(()=>{Te(e,"raw")})),document.querySelector(`#dom-item-${e.selectIndex}-btn-col`).addEventListener("click",(()=>{Te(e,"col")})),document.querySelector(`#dom-item-${e.selectIndex}-delete-btn`).addEventListener("click",(()=>{!function(e){if(1===ue.length)return void de.onError(oe.$t("wsPlayer.current.window.cannot.be.merged"));let t=ue.findIndex((t=>t.wStep===e.wStep&&t.lStep===e.lStep&&(t.tStep+t.hStep===e.tStep||e.tStep+e.hStep===t.tStep)||t.hStep===e.hStep&&t.tStep===e.tStep&&(t.lStep+t.wStep===e.lStep||e.lStep+e.wStep===t.lStep)));if(t>-1){let s=ue[t];s.tStep===e.tStep&&(s.selectIndex>e.selectIndex?(ue[e.selectIndex].wStep=e.wStep+s.wStep,ue.splice(s.selectIndex,1)):(ue[s.selectIndex].wStep=s.wStep+e.wStep,ue.splice(e.selectIndex,1))),s.lStep===e.lStep&&(s.selectIndex>e.selectIndex?(ue[e.selectIndex].hStep=e.hStep+s.hStep,ue.splice(s.selectIndex,1)):(ue[s.selectIndex].hStep=s.hStep+e.hStep,ue.splice(e.selectIndex,1)))}else de.onError(oe.$t("wsPlayer.current.window.cannot.be.merged"));ke()}(e)})),document.querySelector(`#dom-item-${e.selectIndex}-btn-raw`).addEventListener("mouseenter",(t=>{Ie(e,"raw")})),document.querySelector(`#dom-item-${e.selectIndex}-btn-raw`).addEventListener("mouseleave",(e=>{document.querySelector("#temp-preview-line").style.display="none"})),document.querySelector(`#dom-item-${e.selectIndex}-btn-col`).addEventListener("mouseenter",(t=>{Ie(e,"col")})),document.querySelector(`#dom-item-${e.selectIndex}-btn-col`).addEventListener("mouseleave",(e=>{document.querySelector("#temp-preview-line").style.display="none"})),document.querySelector(`#dom-item-${e.selectIndex}-right-border`).addEventListener("mousedown",(t=>{t.stopPropagation(),e.lStep+e.wStep!==ae&&(pe="right-border",ye={x:0},fe=0,me=function({wStep:e,lStep:t,selectIndex:s},i){let r=i.filter((s=>s.lStep+s.wStep===t+e)).sort(((e,t)=>e.tStep-t.tStep)),a=i.filter((s=>s.lStep===t+e)).sort(((e,t)=>e.tStep-t.tStep));for(var l=0;l{let t=r.findIndex((t=>e.tStep===t.tStep)),s=r.findLastIndex((t=>e.tStep+e.hStep===t.tStep+t.hStep));t>-1&&(n=0===t?0:Math.min(t,n)),s>-1&&(o=Math.max(s,o))})),a=a.filter((e=>e.tStep>=r[n].tStep&&e.tStep+e.hStep<=r[o].tStep+r[o].hStep)),{l_window:a,r_window:r}}({...e},JSON.parse(JSON.stringify(ue))),we={hStep:me.r_window.reduce(((e,t)=>e+t.hStep),0),tStep:me.r_window[0].tStep,lStep:me.l_window[0].lStep},Pe=Ce(we,"x"),ne.innerHTML+=Pe)})),document.querySelector(`#dom-item-${e.selectIndex}-bottom-border`).addEventListener("mousedown",(t=>{e.tStep+e.hStep!==ae&&(pe="bottom-border",ye={y:0},fe=0,me=function({hStep:e,tStep:t,selectIndex:s},i){let r=i.filter((s=>s.tStep+s.hStep===t+e)).sort(((e,t)=>e.lStep-t.lStep)),a=i.filter((s=>s.tStep===t+e)).sort(((e,t)=>e.lStep-t.lStep));for(var l=0;l{let t=r.findIndex((t=>e.lStep===t.lStep)),s=r.findLastIndex((t=>e.lStep+e.wStep===t.lStep+t.wStep));t>-1&&(n=0===t?0:Math.min(t,n)),s>-1&&(o=Math.max(s,o))})),a=a.filter((e=>e.lStep>=r[n].lStep&&e.lStep+e.wStep<=r[o].lStep+r[o].wStep)),{t_window:a,b_window:r}}({...e},JSON.parse(JSON.stringify(ue))),we={wStep:me.b_window.reduce(((e,t)=>e+t.wStep),0),lStep:me.b_window[0].lStep,tStep:me.t_window[0].tStep},Pe=Ce(we,"y"),ne.innerHTML+=Pe)}))}))}function ke(){ne.innerHTML="",ue=xe(ue),De(ue)}const Re=e=>{let{division:t,windowId:s,callback:i,maxNum:r,locale:a}=e;if(oe=a,ce=r,le=document.querySelector(`#${s}`),le.innerHTML=function(e){return`\n \n \n \n \n
\n `}(s),ne=document.querySelector(`#${s}-container`),de=i,ge(),document.querySelector(`#${s}-confirm-btn`).addEventListener("click",(()=>{i.onConfirm&&i.onConfirm(JSON.stringify(ue))})),document.querySelector(`#${s}-cancel-btn`).addEventListener("click",(()=>{i.onCancel&&i.onCancel()})),document.querySelector(`#${s}-reset-btn`).addEventListener("click",(()=>{ue=[{wStep:100,hStep:100,tStep:0,lStep:0,selectIndex:0}],De(ue)})),t)if([1,4,9,16,25].includes(Number(t)))!function(e=4){he=!0;let t=[],s=100/Math.sqrt(e);for(var i=0;ibe(e)));ne.innerHTML=r.join("")}(Number(t));else if("string"!=typeof t)i.onError&&i.onError(oe.$t("wsPlayer.income.format.error"));else try{ue=xe(JSON.parse(t)),De(ue)}catch(l){i.onError&&i.onError(oe.$t("wsPlayer.income.format.error"))}else De(xe())},Le=function(){let e=``;this.$el.append(e),Re({locale:T,maxNum:this.config.maxNum,division:localStorage.customDivision||"",windowId:`${this.el}-custom-container`,callback:{onError:e=>{this.sendErrorMessage(610,{method:"customDivisionError",arguments:{},insert:[e]})},onConfirm:e=>{localStorage.customDivision=e,WSPlayerJQ.$(`#${this.el}-custom-container`).remove(),j.call(this,e)},onCancel:()=>{WSPlayerJQ.$(`#${this.el}-custom-container`).remove()}}})},We=function(){let e=WSPlayerJQ.$(".ws-ctrl-ellipsis-list",this.$el);""===e.css("display")||"none"===e.css("display")?e.css("display","block"):e.css("display","none")},Ee=function(){return`\n \n
\n
\n

\n
\n
\n
\n
\n
\n
${T.$t("storagePlan.stream.main")}
\n \x3c!-- 下拉箭头 --\x3e\n

\n
\n
\n
\n \x3c!--主码流--\x3e\n - ${T.$t("storagePlan.stream.main")}
\n \x3c!--辅码流1--\x3e\n - ${T.$t("video.player.sub.stream",[1])}
\n \x3c!--辅码流2--\x3e\n - ${T.$t("video.player.sub.stream",[2])}
\n
\n
\n
\n
\n
\n
\n \x3c!--刷新重播--\x3e\n
\n \x3c!--智能帧--\x3e\n
\n \x3c!--对讲--\x3e\n
\n \x3c!--录像--\x3e\n
\n \x3c!--声音--\x3e\n
\n \x3c!--抓图--\x3e\n
\n \x3c!--更多--\x3e\n
\n
\n \x3c!--刷新重播--\x3e\n
${T.$t("wsPlayer.refreshReplay")}
\n \x3c!--智能帧--\x3e\n
${T.$t("wsPlayer.drawTriangle")}
\n \x3c!--对讲--\x3e\n
\n \x3c!--录像--\x3e\n
${T.$t("wsPlayer.recording")}
\n \x3c!--声音--\x3e\n
${T.$t("wsPlayer.sound")}
\n \x3c!--抓图--\x3e\n
${T.$t("wsPlayer.capture")}
\n
\n
\n \x3c!--关闭--\x3e\n
\n
\n
\n \x3c!--对讲中--\x3e\n
\n
\n
\n `},Me=function(){return`\n \n
\n
\n

\n
\n
\n
\n
\n \x3c!--刷新重播--\x3e\n
\n \x3c!--智能帧--\x3e\n
\n \x3c!--录像--\x3e\n
\n \x3c!--声音--\x3e\n
\n \x3c!--抓图--\x3e\n
\n \x3c!--更多--\x3e\n
\n
\n \x3c!--刷新重播--\x3e\n
${T.$t("wsPlayer.refreshReplay")}
\n \x3c!--智能帧--\x3e\n
${T.$t("wsPlayer.drawTriangle")}
\n \x3c!--录像--\x3e\n
${T.$t("wsPlayer.recording")}
\n \x3c!--声音--\x3e\n
${T.$t("wsPlayer.sound")}
\n \x3c!--抓图--\x3e\n
${T.$t("wsPlayer.capture")}
\n
\n
\n \x3c!--关闭--\x3e\n
\n
\n
\n
\n
\n
\n
\n `},_e=function(){return`\n
\n
\n
\n
\n
\n
${T.$t("wsPlayer.screen."+this.playerAdapter)}
\n \x3c!-- 下拉箭头 --\x3e\n

\n
\n
\n
\n \x3c!--自定义--\x3e\n - ${T.$t("wsPlayer.screen.selfAdaption")}
\n \x3c!--拉伸--\x3e\n - ${T.$t("wsPlayer.screen.stretching")}
\n
\n
\n
\n
\n
\x3c!--单屏--\x3e\n
\x3c!--2分屏--\x3e\n
\x3c!--4分屏--\x3e\n
\x3c!--9分屏--\x3e\n
\x3c!--16分屏--\x3e\n
\x3c!--25分屏--\x3e\n
\x3c!--3分屏--\x3e\n
\x3c!--6分屏--\x3e\n
\x3c!--8分屏--\x3e\n
\x3c!--自定义分屏--\x3e\n
\n
\x3c!--一键关闭--\x3e\n
\x3c!--全屏--\x3e\n
\n
\n
\n - ${T.$t("wsPlayer.pause")}
\n - ${T.$t("wsPlayer.play")}
\n - ${T.$t("wsPlayer.fastForward")}
\n - ${T.$t("wsPlayer.fastBackward")}
\n - ${T.$t("wsPlayer.screen.stretching")}
\n - ${T.$t("wsPlayer.screen.selfAdaption")}
\n - ${T.$t("wsPlayer.screen.one")}
\n - ${T.$t("wsPlayer.screen.split",[2])}
\n - ${T.$t("wsPlayer.screen.split",[4])}
\n - ${T.$t("wsPlayer.screen.split",[9])}
\n - ${T.$t("wsPlayer.screen.split",[16])}
\n - ${T.$t("wsPlayer.screen.split",[25])}
\n - ${T.$t("wsPlayer.screen.split",[3])}
\n - ${T.$t("wsPlayer.screen.split",[6])}
\n - ${T.$t("wsPlayer.screen.split",[8])}
\n - ${T.$t("wsPlayer.screen.custom.split")}
\n - ${T.$t("wsPlayer.one.click.off")}
\n - ${T.$t("wsPlayer.screen.full")}
\n
\n
\n
\n `},Je=function(){this.$el.append(_e.call(this)),this.maxWindow<=16&&(WSPlayerJQ.$(".twenty-five-screen-icon",this.$el).css({display:"none"}),WSPlayerJQ.$("#twenty-five-screen-icon",this.$el).css({display:"none"})),this.maxWindow<=9&&(WSPlayerJQ.$(".sixteen-screen-icon",this.$el).css({display:"none"}),WSPlayerJQ.$("#sixteen-screen-icon",this.$el).css({display:"none"})),this.maxWindow<=8&&(WSPlayerJQ.$(".nine-screen-icon",this.$el).css({display:"none"}),WSPlayerJQ.$("#nine-screen-icon",this.$el).css({display:"none"})),this.maxWindow<=6&&(WSPlayerJQ.$(".eight-screen-icon",this.$el).css({display:"none"}),WSPlayerJQ.$("#eight-screen-icon",this.$el).css({display:"none"})),this.maxWindow<=4&&(WSPlayerJQ.$(".six-screen-icon",this.$el).css({display:"none"}),WSPlayerJQ.$("#six-screen-icon",this.$el).css({display:"none"})),this.maxWindow<=3&&(WSPlayerJQ.$(".four-screen-icon",this.$el).css({display:"none"}),WSPlayerJQ.$("#four-screen-icon",this.$el).css({display:"none"})),this.maxWindow<=2&&(WSPlayerJQ.$(".three-screen-icon",this.$el).css({display:"none"}),WSPlayerJQ.$("#three-screen-icon",this.$el).css({display:"none"})),1===this.maxWindow&&(WSPlayerJQ.$(".two-screen-icon",this.$el).css({display:"none"}),WSPlayerJQ.$("#two-screen-icon",this.$el).css({display:"none"}),WSPlayerJQ.$(".one-screen-icon",this.$el).css({display:"none"}),WSPlayerJQ.$("#one-screen-icon",this.$el).css({display:"none"}),WSPlayerJQ.$(".custom-screen-icon",this.$el).css({display:"none"}),WSPlayerJQ.$("#custom-screen-icon",this.$el).css({display:"none"}),WSPlayerJQ.$(".ws-ctrl-btn-spread-2",this.$el).css({display:"none"})),WSPlayerJQ.$("#ws-select-stretching",this.$el).click((()=>{this.setPlayerAdapter("stretching")})),WSPlayerJQ.$("#ws-select-selfAdaption",this.$el).click((()=>{this.setPlayerAdapter("selfAdaption")})),WSPlayerJQ.$(".full-screen-icon",this.$el).click((()=>{this.setFullScreen()})),WSPlayerJQ.$("#full-screen-icon",this.$el).click((()=>{this.setFullScreen()})),WSPlayerJQ.$(".one-screen-icon",this.$el).click((()=>{this.setPlayerNum(1)})),WSPlayerJQ.$("#one-screen-icon",this.$el).click((()=>{this.setPlayerNum(1)})),WSPlayerJQ.$(".two-screen-icon",this.$el).click((()=>{this.setPlayerNum(2)})),WSPlayerJQ.$("#two-screen-icon",this.$el).click((()=>{this.setPlayerNum(2)})),WSPlayerJQ.$(".three-screen-icon",this.$el).click((()=>{this.setPlayerNum(3)})),WSPlayerJQ.$("#three-screen-icon",this.$el).click((()=>{this.setPlayerNum(3)})),WSPlayerJQ.$(".four-screen-icon",this.$el).click((()=>{this.setPlayerNum(4)})),WSPlayerJQ.$("#four-screen-icon",this.$el).click((()=>{this.setPlayerNum(4)})),WSPlayerJQ.$(".six-screen-icon",this.$el).click((()=>{this.setPlayerNum(6)})),WSPlayerJQ.$("#six-screen-icon",this.$el).click((()=>{this.setPlayerNum(6)})),WSPlayerJQ.$(".eight-screen-icon",this.$el).click((()=>{this.setPlayerNum(8)})),WSPlayerJQ.$("#eight-screen-icon",this.$el).click((()=>{this.setPlayerNum(8)})),WSPlayerJQ.$(".nine-screen-icon",this.$el).click((()=>{this.setPlayerNum(9)})),WSPlayerJQ.$("#nine-screen-icon",this.$el).click((()=>{this.setPlayerNum(9)})),WSPlayerJQ.$(".sixteen-screen-icon",this.$el).click((()=>{this.setPlayerNum(16)})),WSPlayerJQ.$("#sixteen-screen-icon",this.$el).click((()=>{this.setPlayerNum(16)})),WSPlayerJQ.$(".twenty-five-screen-icon",this.$el).click((()=>{this.setPlayerNum(25)})),WSPlayerJQ.$("#twenty-five-screen-icon",this.$el).click((()=>{this.setPlayerNum(25)})),WSPlayerJQ.$(".close-all-video",this.$el).click((()=>{this.close(void 0,"btnClick")})),WSPlayerJQ.$("#close-all-video",this.$el).click((()=>{this.close(void 0,"btnClick")})),WSPlayerJQ.$(".custom-screen-icon",this.$el).click((()=>{Le.call(this)})),WSPlayerJQ.$("#custom-screen-icon",this.$el).click((()=>{Le.call(this)})),WSPlayerJQ.$(".ws-ctrl-ellipsis",this.$el).click((()=>{We.call(this)})),this.selfAdaptionSelectShow=!1,WSPlayerJQ.$(".ws-select-self-adaption",this.$el).click((e=>{this.selfAdaptionSelectShow?(WSPlayerJQ.$(".ws-self-adaption-type",this.$el).hide(),this.selfAdaptionSelectShow=!1):(WSPlayerJQ.$(".ws-self-adaption-type",this.$el).show(),this.selfAdaptionSelectShow=!0,WSPlayerJQ.$(".ws-select-ul .ws-select-type-item",this.$el).css({background:"none"}),WSPlayerJQ.$(`.ws-select-ul [value=${this.playerAdapter}]`,this.$el).css({background:"#1A78EA"}))})),WSPlayerJQ.$(".ws-self-adaption-type",this.$el).click((e=>{let t=e.target.getAttribute("value");this.setPlayerAdapter(t),WSPlayerJQ.$(".ws-select-show-option",this.$el).text(this.wsAdaption[t])})),"record"!==this.type&&(WSPlayerJQ.$(".ws-control-record",this.$el).css({display:"none"}),WSPlayerJQ.$("#ws-record-pause",this.$el).css({display:"none"}),WSPlayerJQ.$("#ws-record-play",this.$el).css({display:"none"}),WSPlayerJQ.$("#ws-record-speed-add",this.$el).css({display:"none"}),WSPlayerJQ.$("#ws-record-speed-sub",this.$el).css({display:"none"})),WSPlayerJQ.$(".ws-record-pause",this.$el).click((e=>{this.pause()})),WSPlayerJQ.$("#ws-record-pause",this.$el).click((e=>{this.pause()})),WSPlayerJQ.$(".ws-record-play",this.$el).click((e=>{this.play()})),WSPlayerJQ.$("#ws-record-play",this.$el).click((e=>{this.play()})),WSPlayerJQ.$(".ws-record-speed-sub",this.$el).click((e=>{"playing"===this.playerList[this.selectIndex].status&&this.__setPlaySpeed("PREV")})),WSPlayerJQ.$("#ws-record-speed-sub",this.$el).click((e=>{"playing"===this.playerList[this.selectIndex].status&&this.__setPlaySpeed("PREV")})),WSPlayerJQ.$(".ws-record-speed-add",this.$el).click((e=>{"playing"===this.playerList[this.selectIndex].status&&this.__setPlaySpeed("NEXT")})),WSPlayerJQ.$("#ws-record-speed-add",this.$el).click((e=>{"playing"===this.playerList[this.selectIndex].status&&this.__setPlaySpeed("NEXT")}))},Qe=function(){this.$el.append('\n \n \n
\n '),this.recordProgressRuler=new re({canvasId:`#${this.el} canvas#wsplayer-record-progress`,records:[],currentTime:y.getToday12Time(),rulerLength:{short:10,middle:20,long:25},rulerScale:2,getCurrentTime:e=>{this.clickRecordsTimer&&clearTimeout(this.clickRecordsTimer),this.clickRecordsTimer=setTimeout((()=>{clearTimeout(this.clickRecordsTimer),this.clickRecordsTimer=null}),1500),this.clickRecordTimeLine(e),this.play()}})};class Ne extends se{constructor(e){super(e),this.currentIndex=e.index,this.wrapperDomId=e.wrapperDomId,this.type="real",this.options={},this.chromeResourceOutOfMemory=!1,this.initDom(),this.defaultStatus=WSPlayerJQ.$(".default-status",this.$el),this.error=WSPlayerJQ.$(".error",this.$el),this.controller=WSPlayerJQ.$(".player-control",this.$el),this.controller.dblclick((e=>{e.stopPropagation()})),this.initMouseEvent(),this.setStatus("created"),this.isFirstInfo=!0}getTemplate(){return Ee.call(this)}initMouseEvent(){super.initMouseEvent();let e=this;this.hideTimer=null,this.$el.on("mouseenter mousemove",(e=>{this.wsPlayer.config.showTopOperate&&(["created","closed"].includes(this.status)||this.setDomVisible(WSPlayerJQ.$(".player-control",WSPlayerJQ.$(`#${this.wrapperDomId}-${this.currentIndex}`)),!0),"playing"!==this.status&&"error"!==this.status||this.hideTimer&&clearTimeout(this.hideTimer))})),this.$el.on("mouseleave",(e=>{this.wsPlayer.config.showTopOperate&&(this.hideTimer=setTimeout((()=>{WSPlayerJQ.$(".stream-type",this.$el).hide(),this.setDomVisible(WSPlayerJQ.$(".player-control",WSPlayerJQ.$(`#${this.wrapperDomId}-${this.currentIndex}`)),!1),this.streamSelectShow=!1,this.setDomVisible(WSPlayerJQ.$(".opt-icons-vertical",this.$el),!1),this.showMoreIcon=!1}),300))})),this.streamSelectShow=!1,WSPlayerJQ.$(".select",this.$el).click((e=>{this.streamSelectShow?(WSPlayerJQ.$(".stream-type",this.$el).hide(),this.streamSelectShow=!1):(WSPlayerJQ.$(".stream-type",this.$el).show(),this.streamSelectShow=!0)})),WSPlayerJQ.$(".stream-type",this.$el).click((t=>{let s=t.target.getAttribute("stream-type");e.streamType!==s&&e.options&&("url"===e.playType?e.wsPlayer.sendMessage("changeStreamType",{channelData:e.options.channelData,channelInfo:{...this.options},streamType:Number(s),selectIndex:e.index}):e.wsPlayer.changeStreamType(e.options.channelData,s,e.index,"changeStreamType"))}))}setStreamType(e){this.streamType=e;let t=WSPlayerJQ.$(".stream-type .select-ul",this.$el)[0].children[e-1],s=t&&WSPlayerJQ.$(t).attr("title");WSPlayerJQ.$(".code-stream",this.$el).text(s),WSPlayerJQ.$(".code-stream",this.$el).attr("title",s),t&&WSPlayerJQ.$(t).addClass("stream-type-select").siblings().removeClass("stream-type-select")}setStatus(e,s){switch(this.wsPlayer.sendMessage("statusChanged",{status:e,windowIndex:this.index}),this.status=e,this.currentWindowPlaying=!1,this.status){case"created":case"closed":this.setDomVisible(this.defaultStatus,!0),this.setDomVisible(this.error,!1),this.setDomVisible(this.controller,!1),this.isAudioPlay=!1,WSPlayerJQ.$(".audio-icon",this.$el).removeClass("on").addClass("off");break;case"loading":case"ready":case"showmsg":this.setDomVisible(this.defaultStatus,!1),this.setDomVisible(this.error,!1);break;case"playing":case"pause":self.isclosing=!1,this.currentWindowPlaying=!0,this.setDomVisible(this.defaultStatus,!1),this.setDomVisible(this.error,!1);break;case"streamError":const{selectIndex:e,channelData:i={}}=this.options;this.wsPlayer.sendMessage("realError",{selectIndex:e,channelData:{...i},channelInfo:{...this.options}},{code:s.errorCode,msg:t.errorVideoInfo[s.errorCode]}),this.close(!0,!1,"none","playSDKError");case"error":self.isclosing=!1,this.showMsgInWindow(t.errorVideoInfo[s.errorCode]?t.errorVideoInfo[s.errorCode]:t.errorVideoInfo.defaultErrorMsg)}}init(e){if(this.wsPlayer.config.isDynamicLoadLib&&!window.m_nModuleInitialized){let t=setTimeout((()=>{this.init(e),clearTimeout(t)}),100);return}let t=(this.options||{}).channelId===e.channelId;if(this.options=e,this.playSDK&&(this.isAudioPlay&&WSPlayerJQ.$(".audio-icon",this.$el).removeClass("on").addClass("off"),this.close(!0,t,"closed",e.closeReason||"changeStream")),this.setLoading(!0,"ready",e.closeReason),this.setStreamType(e.streamType),this.chromeResourceOutOfMemory)return this.wsPlayer.close(this.currentIndex,"chromeMemoryOut"),console.warn("浏览器资源不足, 请等待3-5秒后重试"),this.wsPlayer.sendMessage("chromeMemoryOut",{channelInfo:{...this.options},channelData:this.options&&{...this.options.channelData},selectIndex:this.currentIndex,message:"浏览器资源不足, 请等待3-5秒后重试"});this.isclosing?this.isclosing=!1:E.call(this,this.wsPlayer.config,e)}startTalk(e){!this.wsPlayer.config.isDynamicLoadLib||window.m_nModuleInitialized?(this.talkData=e.talkData,_.call(this,e,e.talkData.audioType)):this.wsPlayer.sendErrorMessage("502")}talkByUrl(e){if(!this.wsPlayer.config.isDynamicLoadLib||window.m_nModuleInitialized)if(this.currentWindowPlaying)if([2,4].includes(Number(e.audioType)))_.call(this,e,e.audioType);else{let t={1:307,3:308,4:309,5:310,8:311,101:312};this.wsPlayer.sendErrorMessage(t[e.audioType],{channelList:[e]})}else this.wsPlayer.sendErrorMessage("614");else this.wsPlayer.sendErrorMessage("502")}stopTalk(e){if(this.talkPlaySDK&&window.wsPlayerManager.unbindPlayer(this.talkPlaySDK.nPlayPort),"url"!==e&&this.talkData&&this.wsPlayer.stopTalk(this.talkData),this.isTalking&&(this.wsPlayer.isTalking=!1,this.isTalking=!1),this.talkPlaySDK&&(this.talkPlaySDK.StopTalk(),this.talkPlaySDK.StopPullStream(),this.talkPlaySDK=null),WSPlayerJQ.$(".talk-icon",this.$el).removeClass("on").addClass("off"),WSPlayerJQ.$(".ws-talking",this.$el).css({visibility:"hidden"}),this.closeVolume(),this.options&&"url"===this.options.playType){const{selectIndex:e,channelData:t={}}=this.options;this.wsPlayer.sendMessage("stopTalk",{selectIndex:e,channelData:{...t},channelInfo:{...this.options}})}}}class ze extends se{constructor(e){super(e),this.currentIndex=e.index,this.wrapperDomId=e.wrapperDomId,this.speed=1,this.curTimestamp=0,this.type="record",this.initDom(),this.defaultStatus=WSPlayerJQ.$(".default-status",this.$el),this.error=WSPlayerJQ.$(".error",this.$el),this.controller=WSPlayerJQ.$(".player-control",this.$el),this.timeInfo=WSPlayerJQ.$(".time-info",this.$el),this.chromeResourceOutOfMemory=!1,this.initMouseEvent(),this.setStatus("created"),this.isFirstInfo=!0}getTemplate(){return Me.call(this)}initMouseEvent(){super.initMouseEvent(),this.hideTimer=null,this.$el.on("mouseenter mousemove",(e=>{this.wsPlayer.config.showTopOperate&&(["created","closed"].includes(this.status)||this.setDomVisible(WSPlayerJQ.$(".player-control",WSPlayerJQ.$(`#${this.wrapperDomId}-${this.currentIndex}`)),!0),"playing"===this.status?this.hideTimer&&clearTimeout(this.hideTimer):"ready"===this.status&&this.setDomVisible(this.progressBar,!0))})),this.$el.on("mouseleave",(e=>{this.wsPlayer.config.showTopOperate&&"pause"!==this.status&&(this.hideTimer=setTimeout((()=>{this.setDomVisible(WSPlayerJQ.$(".player-control",WSPlayerJQ.$(`#${this.wrapperDomId}-${this.currentIndex}`)),!1),this.setDomVisible(WSPlayerJQ.$(".opt-icons-vertical",this.$el),!1),this.showMoreIcon=!1}),300))})),WSPlayerJQ.$(".wsplayer-progress-bar",this.$el).on("mousemove",(e=>{WSPlayerJQ.$(".progress-bar_hover_light",this.$el).css({width:e.offsetX+"px"})})),WSPlayerJQ.$(".wsplayer-progress-bar",this.$el).on("mouseleave",(e=>{WSPlayerJQ.$(".progress-bar_hover_light",this.$el).css({width:0})})),WSPlayerJQ.$(".play-ctrl-btn",this.$el).click((e=>{"playing"===this.status?(this.pause(),WSPlayerJQ.$(".play-icon",this.$el).removeClass("play").addClass("pause")):(this.play(),WSPlayerJQ.$(".play-icon",this.$el).removeClass("pause").addClass("play"))}))}setStatus(e,s){this.wsPlayer.sendMessage("statusChanged",{status:e,windowIndex:this.index}),this.status=e,this.currentWindowPlaying=!1;let{selectIndex:i,channelData:r={}}=this.options||{};switch(this.status){case"created":case"closed":this.setDomVisible(this.defaultStatus,!0),this.setDomVisible(this.error,!1),this.setDomVisible(this.controller,!1),this.isAudioPlay=!1,WSPlayerJQ.$(".audio-icon",this.$el).removeClass("on").addClass("off");break;case"loading":case"ready":case"showmsg":this.setDomVisible(this.defaultStatus,!1),this.setDomVisible(this.error,!1);break;case"playing":this.currentWindowPlaying=!0,this.setDomVisible(this.defaultStatus,!1),this.setDomVisible(this.error,!1),this.setDomVisible(WSPlayerJQ.$(".play-pause-wrapper",this.$el),!1);break;case"pause":this.currentWindowPlaying=!0,this.setDomVisible(this.defaultStatus,!1),this.setDomVisible(this.error,!1),this.setDomVisible(this.controller,!1),this.setDomVisible(WSPlayerJQ.$(".play-pause-wrapper",this.$el),!0);break;case"streamError":let e=setTimeout((()=>{this.close(!0,!1,"none","playSDKError"),clearTimeout(e)}),0);this.wsPlayer.sendMessage("recordError",{selectIndex:i,channelData:{...r},channelInfo:{...this.options}},{code:s.errorCode,msg:t.errorVideoInfo[s.errorCode]}),this.showMsgInWindow(t.errorVideoInfo[s.errorCode]?t.errorVideoInfo[s.errorCode]:t.errorVideoInfo.defaultErrorMsg);break;case"recordFinish":let a=setTimeout((()=>{this.close(!0,!1,"recordFinish","recordFinish"),clearTimeout(a)}),!0);this.wsPlayer.sendMessage("recordFinish",{selectIndex:i,channelData:{...r},channelInfo:{...this.options}}),this.showMsgInWindow(t.errorVideoInfo[s.errorCode]?t.errorVideoInfo[s.errorCode]:t.errorVideoInfo.defaultErrorMsg);break;case"error":this.showMsgInWindow(t.errorVideoInfo[s.errorCode]?t.errorVideoInfo[s.errorCode]:t.errorVideoInfo.defaultErrorMsg)}}init(e){if(!this.wsPlayer.config.isDynamicLoadLib||window.m_nModuleInitialized){if(this.options=e,this.playSDK&&(this.isAudioPlay&&WSPlayerJQ.$(".audio-icon",this.$el).removeClass("on").addClass("off"),this.close(!0,!1,"closed",e.closeReason||"changeStream")),this.setLoading(!0),this.chromeResourceOutOfMemory)return this.wsPlayer.close(this.currentIndex,"chromeMemoryOut"),console.warn("浏览器资源不足, 请等待3-5秒后重试"),this.wsPlayer.sendMessage("chromeMemoryOut",{message:"浏览器资源不足, 请等待3-5秒后重试",channelData:this.options&&this.options.channelData,channelInfo:{...this.options},selectIndex:this.currentIndex});M.call(this,this.wsPlayer.config,e)}else{let t=setTimeout((()=>{this.init(e),clearTimeout(t)}),100)}}playSpeed(e){this.speed=e,1!==e&&this.closeVolume(),this.playSDK&&this.playSDK.SetSpeed(e)}}class Fe{constructor(){__publicField(this,"cPlusMediaFrameCallBack",(function(e,t,s,i){this.handleToPlayer[e]&&this.handleToPlayer[e].InputDataEx(s,i)})),__publicField(this,"cPlusRtspMsgCallBack",(function(e,t,s){switch(t){case 4096:setTimeout((()=>{this.handleToPlayer[e].StopPullStream(),this.handleToPlayer[e].StreamFailedCallback(s),[285868034,285868036,6500424].includes(s)||this.handleToPlayer[e].StreamDisconnectCallback()}),500);break;case 4097:break;case 4099:this.handleToPlayer[e]&&this.handleToPlayer[e].StreamMsgPlay();break;case 4100:this.handleToPlayer[e]&&this.handleToPlayer[e].StreamFinishCallback();break;case 4102:let t=this.handleToPlayer[e];this.wsPlayerList.forEach((e=>{e.playerList.forEach(((i,r)=>{i.talkPlaySDK!==t&&i.playSDK!==t||e.dealRTSPError(s,r)}))}));break;case 4104:this.handleToPlayer[e].StreamRedirectCallback(s);break;case 4109:this.handleToPlayer[e].StopPullStream(),this.handleToPlayer[e].StreamDisconnectCallback()}})),__publicField(this,"cPlusRtsvMsgCallBack",(function(e,t,s){switch(t){case 16385:break;case 16386:this.handleToPlayer[e]&&this.handleToPlayer[e].StreamFinishCallback()}})),__publicField(this,"cIVSDrawDataCallBack",(function(e,t,s,i,r){this.portToPlayer[e]&&this.portToPlayer[e].SetIVSDrawData(e,t,s,i,r)})),this.wsPlayerList=[],this.portToPlayer={},this.handleToPlayer={},this.canvasToPlayer={},window.cPlusVisibleDecCallBack=this.cPlusVisibleDecCallBack.bind(this),window.cDigitalSignCallBack=this.cDigitalSignCallBack.bind(this),window.cRecordDataCallBack=this.cRecordDataCallBack.bind(this),window.cIVSDrawDataCallBack=this.cIVSDrawDataCallBack.bind(this),window.cPlusMediaFrameCallBack=this.cPlusMediaFrameCallBack.bind(this),window.cPlusRtspMsgCallBack=this.cPlusRtspMsgCallBack.bind(this),window.cPlusRtsvMsgCallBack=this.cPlusRtsvMsgCallBack.bind(this)}cPlusVisibleDecCallBack(e,t,s,i,r,a){this.portToPlayer[e]&&this.portToPlayer[e].SetFrameData(e,t,s,i,r,a)}cDigitalSignCallBack(e,t,s){this.portToPlayer[e]&&this.portToPlayer[e].SetDecryptionResult(e,t,s)}cRecordDataCallBack(e,t,s,i,r){this.portToPlayer[e]&&this.portToPlayer[e].SetRecordData(e,t,s,i,r)}bindPlayer(e,t){this.portToPlayer[e]||(this.portToPlayer[e]=t)}unbindPlayer(e){this.portToPlayer[e]=null}bindHandlePlayer(e,t){this.handleToPlayer[e]||(this.handleToPlayer[e]=t)}unbindHandlePlayer(e){this.handleToPlayer[e]=null}bindCanvasPlayer(e,t){this.canvasToPlayer[e]||(this.canvasToPlayer[e]=t)}unbindCanvasPlayer(e){this.canvasToPlayer[e]=null}addWSPlayer(e){this.wsPlayerList.push(e)}removeWSPlayer(e){this.wsPlayerList=this.wsPlayerList.filter((t=>t===e))}}const Be={data:{dataType:"3",streamType:"2",channelId:"",urlType:1,packtype:"Private"}},Ae={data:{deviceCode:"",talkType:"1",audioBit:16,audioType:2,sampleRate:8e3,talkMode:"",channelSeq:"0",enableGBParamAutoAdapt:1,urlType:1,optModule:"ADMIN_001031",audioTypeList:["2","4"]}},Ue={data:{streamType:"0",recordType:"0",recordSource:"3",startTime:"",endTime:"",channelId:""}},Ke={data:{recordType:"0",recordSource:"1",streamType:"1",channelId:"",startTime:"",endTime:"",urlType:"1"}},Ve={data:{ssId:"",startTime:"",endTime:"",fileName:"",diskId:"",recordSource:"",channelId:"",streamId:"",urlType:"1"}},Oe={1:307,3:308,4:309,5:310,8:311,101:312};class He{constructor(e){this.realPlayer=null,this.recordPlayer=null,this.playCenterRecordByTime=e.playCenterRecordByTime,this.i18n=e.i18n,"real"===e.type?this.realPlayer=e.player:this.recordPlayer=e.player,this.playIndex=0,this.recordList=[],this.getRealRtsp=e.getRealRtsp,this.getRecords=e.getRecords,this.getRecordRtspByTime=e.getRecordRtspByTime,this.getRecordRtspByFile=e.getRecordRtspByFile,this.getTalkRtsp=e.getTalkRtsp,this.stopTalk=e.stopTalk}concatToken(e,t){return e.includes("myToken")?e:t&&!e.includes("token=")?e+(e.includes("?")?"&":"?")+"token="+t:e}getCurrentRtsp(e,t){const s=this.getRTSPUrls(e),i=s.find((e=>e.includes(window.location.hostname)))||s[0];return this.concatToken(i,t)}getRTSPUrls(e){return e.split("|").filter((e=>!e.includes("localhost")&&!e.includes("127.0.0.1")&&!e.startsWith("rtsp://[")))}processResponse(e,t){try{return"string"==typeof e&&e.includes("rtsp://")&&e.includes("&token=")?{url:e,innerIp:null}:e.url&&e||e.data.url&&e.data||e.data.data.url&&e.data.data}catch{return null}}getWSUrl(e){return this.getRTSPUrls(e).map((e=>e.split("//")[1].split("/")[0]))}wssRedirectParam(e){"wss"===((this.realPlayer||this.recordPlayer).protocol||("https:"===window.location.protocol?"wss":"ws"))&&(e.data.clientSupportWSSDirect=1,e.data.enableXNetFlag=1)}openSomeWindow(e){let t=this.realPlayer||this.recordPlayer;e>t.showNum&&(e16?25:e>9?16:e>4?9:4:this.playNum=t.maxWindow,t.setPlayerNum(this.playNum))}playRealVideo(e,t="2",s,i=!1,r){if(!y.validFunction(this.getRealRtsp))return void this.realPlayer.sendErrorMessage(608,{insert:[this.i18n.$t("wsPlayer.request.realtime.preview.interface"),"getRealRtsp"]});let a="number"==typeof s?s:this.playIndex;"number"==typeof this.realPlayer.showNum?this.openSomeWindow(e.length):e=e.slice(0,JSON.parse(this.realPlayer.showNum).length-a),e.map(((e,s)=>{let l=a+s;Be.data.streamType=t,Be.data.channelId=e.id,this.wssRedirectParam(Be),this.realPlayer.setLoading(l,!e.isWaiting,"loading",r),this.getRealRtsp(JSON.parse(JSON.stringify(Be))).then((s=>{if(this.realPlayer.playerList[l].isclosing)return void(this.realPlayer.playerList[l].isclosing=!1);let i=this.processResponse(s,e);if(!i)return this.realPlayer.sendErrorMessage(104,{channelList:[e]});i.rtspURL=this.getCurrentRtsp(i.url,i.token),Z.call(this.realPlayer,{selectIndex:l,streamServerIp:i.innerIp,rtspURL:i.rtspURL,channelId:e.id,channelData:e,streamType:t,wsList:this.getWSUrl(i.url),wssDirect:i.wssDirect,closeReason:r})}),(t=>{this.realPlayer.setLoading(l,!1,"closed");let s={channelList:[e],channelData:{...e},selectIndex:l,apiErrorInfo:t};t?401===Number(t.status)||27001007===Number(t.code)?this.realPlayer.sendErrorMessage(102,s):3033===Number(t.code)?(this.realPlayer.showMsgInWindow(l,T.$t("wsPlayer.error.105"),e),this.realPlayer.sendErrorMessage(105,s)):2084===Number(t.code)?(this.realPlayer.showMsgInWindow(l,T.$t("wsPlayer.play.error.402"),e),this.realPlayer.sendErrorMessage(402,s)):i?(this.realPlayer.showMsgInWindow(l,T.$t("wsPlayer.play.error.103"),e),this.realPlayer.sendErrorMessage(103,s)):this.playRealVideo([e],"1",l,!0,r):this.realPlayer.sendErrorMessage(108)}))}))}startTalk(e){if(!y.validFunction(this.getTalkRtsp))return void this.realPlayer.sendErrorMessage(608,{insert:[this.i18n.$t("wsPlayer.request.talk.interface"),"getTalkRtsp"]});Ae.data.deviceCode=e.deviceCode,Ae.data.audioBit=e.audioBit||16,Ae.data.sampleRate=e.sampleRate||8e3,[1,3,6,10,13,14,43].includes(e.deviceType)?(Ae.data.talkType="2",Ae.data.channelSeq=e.channelSeq):(Ae.data.talkType="1",Ae.data.channelSeq="0"),this.wssRedirectParam(Ae);let t={talkType:Ae.data.talkType,deviceCode:e.deviceCode,session:"",channelSeq:Ae.data.channelSeq,audioType:2},s=s=>{ee.call(this.realPlayer,{selectIndex:this.realPlayer.talkIndex,channelId:e.id,channelData:e,wssDirect:s.wssDirect,rtspURL:this.getCurrentRtsp(s.url,s.token),streamServerIp:s.innerIp,wsList:this.getWSUrl(s.url),talkData:t,gbDevice:s.gbDevice})};this.getTalkRtsp(JSON.parse(JSON.stringify(Ae))).then((i=>{let r=this.processResponse(i,e);return r?(t.session=r.session,t.audioType=r.audioType,"2"!==t.audioType&&"4"!==t.audioType?(this.stopTalk({data:t}),Ae.data.audioType=4,void this.getTalkRtsp(JSON.parse(JSON.stringify(Ae))).then((i=>(r=this.processResponse(i,e),r?(t.session=r.session,t.audioType=r.audioType,"4"!==i.audioType?(this.realPlayer.sendErrorMessage(Oe[t.audioType],{channelList:[e]}),void this.stopTalk({data:t})):void s(r)):this.realPlayer.sendErrorMessage(104,{channelList:[e]})))).catch((t=>{this.realPlayer.sendErrorMessage(304,{channelList:[e],apiErrorInfo:t})}))):void s(r)):this.realPlayer.sendErrorMessage(104,{channelList:[e]})})).catch((t=>{this.realPlayer.sendErrorMessage(304,{channelList:[e],apiErrorInfo:t})}))}getRecordList(e,t){if(!y.validFunction(this.getRecords))return void this.recordPlayer.sendErrorMessage(608,{insert:[this.i18n.$t("wsPlayer.request.recording.interface"),"getRecords"]});e.playRecordByTime=!e.playRecordByFile,Ue.data.streamType=e.streamType||"0",Ue.data.recordType=e.recordType||"0",Ue.data.recordSource=e.recordSource,Ue.data.startTime=e.startTime,Ue.data.endTime=e.endTime;let s="number"==typeof e.windowIndex?e.windowIndex:this.playIndex;"number"==typeof this.recordPlayer.showNum?e.channelList.length>1&&this.openSomeWindow(e.channelList.length):e.channelList=e.channelList.slice(0,JSON.parse(this.recordPlayer.showNum).length-s),e.channelList.forEach(((i,r)=>{let a=s+r;this.recordPlayer.setLoading(a,!i.isWaiting,"loading",e.closeReason),Ue.data.channelId=i.id;let l=[];if("0"==Ue.data.streamType){l.push(this.getRecords(JSON.parse(JSON.stringify(Ue))));let e=JSON.parse(JSON.stringify(Ue));e.data.streamType="3",l.push(this.getRecords(e))}else l.push(this.getRecords(JSON.parse(JSON.stringify(Ue))));Promise.allSettled(l).then((s=>{let r=[],l=[];if(s[0]&&"rejected"===s[0].status&&s[1]&&"rejected"===s[1].status){this.recordPlayer.setLoading(a,!1,"closed");let t={channelList:[i],channelData:{...i},selectIndex:a,apiErrorInfo:s[0].reason};return void(s[0].reason.code?3033===Number(s[0].reason.code)?(this.recordPlayer.showMsgInWindow(a,T.$t("wsPlayer.error.205"),e.channel),this.recordPlayer.sendErrorMessage(205,t)):(this.recordPlayer.showMsgInWindow(a,T.$t("wsPlayer.error.202"),i),this.recordPlayer.sendErrorMessage(202,t)):this.recordPlayer.sendErrorMessage(108,t))}s[0]&&"fulfilled"===s[0].status&&(r=s[0].value.records||s[0].value.data&&s[0].value.data.records||s[0].value.data&&s[0].value.data.data&&s[0].value.data.data.records||[]),s[1]&&"fulfilled"===s[1].status&&(l=s[1].value.records||s[1].value.data&&s[1].value.data.records||s[1].value.data&&s[1].value.data.data&&s[1].value.data.data.records||[]);let n=([...r,...l]||[]).sort(((e,t)=>e.startTime-t.startTime));if(!n.length)return this.recordPlayer.setLoading(a,!1,"closed"),this.recordPlayer.showMsgInWindow(a,T.$t("wsPlayer.error.201"),i),void this.recordPlayer.sendErrorMessage(201,{channelList:[i]});this.getRecordRtsp({...e,channel:i},n.map((e=>(e.isImportant=["2","4","5"].includes(e.recordType),e))),!e.isUpdateRecords,a,t)}))}))}getRecordRtsp(e,t,s=!0,i,r){let a=null,l=t[0].recordSource||e.recordSource,n=e.ssId,o=[],c="byTime",d=t[0].poolType;if(!["3","5"].includes(d)||e.playRecordByTime)Ke.data.streamType=t[0].streamType||e.streamType||"0",Ke.data.recordType="1",Ke.data.recordSource=l,Ke.data.startTime=e.startTime,Ke.data.endTime=e.endTime,Ke.data.channelId=e.channel.id,Ke.data.streamId=t[0].streamId||"",n=n||t[0].ssId,o=Array.from(new Set(t.map((e=>e.ssId)))),Ke.data.ssId=n,this.wssRedirectParam(Ke),a=this.getRecordRtspByTime(JSON.parse(JSON.stringify(Ke)));else{if(c="byFile",!y.validFunction(this.getRecordRtspByFile))return void this.recordPlayer.sendErrorMessage(608,{insert:[this.i18n.$t("wsPlayer.request.recording.interface"),"getRecordRtspByFile"]});let s=t[0];Ve.data.ssId=s.ssId,Ve.data.startTime=s.startTime,Ve.data.endTime=s.endTime,Ve.data.fileName=s.recordName,Ve.data.diskId=s.diskId,Ve.data.recordSource=s.recordSource||"3",Ve.data.channelId=e.channel.id,Ve.data.streamId=s.streamId,this.wssRedirectParam(Ve),a=this.getRecordRtspByFile(JSON.parse(JSON.stringify(Ve)))}a&&a.then((a=>{let d=this.processResponse(a,e.channel);return d?(d.channelId=e.channel.id,d.rtspURL=this.getCurrentRtsp(d.url,d.token),d.wsList=this.getWSUrl(d.url),d.rtspURL?(d.channelData=e.channel,d.startTime=e.startTime,d.endTime=e.endTime,d.recordSource=l,void this.recordPlay(d,i,n,o,e.isJumpPlay,r,c,t).then((()=>{let r=this.recordList[i];if(s)this.recordList[i]={...e,recordList:t,recordIndex:0,isPlaying:!0};else{let e=t[0].recordName;r.recordIndex=r.recordList.findIndex((t=>t.recordName===e)),r.isPlaying=!0}this.playIndex===i&&(s||(t=r.recordList,r.isPlaying=!0),this.setTimeLine(t,t[0].startTime))}))):(this.recordPlayer.setLoading(i,!1,"closed"),void this.recordPlayer.sendErrorMessage(201,{channelList:[e.channel]}))):(this.recordPlayer.setLoading(i,!1,"closed"),this.realPlayer.sendErrorMessage(104,{channelList:[e.channel]}))}),(t=>{this.recordPlayer.setLoading(i,!1,"closed");let s={channelList:[e.channel],channelData:{...e.channel},selectIndex:i,apiErrorInfo:t};t?1103===Number(t.code)?(this.recordPlayer.showMsgInWindow(i,T.$t("wsPlayer.play.error.402"),e.channel),this.recordPlayer.sendErrorMessage(402,s)):this.recordPlayer.sendErrorMessage(203,s):this.recordPlayer.sendErrorMessage(108,s)}))}recordPlay(e,t,s,i,r,a,l,n,o){return new Promise((c=>{te.call(this.recordPlayer,{...e,streamServerIp:e.innerIp,selectIndex:t,ssId:s,ssIdList:i,isJumpPlay:r,playRecordByFile:"byFile"===l,playRecordByTime:"byTime"===l||this.recordPlayer.config.playCenterRecordByTime&&!!s,recordList:n,closeReason:o},a).then((()=>c()))}))}setTimeLine(e,t){this.recordPlayer.setTimeLine(e,t)}clickRecordTimeLine(e,t){let s=this.recordList[this.playIndex],i={channelList:[s.channel],startTime:e,endTime:s.endTime,recordSource:s.recordSource,isUpdateRecords:!0,ssId:t,isJumpPlay:!0};this.getRecordList(i,{DecodeStart(){this.player.playByTime(e)}})}playNextRecordByFile(e,t){if(!y.validFunction(this.getRecordRtspByFile))return void this.recordPlayer.sendErrorMessage(608,{insert:[this.i18n.$t("wsPlayer.request.recording.interface"),"getRecordRtspByFile"]});let s=this.recordList[e];if(s.isGetRtspByFile)return;s.isGetRtspByFile=!0,s.recordIndex++,s.isPlaying=!0;let i=s.recordList[s.recordIndex];i?(Ve.data.ssId=i.ssId,Ve.data.startTime=i.startTime,Ve.data.endTime=i.endTime,Ve.data.fileName=i.recordName,Ve.data.diskId=i.diskId,Ve.data.recordSource=i.recordSource||"3",Ve.data.channelId=i.channelId,Ve.data.streamId=i.streamId,this.wssRedirectParam(Ve),this.getRecordRtspByFile(JSON.parse(JSON.stringify(Ve))).then((t=>{if(t.rtspURL=this.getCurrentRtsp(t.url,t.token),t.wsList=this.getWSUrl(t.url),!t.rtspURL)return s.isGetRtspByFile=!1,void this.recordPlayer.sendErrorMessage(201,{channelList:[s.channel]});this.recordPlay(t,e,"",[],!0).then((()=>{s.isGetRtspByFile=!1,this.setTimeLine(s.recordList)}))}),(e=>{s.isGetRtspByFile=!1,this.recordPlayer.sendErrorMessage(203,{channelList:[s.channel],apiErrorInfo:e})}))):(s.isGetRtspByFile=!1,t())}playNextRecord(e,t){if(t){if(!y.validFunction(this.getRecordRtspByTime))return void this.recordPlayer.sendErrorMessage(608,{insert:[this.i18n.$t("wsPlayer.request.recording.interface"),"getRecordRtspByTime"]});let s=this.recordList[e],i=s.recordList.find((e=>e.ssId===t));Ke.data.streamType=i.streamType||"0",Ke.data.recordType="1",Ke.data.recordSource=i.recordSource,Ke.data.startTime=new Date(1e3*i.startTime).setHours(0,0,0)/1e3,Ke.data.endTime=new Date(1e3*i.endTime).setHours(23,59,59)/1e3,Ke.data.channelId=i.channelId,Ke.data.ssId=t,Ke.data.streamId=i.streamId||"",this.wssRedirectParam(Ke);let r=Array.from(new Set(s.recordList.map((e=>e.ssId))));this.getRecordRtspByTime(JSON.parse(JSON.stringify(Ke))).then((a=>{let l=this.processResponse(a,opt.channel);if(!l)return this.realPlayer.sendErrorMessage(104,{channelList:[opt.channel]});l.channelId=i.channelId,l.rtspURL=this.getCurrentRtsp(l.url,l.token),l.wsList=this.getWSUrl(l.url),l.startTime=Ke.data.startTime,l.endTime=Ke.data.endTime,this.recordPlay(l,e,t,r,!0).then((()=>{this.setTimeLine(s.recordList)}))}))}else;}changeTimeLine(e){let t=this.recordList[e];t&&t.isPlaying&&this.setTimeLine(t.recordList)}videoClosed(e,t,s){this.recordList[e]&&(this.recordList[e].isPlaying=!1)}setPlayIndex(e){this.playIndex=e}}class qe{constructor(e={},t){this.i18n=e.locale,this.el=e.el,this.$el=WSPlayerJQ.$("#"+this.el),this.$el.empty(),this.wsPlayer=t,this.prefixUrl=e.prefixUrl||"./static",this.$el&&this.__createPanTilt(),this.channel=null,this.channelCodeForPositionList=[],this.setPtzDirection=e.setPtzDirection,this.setPtzCamera=e.setPtzCamera,this.controlSitPosition=e.controlSitPosition,this.mousedownCanvasEvent=this.__mousedownCanvasEvent.bind(this),this.mousemoveCanvasEvent=this.__mousemoveCanvasEvent.bind(this),this.mouseupCanvasEvent=this.__mouseupCanvasEvent.bind(this),this.clickDirectFlag=!1,this.setPtzDirectionPromiseList=[],this.setPtzDirectionRun=!1,this.setPtzCameraPromiseList=[],this.setPtzCameraRun=!1}setChannel(e){this.channel=e&&{...e}||{};let t=this.wsPlayer.selectIndex,s=this.channelCodeForPositionList[t];if(!e)return WSPlayerJQ.$(".ws-pan-tilt-mask",this.$el).css({display:"block"}),WSPlayerJQ.$(".ws-pan-tilt-mask-position",this.$el).css({display:"none"}),void this.__removeCanvasEvent();s?s!==e.id?(this.channelCodeForPositionList[t]=null,this.__removeCanvasEvent()):this.__openSitPosition(!0):this.openSitPositionFlag&&this.__removeCanvasEvent();let i=e.capability;switch(e.cameraType+""){case"1":parseInt(i,2)&parseInt("100",2)||parseInt(i,2)&parseInt("10000000000000000",2)?WSPlayerJQ.$(".ws-pan-tilt-mask-zoom",this.$el).css({display:"none"}):WSPlayerJQ.$(".ws-pan-tilt-mask-zoom",this.$el).css({display:"block"}),parseInt(i,2)&parseInt("10000000000000000",2)?(WSPlayerJQ.$(".ws-pan-tilt-mask-direction",this.$el).css({display:"none"}),WSPlayerJQ.$(".ws-pan-tilt-mask-position",this.$el).css({display:"block"}),this.__removeCanvasEvent()):(WSPlayerJQ.$(".ws-pan-tilt-mask-direction",this.$el).css({display:"block"}),WSPlayerJQ.$(".ws-pan-tilt-mask-position",this.$el).css({display:"none"})),WSPlayerJQ.$(".ws-pan-tilt-mask-aperture",this.$el).css({display:"block"});break;case"2":WSPlayerJQ.$(".ws-pan-tilt-mask",this.$el).css({display:"none"}),WSPlayerJQ.$(".ws-pan-tilt-mask-position",this.$el).css({display:"none"});break;default:WSPlayerJQ.$(".ws-pan-tilt-mask",this.$el).css({display:"block"}),WSPlayerJQ.$(".ws-pan-tilt-mask-position",this.$el).css({display:"none"}),this.__removeCanvasEvent()}}__createPanTilt(){this.$el.append(`\n \n
\n \x3c!--云台方向控制--\x3e\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n

\n
\n
\n
\n
\n \n \x3c!--云台变倍、聚焦、光圈控制--\x3e\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n \x3c!--遮罩,当通道没有云台功能时,使用遮罩遮住云台按钮--\x3e\n \x3c!--方向按钮遮罩--\x3e\n
\n \x3c!--三维定位遮罩--\x3e\n
\n \x3c!--变倍、聚焦遮罩--\x3e\n
\n \x3c!--光圈遮罩--\x3e\n
\n
\n `),WSPlayerJQ.$(".ws-pan-tilt-circle",this.$el).mouseup((e=>{if(this.clickDirectFlag){this.clickDirectFlag=!1;let t=this.__getDirect(e.target);t&&this.__setPtzDirection(t,"0")}})),WSPlayerJQ.$(".ws-pan-tilt-circle",this.$el).mouseout(this._throttle((e=>{if(this.clickDirectFlag){this.clickDirectFlag=!1;let t=this.__getDirect(e.target);t&&this.__setPtzDirection(t,"0")}}))),WSPlayerJQ.$(".ws-pan-tilt-circle",this.$el).mousedown(this._throttle((e=>{if(!this.clickDirectFlag){let t=this.__getDirect(e.target);t&&(this.clickDirectFlag=!0,t&&this.__setPtzDirection(t,"1"))}}),1e3)),WSPlayerJQ.$(".ws-pan-tilt-control-item img",this.$el).mouseup((e=>{this.operateFlag&&(this.operateFlag=!1,this.__setPtzCamera(e.target.getAttribute("operateType"),e.target.getAttribute("direct"),"0"))})),WSPlayerJQ.$(".ws-pan-tilt-control-item img",this.$el).mouseout(this._throttle((e=>{this.operateFlag&&(this.operateFlag=!1,this.__setPtzCamera(e.target.getAttribute("operateType"),e.target.getAttribute("direct"),"0"))}))),WSPlayerJQ.$(".ws-pan-tilt-control-item img",this.$el).mousedown(this._throttle((e=>{this.operateFlag=!0,this.__setPtzCamera(e.target.getAttribute("operateType"),e.target.getAttribute("direct"),"1")}),1e3)),WSPlayerJQ.$(".ws-pan-tilt-pzt-select",this.$el).click((e=>{this.__openSitPosition(!this.openSitPositionFlag)}))}__getDirect(e){let t=e.getAttribute("direct");if(!t){let s=e.childNodes[0];s&&s.getAttribute&&(t=s.getAttribute("direct"))}return t}__setPtzDirection(e,t){const s={project:"PSDK",method:"DMS.Ptz.OperateDirect",data:{direct:e,command:t,stepX:"4",stepY:"4",channelId:this.channel.id}};if(this.setPtzDirectionPromiseList.push((()=>new Promise(((e,i)=>{this.setPtzDirection&&this.setPtzDirection(s).then((s=>{let i=s.data||s;"1"===t&&i.result&&"0"===i.result&&this.wsPlayer.sendErrorMessage(701,{insert:[s.data.lockUser.userName],apiErrorInfo:s}),e()})).catch((e=>{let s=[""];1103===(e.data||e).code&&(s=[`:${this.i18n.$t("error2084")}`]),"1"===t&&this.wsPlayer.sendErrorMessage(704,{apiErrorInfo:e,insert:s}),i()}))})))),!this.setPtzDirectionRun){let e=()=>{this.setPtzDirectionRun=!0,this.setPtzDirectionPromiseList[0]().then((()=>{})).catch((()=>{})).finally((()=>{this.setPtzDirectionPromiseList.shift(),this.setPtzDirectionPromiseList.length?e():this.setPtzDirectionRun=!1}))};e()}}__setPtzCamera(e,t,s){const i={project:"PSDK",method:"DMS.Ptz.OperateCamera",data:{operateType:e,direct:t,command:s,step:"4",channelId:this.channel.id}};if(this.setPtzCameraPromiseList.push((()=>new Promise(((e,t)=>{this.setPtzCamera&&this.setPtzCamera(i).then((t=>{let i=t.data||t;"1"===s&&i.result&&"0"===i.result&&this.wsPlayer.sendErrorMessage(701,{insert:[t.data.lockUser.userName],apiErrorInfo:t}),e()})).catch((e=>{let r=["",this.i18n.$t("video.player.ptz.zoom"),this.i18n.$t("video.player.ptz.focus"),this.i18n.$t("video.player.ptz.halo")],a=["","+","-"],l=["","",""];1103===(e.data||e).code&&(l=[r[i.data.operateType],a[i.data.direct],`:${this.i18n.$t("error2084")}`]),"1"===s&&this.wsPlayer.sendErrorMessage(703,{apiErrorInfo:e,insert:l}),t()}))})))),!this.setPtzCameraRun){let e=()=>{this.setPtzCameraRun=!0,this.setPtzCameraPromiseList[0]().then((()=>{})).catch((()=>{})).finally((()=>{this.setPtzCameraPromiseList.shift(),this.setPtzCameraPromiseList.length?e():this.setPtzCameraRun=!1}))};e()}}__openSitPosition(e){this.openSitPositionFlag=e;let t=this.wsPlayer.playerList,s=this.wsPlayer.selectIndex;this.canvasElem=t[s].pztCanvasElem,this.canvasElem.addEventListener("mousedown",this.mousedownCanvasEvent),this.canvasElem.addEventListener("mousemove",this.mousemoveCanvasEvent),this.canvasElem.addEventListener("mouseup",this.mouseupCanvasEvent),this.canvasContext=this.canvasElem.getContext("2d"),this.canvasContext.lineWidth=2,this.canvasContext.strokeStyle="#009cff",this.openSitPositionFlag?(this.channelCodeForPositionList[s]=this.channel.id,WSPlayerJQ.$(this.canvasElem).css({display:"block"}),WSPlayerJQ.$(".ws-pan-tilt-pzt-select",this.$el)[0].src=`${this.prefixUrl}/WSPlayer/icon/ptz-select-hover.svg`):(this.channelCodeForPositionList[s]=null,WSPlayerJQ.$(this.canvasElem).css({display:"none"}),WSPlayerJQ.$(".ws-pan-tilt-pzt-select",this.$el)[0].src=`${this.prefixUrl}/WSPlayer/icon/ptz-select.svg`)}__mousedownCanvasEvent(e){e.target===this.canvasElem&&(e.offsetX||e.layerX)&&(this.pointX=e.offsetX||e.layerX,this.pointY=e.offsetY||e.layerY,this.startDraw=!0)}__mousemoveCanvasEvent(e){if(e.target===this.canvasElem&&this.startDraw&&(e.offsetX||e.layerX)){const t=e.offsetX||e.layerX,s=e.offsetY||e.layerY,i=t-this.pointX,r=s-this.pointY;this.canvasContext.clearRect(0,0,this.canvasElem.width,this.canvasElem.height),this.canvasContext.beginPath(),this.canvasContext.strokeRect(this.pointX,this.pointY,i,r)}}__mouseupCanvasEvent(e){if(e.target===this.canvasElem&&(e.offsetX||e.layerX)){this.startDraw=!1;const t=e.offsetX||e.layerX,s=e.offsetY||e.layerY;let i="",r="",a="";const l=(t+this.pointX)/2,n=(s+this.pointY)/2,o=this.canvasElem.width/2,c=this.canvasElem.height/2,d=Math.abs(t-this.pointX),h=Math.abs(s-this.pointY),p=t{let t=e.data||e;t.result&&"0"===t.result&&this.wsPlayer.sendErrorMessage(701,{insert:[e.data.lockUser.userName],apiErrorInfo:e})})).catch((e=>{let t=[""];1103===(e.data||e).code&&(t[0]=`:${this.i18n.$t("error2084")}`),this.wsPlayer.sendErrorMessage(702,{apiErrorInfo:e,insert:t})}))}_throttle(e,t=300){let s=0;return function(...i){const r=(new Date).getTime();if(!(r-s{window.REModule=e}))}))},Ze=function(e){let t=`${e}/WSPlayer/commonThread/libmavasp_litepacket.data`;je(`${e}/WSPlayer/commonThread/libmavasp_litepacket.js`,(function(){ASPLite_Module.locateFile=function(e,s){return e.endsWith(".data")?t:s+e},ASPLite_Module(ASPLite_Module).then((e=>{window.ASPLiteModule=e}))}))},et=function(e){je(`${e}/WSPlayer/commonThread/libIVSDrawer.js`,(function(){IVSDrawer_Module().then((e=>{window.IVSModule=e}))}))},tt=function(e){let t=this,s=this.prefixUrl;if(window.loadLibPlayerFlag){this.config.onlyLoadSingleLib=window.onlyLoadSingleLib;let e=setTimeout((()=>{t.sendMessage("initializationCompleted"),clearTimeout(e)}),300)}else if(this.importLoad&&Ye(s),window.loadLibPlayerFlag=!0,window.m_bClientInitialized=!1,window.Module||(window.Module={}),Module.onRuntimeInitialized=function(){let e=setTimeout((()=>{window.m_nModuleInitialized=!0,t.sendMessage("initializationCompleted"),clearTimeout(e)}),300)},Module.locateFile=function(e,s){return e.endsWith(".data")?`${t.prefixUrl}/WSPlayer/multiThread/libplay.data`:s+e},this.isHttps&&e&&!this.config.onlyLoadSingleLib){try{new SharedArrayBuffer(1),function(e){je(`${e}/WSPlayer/multiThread/libplay.js`,null)}(s),function(e){je(`${e}/WSPlayer/multiThread/libStreamClient.js`,(function(){Multi_Client_Module().then((e=>{window.SCModule=e,window.SCModule._GLOBAL_Init(2),window.m_bClientInitialized=!0}))}))}(s),console.log(`%cwsplayer播放器 版本号V${ot.version} 多线程`,"background: rgb(91, 66, 181); color: #fff; font-size: 20px"),Ge(s)}catch(i){Ge(s),this.config.onlyLoadSingleLib=!0,window.onlyLoadSingleLib=this.config.onlyLoadSingleLib;let e=setTimeout((()=>{window.m_nModuleInitialized=!0,this.sendMessage("initializationCompleted"),console.log(`%cwsplayer播放器 版本号V${ot.version} 单线程`,"background: rgb(115, 189, 224); color: #fff; font-size: 20px"),clearTimeout(e)}),300)}et(s),!this.config.isWebView&&Ze(s)}else{console.log(`%c wsplayer播放器 版本号V${ot.version} 单线程`,"background: rgb(115, 189, 224); color: #fff; font-size: 20px"),Ge(s),et(s),!this.config.isWebView&&Ze(s),this.config.onlyLoadSingleLib=!0,window.onlyLoadSingleLib=this.config.onlyLoadSingleLib;let e=setTimeout((()=>{window.m_nModuleInitialized=!0,this.sendMessage("initializationCompleted"),clearTimeout(e)}),300)}};!function(e){function t(e,s){if(!(this instanceof t))return new t(e,s);if(e instanceof Node||e instanceof t){if(e.length)return e;this.length=1,this[0]=e}else if(e instanceof Array)this.length=e.length,e.forEach(((e,t)=>{this[t]=e}));else{if("string"!=typeof e)return[];if(e.startsWith("<")||e.startsWith("\n")){const t=(new DOMParser).parseFromString(e,"text/html").body.childNodes;this.length=t.length;for(let e=0;e,