(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-commons"],{3724:function(e,t,i){"use strict";var o=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{ref:"app",staticStyle:{width:"100%",height:"100%"},attrs:{id:"app"}},[i("video",{directives:[{name:"show",rawName:"v-show",value:e.videoShow,expression:"videoShow"}],ref:"jswebrtc",staticStyle:{width:"100%",height:"100%","object-fit":"fill"},attrs:{id:e.videoId,controls:e.controls,muted:""},domProps:{muted:!0},on:{click:e.clickVideo,dblclick:e.dbclickVideo}}),i("div",{ref:"rectArea",staticClass:"rect"}),i("div",{ref:"videoZoom",staticClass:"video-zoom"},[i("video",{directives:[{name:"show",rawName:"v-show",value:e.videoZoomShow,expression:"videoZoomShow"}],ref:"jswebrtcZoom",staticStyle:{width:"100%",height:"100%","object-fit":"fill"},attrs:{id:"zoom"+e.videoId,controls:e.controls,muted:""},domProps:{muted:!0}})]),i("canvas",{ref:"myCanvas",attrs:{id:"myCanvas"}}),i("canvas",{ref:"line",attrs:{id:"line"}}),i("div",{directives:[{name:"show",rawName:"v-show",value:e.videoShow,expression:"videoShow"}],staticClass:"buttons-box",attrs:{id:"buttonsBox"}},[i("div",{staticClass:"buttons-box-left"}),i("div",{staticClass:"buttons-box-right"},[i("i",{staticClass:"el-icon-crop jessibuca-btn",staticStyle:{"font-size":"1rem !important"},on:{click:e.screenshot}}),e.recording?e._e():i("i",{staticClass:"el-icon-video-camera jessibuca-btn",on:{click:e.recoder}}),e.recording?i("i",{staticClass:"el-icon-video-camera-solid jessibuca-btn",on:{click:e.endRecoder}}):e._e(),i("i",{staticClass:"el-icon-switch-button jessibuca-btn",on:{click:function(t){return t.stopPropagation(),e.close(t)}}})])])])},s=[],n=i("5530"),c=(i("d9e2"),i("99af"),i("7db0"),i("14d9"),i("fb6a"),i("b0c0"),i("a9e3"),i("d3b7"),i("3ca3"),i("159b"),i("ddb0"),i("2b3d"),i("bf19"),i("9861"),i("ed08")),r=i("2f62"),a=(i("c421"),i("863e")),h={name:"webrtcPlayer",props:{videoId:{type:Number,default:0},videoSrc:{type:String,default:""},controls:{type:Boolean,default:!0},cameraName:{type:String,default:""}},data:function(){return{oldSrc:"",fullscreen:!0,playing:!0,player:null,recording:!1,startRecordTime:"",timeInterval:null,time:"",recorder:null,videoData:[],videoZoomShow:!0,videoShow:!0,videoZoomFlag:!0,top:0,left:0,downX:0,downY:0,mouseX2:0,mouseY2:0,rect:null,select:!1,rectInfo:{videoWidth:0,videoHeight:0,rectWidth:0,rectHeight:0,rectCenterOffsetX:0,rectCenterOffsetY:0},reconnectTimer:null,reconnectCount:0,maxReconnectAttempts:5,shouldSaveOnStop:!0}},computed:Object(n["a"])({},Object(r["c"])(["active","boxList"])),mounted:function(){var e=this;this.$watch("videoSrc",(function(t,i){""!==t&&t!==i?(e.initVideo(e.videoSrc,e.videoId),e.rectZoomInit()):e.stop()}),{immediate:!0});var t=this.$refs.app,i=this.$refs.myCanvas,o=this.$refs.line,s=t.offsetWidth,n=t.offsetHeight;o.width=i.width=s,o.height=i.height=n},created:function(){console.log(this.fullscreen,"fullscreen"),this.getTimes()},watch:{time:function(e,t){""!==this.startRecordTime&&parseInt((Number(e)-Number(this.startRecordTime))/1e3/60)>=30&&this.endRecoder()},active:function(e,t){var i=this;setTimeout((function(){var e=i.$refs.app,t=i.$refs.myCanvas,o=i.$refs.line,s=e.offsetWidth,n=e.offsetHeight;o.width=t.width=s,o.height=t.height=n}),300)}},methods:{clickVideo:function(e){e.preventDefault()},dbclickVideo:function(e){e.preventDefault()},close:function(){this.recording?this.$message.warning("正在录像中,请先结束录像!"):this.$emit("destroy",this.videoId)},getTimes:function(){var e=this;this.timeInterval=setInterval((function(){e.time=(new Date).getTime()}),1e3)},initVideo:function(e,t){var i=this;this.player&&(this.player.pc.close(),this.player=null);var o=document.getElementById(t);this.player=new ZLMRTCClient.Endpoint({element:o,debug:!1,zlmsdpUrl:e,simulcast:!0,useCamera:!1,audioEnable:!0,videoEnable:!0,recvOnly:!0,resolution:{w:600,h:340},usedatachannel:!0}),this.player.on(ZLMRTCClient.Events.WEBRTC_ON_REMOTE_STREAMS,(function(e){o.addEventListener("canplay",(function(e){o.play()}))})),this.player.on(ZLMRTCClient.Events.WEBRTC_ON_CONNECTION_STATE_CHANGE,(function(e){console.log("当前状态==>",e),"failed"===e||"disconnected"===e||"closed"===e||"timeout"===e?(i.$message({message:"视频流连接已断开,正在尝试重连...",type:"warning"}),i.handleReconnect()):"connected"===e&&(console.log("视频流连接成功!"),i.reconnectCount=0,i.reconnectTimer&&(clearTimeout(i.reconnectTimer),i.reconnectTimer=null))})),this.player.on(ZLMRTCClient.Events.WEBRTC_ON_DATA_CHANNEL_OPEN,(function(e){})),this.player.on(ZLMRTCClient.Events.WEBRTC_ON_DATA_CHANNEL_MSG,(function(e){})),this.player.on(ZLMRTCClient.Events.WEBRTC_ON_DATA_CHANNEL_ERR,(function(e){})),this.player.on(ZLMRTCClient.Events.WEBRTC_ON_DATA_CHANNEL_CLOSE,(function(e){}))},handleReconnect:function(){var e=this;this.reconnectCountthis.downX&&this.mouseY2this.downY&&(this.rect.style.left=this.mouseX2-this.left+"px",this.rect.style.top=this.downY-this.top+"px",this.videoZoomFlag=!1),this.mouseX2>this.downX&&this.mouseY2>this.downY&&(this.rect.style.left=this.downX-this.left+"px",this.rect.style.top=this.downY-this.top+"px",this.videoZoomFlag=!0),this.rect.style.width=Math.abs(this.mouseX2-this.downX)+"px",this.rect.style.height=Math.abs(this.mouseY2-this.downY)+"px",this.rect.style.visibility="visible")},up:function(){if(this.select=!1,"hidden"!==this.rect.style.visibility){this.rectInfo.rectWidth=Math.abs(this.mouseX2-this.downX),this.rectInfo.rectHeight=Math.abs(this.mouseY2-this.downY),this.rectInfo.rectCenterOffsetX=parseInt(this.rect.style.left)+this.rectInfo.rectWidth/2,this.rectInfo.rectCenterOffsetY=parseInt(this.rect.style.top)+this.rectInfo.rectHeight/2;var e=this.rectInfo.rectWidth/this.rectInfo.rectHeight,t=this.rectInfo.videoWidth/this.rectInfo.videoHeight;ethis.rectInfo.videoWidth&&(this.rectInfo.rectCenterOffsetX=this.rectInfo.videoWidth-this.rectInfo.rectWidth/2)):e>t&&(this.rectInfo.rectHeight=this.rectInfo.rectWidth/t,this.rectInfo.rectCenterOffsetYthis.rectInfo.videoHeight&&(this.rectInfo.rectCenterOffsetY=this.rectInfo.videoHeight-this.rectInfo.rectHeight/2)),this.handleVideo()}this.resetRect()},handleVideo:function(){if(this.rectInfo.videoWidth/this.rectInfo.rectWidth<=10&&this.videoZoomFlag){var e=this.rectInfo.videoWidth/this.rectInfo.rectWidth;this.videoZoomShow||(this.$refs.videoZoom.style.width=this.rectInfo.videoWidth*e+"px",this.$refs.videoZoom.style.height=9/16*this.rectInfo.videoWidth*e+"px",this.$refs.videoZoom.style.top=-(this.rectInfo.rectCenterOffsetY-this.rectInfo.rectHeight/2)*e+"px",this.$refs.videoZoom.style.left=-(this.rectInfo.rectCenterOffsetX-this.rectInfo.rectWidth/2)*e+"px",this.initVideo(this.videoSrc,"zoom"+this.videoId),this.videoShow=!1,this.videoZoomShow=!0)}else this.videoZoomShow&&(this.$refs.videoZoom.style.width="0px",this.$refs.videoZoom.style.height="0px",this.initVideo(this.videoSrc,this.videoId),this.videoShow=!0,this.videoZoomShow=!1)},resetRect:function(){document.removeEventListener("mouseup",this.up),this.rect.style.visibility="hidden",this.rect.style.width="0px",this.rect.style.height="0px",this.top=0,this.left=0,this.downX=0,this.downY=0,this.mouseX2=0,this.mouseY2=0,this.rect=null,this.rectInfo={videoWidth:0,videoHeight:0,rectWidth:0,rectHeight:0,rectCenterOffsetX:0,rectCenterOffsetY:0}}},beforeDestroy:function(){this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.player&&(this.player.pc.close(),this.player=null)},destroyed:function(){clearInterval(this.timeInterval)}},d=h,l=(i("3cb1"),i("2877")),u=Object(l["a"])(d,o,s,!1,null,"e798ca46",null);t["a"]=u.exports},"3cb1":function(e,t,i){"use strict";i("a4ea")},8527:function(e,t,i){},a4ea:function(e,t,i){},badc:function(e,t,i){"use strict";var o=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{ref:"container"},[i("div",{staticClass:"buttons-box-top",attrs:{id:"buttonsBox"}},[i("div",{staticClass:"buttons-box-left"}),i("div",{directives:[{name:"show",rawName:"v-show",value:e.showButtonBox,expression:"showButtonBox"}],staticClass:"buttons-box-right"},[i("i",{staticClass:"el-icon-crop jessibuca-btn",staticStyle:{"font-size":"1rem !important"},on:{click:e.screenshot}}),e.recording?e._e():i("i",{staticClass:"el-icon-video-camera jessibuca-btn",on:{click:e.startRecord}}),e.recording?i("i",{staticClass:"el-icon-video-camera-solid jessibuca-btn",on:{click:function(t){return e.stopRecording(!0)}}}):e._e(),i("i",{staticClass:"el-icon-switch-button jessibuca-btn",on:{click:e.destroy}})])]),i("div",{directives:[{name:"show",rawName:"v-show",value:e.showButtonBox,expression:"showButtonBox"}],staticClass:"buttons-box",attrs:{id:"buttonsBox"}},[i("div",{staticClass:"buttons-box-left"},[e.playing?e._e():i("i",{staticClass:"el-icon-video-play jessibuca-btn",on:{click:e.playBtnClick}}),e.playing?i("i",{staticClass:"el-icon-video-pause jessibuca-btn",on:{click:e.pause}}):e._e(),e.isNotMute?i("i",{staticClass:"el-icon-bell jessibuca-btn",on:{click:function(t){return e.mute()}}}):e._e(),e.isNotMute?e._e():i("i",{staticClass:"el-icon-close-notification jessibuca-btn",on:{click:function(t){return e.cancelMute()}}})]),i("div",{staticClass:"buttons-box-right"},[e.fullscreen?e._e():i("i",{staticClass:"el-icon-full-screen jessibuca-btn",on:{click:e.fullscreenSwich}}),e.fullscreen?i("i",{staticClass:"el-icon-rank jessibuca-btn",on:{click:e.fullscreenSwich}}):e._e()])])])},s=[],n=i("5530"),c=(i("d9e2"),i("99af"),i("7db0"),i("fb6a"),i("b0c0"),i("a9e3"),i("d3b7"),i("3ca3"),i("ddb0"),i("2b3d"),i("bf19"),i("9861"),i("ed08")),r=i("bfa9"),a=i("2f62"),h=i("74f3"),d=i("784a");Object(r["b"])(h["l"],h["m"]);var l={},u={name:"jessibuca",data:function(){return{playing:!1,recording:!1,startRecordTime:"",time:"",timeInterval:null,isNotMute:!1,quieting:!1,fullscreen:!1,loaded:!1,speed:0,performance:"",kBps:0,btnDom:null,videoInfo:null,volume:1,rotate:0,vod:!0,forceNoOffscreen:!1,jessibuca:{},timer:null}},props:{videoUrl:{type:String,default:""},cameraName:{type:String,default:""},hasAudio:{type:Boolean,default:!0},showButtonBox:{type:Boolean,default:!0}},computed:Object(n["a"])({},Object(a["c"])(["active","boxList"])),mounted:function(){console.log("init"),this.init()},created:function(){this.getTimes()},watch:{videoUrl:function(e,t){this.play(e)},time:function(e,t){""!==this.startRecordTime&&parseInt((Number(e)-Number(this.startRecordTime))/1e3/60)>=30&&this.stopRecordAndSave()}},methods:{init:function(){var e=this,t=decodeURIComponent(this.$route.params.url);this.$nextTick((function(){"undefined"==typeof e.videoUrl&&(e.videoUrl=t),e.btnDom=document.getElementById("buttonsBox"),e.play(e.videoUrl)}))},getTimes:function(){var e=this;this.timeInterval=setInterval((function(){e.time=(new Date).getTime()}),1e3)},updatePlayerDomSize:function(){var e=this.$refs.container;if(document.querySelector(".childBox")){var t=document.querySelector(".childBox").clientWidth,i=9/16*t,o=Math.min(document.body.clientHeight,document.documentElement.clientHeight);i>o&&(i=o,t=16/9*i),e&&(e.style.width=t+"px"),e&&(e.style.height=i+"px")}},create:function(){var e=this,t={};l[this._uid]=new d["a"](Object.assign({container:this.$refs.container,autoWasm:!0,background:"",controlAutoHide:!1,debug:!1,decoder:"/hz-player/src/hzPlayer/decoder-pro.js",forceNoOffscreen:!0,hasAudio:"undefined"==typeof this.hasAudio||this.hasAudio,hasVideo:!0,heartTimeout:5,heartTimeoutReplay:!0,heartTimeoutReplayTimes:3,hiddenAutoPause:!1,hotKey:!1,isFlv:!1,isFullResize:!1,isNotMute:this.isNotMute,isResize:!1,keepScreenOn:!1,loadingText:"请稍等, 视频加载中......",loadingTimeout:10,loadingTimeoutReplay:!0,loadingTimeoutReplayTimes:3,openWebglAlignment:!1,operateBtns:{fullscreen:!1,screenshot:!1,play:!1,audio:!1,record:!1},recordType:"webm",rotate:0,showBandwidth:!1,supportDblclickFullscreen:!1,timeout:10,useWebFullScreen:!1,videoBuffer:0,wasmDecodeAudioSyncVideo:!0,wasmDecodeErrorReplay:!0,wcsUseVideoRender:!0},t));var i=l[this._uid],o=this;i.on("load",(function(){console.log("on load init")})),i.on("log",(function(e){console.log("on log",e)})),i.on("record",(function(e){console.log("on record:",e)})),i.on("pause",(function(){o.playing=!1})),i.on("play",(function(){o.playing=!0})),i.on("fullscreen",(function(e){console.log("on fullscreen",e),o.fullscreen=e})),i.on("mute",(function(e){console.log("on mute",e),o.isNotMute=!e})),i.on("audioInfo",(function(e){console.log("audioInfo",e)})),i.on("bps",(function(e){}));i.on("timeUpdate",(function(e){e})),i.on("videoInfo",(function(e){console.log("videoInfo",e)})),i.on("error",(function(e){console.log("error",e)})),i.on("timeout",(function(){console.log("timeout")})),i.on("start",(function(){console.log("start"),e.$emit("autoplay",!0)})),i.on("performance",(function(e){var t="卡顿";2===e?t="非常流畅":1===e&&(t="流畅"),o.performance=t})),i.on("buffer",(function(e){})),i.on("stats",(function(e){})),i.on("kBps",(function(e){o.kBps=Math.round(e)})),i.on("videoFrame",(function(){})),i.on("metadata",(function(){})),this.jessibuca=i},playBtnClick:function(e){this.play(this.videoUrl)},play:function(e){var t=this;console.log(e),l[this._uid]&&this.destroy(),this.create(),l[this._uid].on("play",(function(){t.playing=!0,t.loaded=!0,t.quieting=t.jessibuca.quieting})),l[this._uid].hasLoaded()?l[this._uid].play(e):l[this._uid].on("load",(function(){console.log("load 播放"),l[t._uid].play(e)}))},pause:function(){l[this._uid]&&l[this._uid].pause(),this.playing=!1,this.err="",this.performance=""},getCurrentDateTime:function(){var e=new Date,t=e.getFullYear(),i=("0"+(e.getMonth()+1)).slice(-2),o=("0"+e.getDate()).slice(-2),s=("0"+e.getHours()).slice(-2),n=("0"+e.getMinutes()).slice(-2),c=("0"+e.getSeconds()).slice(-2);return"".concat(t,"-").concat(i,"-").concat(o,"-").concat(s,"-").concat(n,"-").concat(c)},screenshot:function(){var e=this,t=this.getCurrentDateTime();console.log(this.boxList);var i=this.boxList.find((function(t){return t.url===e.videoUrl}));console.log(i);var o="".concat(t,"-").concat(this.cameraName,"-").concat(this.$store.getters.name,".jpg"),s="/prod-api"+"/downloadSnapshot?streamUrl=".concat(i.rtsp,"&fileName=").concat(o);fetch(s,{method:"GET",headers:{Accept:"application/octet-stream"},mode:"cors",cache:"no-cache"}).then((function(e){if(!e.ok)throw new Error("HTTP error! status: ".concat(e.status));return e.blob()})).then((function(t){e.$message({message:"截图成功",type:"success"});var i=document.createElement("a");i.href=URL.createObjectURL(t),i.setAttribute("download",o),document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(i.href)})).catch((function(e){return console.error("Error downloading file:",e)}))},startRecord:function(){l[this._uid]&&(this.recording=!0,this.boxList[this.videoId-1].recording=!0,this.startRecordTime=(new Date).getTime(),l[this._uid].startRecord("".concat(Object(c["e"])((new Date).getTime()),"-").concat(this.cameraName,"-").concat(this.$store.getters.name),"mp4"))},stopRecordAndSave:function(){l[this._uid]&&(this.recording=!1,parseInt((Number((new Date).getTime())-Number(this.startRecordTime))/1e3)<=10?this.$message({message:"无效录像,录像时间太短,大于10s录像开始保存",type:"warning"}):l[this._uid].stopRecordAndSave(),this.startRecordTime="")},stopRecording:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.recording&&l[this._uid]){console.log("jessibucaPlayer ".concat(this._uid," 停止录像, shouldSave: ").concat(e)),this.recording=!1,this.boxList[this.videoId-1].recording=!1;var t=parseInt((Number((new Date).getTime())-Number(this.startRecordTime))/1e3);t<=10?this.$message({message:"无效录像,录像时间太短,大于10s录像开始保存",type:"warning"}):e?(this.$message({message:"结束录像,正在保存...",type:"success"}),l[this._uid].stopRecordAndSave()):this.$message({message:"录像已停止,未保存",type:"info"}),this.startRecordTime=""}},isRecording:function(){return l[this._uid].isRecording()},mute:function(){l[this._uid]&&l[this._uid].mute()},cancelMute:function(){l[this._uid]&&l[this._uid].cancelMute()},destroy:function(){l[this._uid]&&l[this._uid].destroy(),l[this._uid]=null,this.playing=!1,this.err="",this.performance="",clearInterval(this.timer),clearInterval(this.timeInterval),this.timer=null,this.timeInterval=null,this.$emit("destroy")},eventcallbacK:function(e,t){},fullscreenSwich:function(){var e=this.isFullscreen();l[this._uid].setFullscreen(!e),this.fullscreen=!e},isFullscreen:function(){return document.fullscreenElement||document.msFullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||!1},addSubscribe:function(){var e=this;this.$store.subscribe((function(t,i){"updateActive"===t.type&&e.updatePlayerDomSize()}))}},destroyed:function(){l[this._uid]&&l[this._uid].destroy(),this.playing=!1,this.loaded=!1,this.performance="",clearInterval(this.timeInterval)}},f=u,m=(i("cff4"),i("2877")),p=Object(m["a"])(f,o,s,!1,null,"658ec9ea",null);t["a"]=p.exports},cff4:function(e,t,i){"use strict";i("8527")}}]);