1 line
14 KiB
JavaScript
1 line
14 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-04943632","chunk-688a2787"],{5169:function(e,t,i){"use strict";i("bdbe")},6827:function(e,t,i){"use strict";i.d(t,"a",(function(){return a})),i.d(t,"b",(function(){return s})),i.d(t,"c",(function(){return o})),i.d(t,"e",(function(){return r})),i.d(t,"d",(function(){return c})),i.d(t,"g",(function(){return l})),i.d(t,"f",(function(){return d})),i.d(t,"h",(function(){return u}));var n=i("b775");function a(e,t,i){return Object(n["a"])({url:"/sip/record/devquery/"+e+"/"+t,method:"get",params:i})}function s(e){return Object(n["a"])({url:"/sip/record/serverRecord/list",method:"get",params:e})}function o(e){return Object(n["a"])({url:"/sip/record/serverRecord/date/list",method:"get",params:e})}function r(e){return Object(n["a"])({url:"/sip/record/serverRecord/file/list",method:"get",params:e})}function c(e){return Object(n["a"])({url:"/sip/record/serverRecord/device/list",method:"get",params:e})}function l(e,t){return Object(n["a"])({url:"/sip/record/play/"+e+"/"+t,method:"get"})}function d(e,t,i){return Object(n["a"])({url:"/sip/record/download/"+e+"/"+t,method:"get",params:i})}function u(e){return Object(n["a"])({url:"/sip/record/upload",method:"get",params:e})}},"97d6":function(e,t,i){"use strict";i.r(t);var n=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"root"},[i("div",{staticClass:"container-shell"},[i("div",{ref:"container",attrs:{id:"container"}})])])},a=[],s=i("c7eb"),o=i("1da1"),r=(i("a9e3"),i("ac1f"),i("00b4"),i("f5a7")),c={},l={name:"player",props:{playerinfo:{type:Object,default:null}},mounted:function(){console.log(this._uid)},watch:{playerinfo:function(e,t){console.log("playerinfo 发生变化"),this.playinfo=e,this.playinfo&&""!==this.playinfo.playtype&&(this.playtype=this.playinfo.playtype)}},jessibuca:null,data:function(){return{isPlaybackPause:!1,useWebGPU:!1,isInit:!1,playinfo:{},playtype:"play",operateBtns:{fullscreen:!0,zoom:!0,play:!0,audio:!0}}},beforeDestroy:function(){},created:function(){this.playinfo=this.playerinfo,this.playinfo&&""!==this.playinfo.playtype&&(this.playtype=this.playinfo.playtype),this.init()},methods:{init:function(){var e=this,t="gpu"in navigator;t?(console.log("支持webGPU"),this.useWebGPU=!0):(console.log("暂不支持webGPU,降级到webgl渲染"),this.useWebGPU=!1);var i=this.isMobile()||this.isPad();i&&window.VConsole&&new window.VConsole,this.$nextTick((function(){e.initplayer()}))},initplayer:function(){this.isPlaybackPause=!1,this.initconf(),c[this._uid]=new window.JessibucaPro({container:this.$refs.container,decoder:"/js/jessibuca-pro/decoder-pro.js",videoBuffer:Number(.2),isResize:!1,useWCS:!1,useMSE:!1,useSIMD:!0,wcsUseVideoRender:!1,loadingText:"加载中",debug:!1,debugLevel:"debug",showBandwidth:!0,showPlaybackOperate:!0,operateBtns:this.operateBtns,forceNoOffscreen:!0,isNotMute:!0,showPerformance:!1,playbackForwardMaxRateDecodeIFrame:4,useWebGPU:this.useWebGPU});var e=c[this._uid];this.initcallback(e),this.isInit=!0},initconf:function(){"play"===this.playtype?this.operateBtns.ptz=!0:this.operateBtns.ptz=!1},initcallback:function(e){var t=this;e.on("error",(function(e){console.log("jessibuca error"),console.log(e)})),e.on("playFailedAndPaused",(function(e,t,i){console.log("playFailedAndPaused",e,i)})),e.on("visibilityChange",(function(e){!0===e?console.log("visibilityChange true"):console.log("visibilityChange false")})),e.on("pause",(function(e){console.log("pause success!"),console.log(e)})),e.on("play",(function(e){console.log("play!"),console.log(e)})),e.on("loading",(function(e){console.log("loading success!"),console.log(e)})),e.on("stats",(function(e){console.log("stats is",e)})),e.on("timeout",(function(e){console.log("timeout:",e)})),e.on("playbackPreRateChange",(function(t){e.forward(t)}));var i=0,n=0;e.on("timeUpdate",(function(e){n=parseInt(e/6e4),i!==n&&i++})),e.on(JessibucaPro.EVENTS.ptz,(function(e){console.log("ptz arrow",e),t.handlePtz(e)})),e.on("crashLog",(function(e){console.log("crashLog is",e)}))},registercallback:function(e,t){c[this._uid]&&c[this._uid].on(e,t)},isMobile:function(){return/iphone|ipad|android.*mobile|windows.*phone|blackberry.*mobile/i.test(window.navigator.userAgent.toLowerCase())},isPad:function(){return/ipad|android(?!.*mobile)|tablet|kindle|silk/i.test(window.navigator.userAgent.toLowerCase())},play:function(e){c[this._uid]&&c[this._uid].play(e)},pause:function(){c[this._uid]&&c[this._uid].pause()},replay:function(e){var t=this;c[this._uid]?c[this._uid].destroy().then((function(){t.initplayer(),t.play(e)})):(this.initplayer(),this.play(e))},handlePtz:function(e){var t=0,i=0;"left"===e?t=2:"right"===e?t=1:"up"===e?i=1:"down"===e&&(i=2);var n={leftRight:t,upDown:i,moveSpeed:125};this.playinfo&&""!==this.playinfo.playtype&&Object(r["c"])(this.playinfo.deviceId,this.playinfo.channelId,n).then(function(){var e=Object(o["a"])(Object(s["a"])().mark((function e(t){return Object(s["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())},playback:function(e,t){c[this._uid]&&(c[this._uid].playback(e,{playList:t,fps:25,showControl:!0,isUseFpsRender:!0,isCacheBeforeDecodeForFpsRender:!1,supportWheel:!0}),this.isPlaybackPause=!1)},playbackPause:function(){c[this._uid]&&(c[this._uid].playbackPause(),this.isPlaybackPause=!0)},replayback:function(e,t){var i=this;c[this._uid]?c[this._uid].destroy().then((function(){i.initplayer(),i.playback(e,t)})):(this.initplayer(),this.playback(e,t))},setPlaybackStartTime:function(e){c[this._uid]&&c[this._uid].setPlaybackStartTime(e)},destroy:function(){var e=this;c[this._uid]&&c[this._uid].destroy().then((function(){e.initplayer()}))},close:function(){c[this._uid]&&c[this._uid].close()}}},d=l,u=(i("5169"),i("2877")),h=Object(u["a"])(d,n,a,!1,null,"5072a715",null);t["default"]=h.exports},bdbe:function(e,t,i){},e2de:function(e,t,i){"use strict";i.d(t,"g",(function(){return a})),i.d(t,"e",(function(){return s})),i.d(t,"a",(function(){return o})),i.d(t,"d",(function(){return r})),i.d(t,"k",(function(){return c})),i.d(t,"h",(function(){return l})),i.d(t,"c",(function(){return d})),i.d(t,"i",(function(){return u})),i.d(t,"b",(function(){return h})),i.d(t,"f",(function(){return p})),i.d(t,"j",(function(){return f})),i.d(t,"l",(function(){return y}));var n=i("b775");function a(e){return Object(n["a"])({url:"/sip/channel/list",method:"get",params:e})}function s(e){return Object(n["a"])({url:"/sip/channel/"+e,method:"get"})}function o(e,t){return Object(n["a"])({url:"/sip/channel/"+e,method:"post",data:t})}function r(e){return Object(n["a"])({url:"/sip/channel/"+e,method:"delete"})}function c(e,t){return Object(n["a"])({url:"/sip/player/play/"+e+"/"+t,method:"get"})}function l(e,t,i){return Object(n["a"])({url:"/sip/player/playback/"+e+"/"+t,method:"get",params:i})}function d(e,t,i){return Object(n["a"])({url:"/sip/player/closeStream/"+e+"/"+t+"/"+i,method:"get"})}function u(e,t,i,a){return Object(n["a"])({url:"/sip/player/playbackSeek/"+e+"/"+t+"/"+i,method:"get",params:a})}function h(e){return Object(n["a"])({url:"/iot/relation/addOrUp",method:"post",data:e})}function p(e,t){return Object(n["a"])({url:"/sip/talk/getPushUrl/"+e+"/"+t,method:"get"})}function f(e,t){return Object(n["a"])({url:"/sip/talk/broadcast/"+e+"/"+t,method:"get"})}function y(e,t){return Object(n["a"])({url:"/sip/talk/broadcast/stop/"+e+"/"+t,method:"get"})}},f5a7:function(e,t,i){"use strict";i.d(t,"b",(function(){return a})),i.d(t,"a",(function(){return s})),i.d(t,"c",(function(){return o}));var n=i("b775");function a(e){return Object(n["a"])({url:"/sip/device/listchannel/"+e,method:"get"})}function s(e){return Object(n["a"])({url:"/sip/device/sipid/"+e,method:"delete"})}function o(e,t,i){return Object(n["a"])({url:"/sip/ptz/direction/"+e+"/"+t,method:"post",data:i})}},f5fc:function(e,t,i){"use strict";i.r(t);var n=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("el-row",{staticStyle:{"margin-bottom":"16px"},attrs:{gutter:20}},[i("el-col",{attrs:{span:1.5}},[i("el-select",{staticStyle:{width:"190px"},attrs:{placeholder:e.$t("views.components.player.deviceLiveStream.48750-1")},on:{change:e.changeChannel},model:{value:e.channelId,callback:function(t){e.channelId=t},expression:"channelId"}},e._l(e.channelList,(function(e){return i("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1),i("el-col",{attrs:{span:1.5}},[i("el-date-picker",{staticStyle:{width:"150px","margin-right":"10px"},attrs:{type:"date","value-format":"yyyy-MM-dd",clearable:"",placeholder:e.$t("views.components.player.deviceVideo.808340-3")},model:{value:e.queryDate,callback:function(t){e.queryDate=t},expression:"queryDate"}})],1),i("el-col",{staticStyle:{"margin-right":"30px"},attrs:{span:1.5}},[i("el-button",{attrs:{type:"primary",title:e.$t("views.components.player.deviceVideo.808340-4"),disabled:""===e.channelId||!e.queryDate},on:{click:function(t){return e.loadDevRecord()}}},[i("i",{staticClass:"el-icon-video-camera"}),e._v(" "+e._s(e.$t("views.components.player.deviceVideo.808340-5"))+" ")])],1),i("el-col",{attrs:{span:1.5}},[i("el-time-picker",{staticStyle:{width:"210px","margin-right":"10px"},attrs:{"is-range":"","value-format":"yyyy-MM-dd HH:mm:ss","range-separator":e.$t("views.components.player.deviceVideo.808340-7"),"start-placeholder":e.$t("views.components.player.deviceVideo.808340-8"),"end-placeholder":e.$t("views.components.player.deviceVideo.808340-9"),placeholder:e.$t("views.components.player.deviceVideo.808340-10"),disabled:""===e.channelId||!e.queryDate},on:{change:e.timePickerChange},model:{value:e.timeRange,callback:function(t){e.timeRange=t},expression:"timeRange"}})],1),i("el-col",{attrs:{span:1.5}},[i("el-button",{attrs:{type:"primary",title:e.$t("views.components.player.deviceVideo.808340-11"),disabled:""===e.channelId||!e.timeRange},on:{click:function(t){return e.downloadRecord()}}},[i("i",{staticClass:"el-icon-download"}),e._v(" "+e._s(e.$t("views.components.player.deviceVideo.808340-12"))+" ")])],1)],1),i("player",{ref:"playbacker",attrs:{playerinfo:e.playinfo}})],1)},a=[],s=(i("d81d"),i("d3b7"),i("97d6")),o=i("e2de"),r=i("6827"),c={name:"DeviceVideo",components:{player:s["default"]},data:function(){return{deviceId:"",channelId:"",streamId:"",ssrc:"",playurl:"",queryDate:"",playing:!1,vodData:{},hisData:[],playinfo:{},channelList:[],playbackinfo:{},timeRange:null,startTime:null,endTime:null,queryParams:{pageNum:1,pageSize:10,deviceSipId:null,channelSipId:null}}},props:{device:{type:Object,default:null}},watch:{device:function(e,t){this.deviceInfo=e,this.deviceInfo&&0!==this.deviceInfo.deviceId&&(this.queryParams.deviceSipId=this.deviceInfo.serialNumber,this.deviceId=this.device.serialNumber)}},created:function(){this.queryParams.deviceSipId=this.device.serialNumber,this.deviceId=this.device.serialNumber,this.getList(),this.playinfo={playtype:"playback",deviceId:this.device.serialNumber}},beforeDestroy:function(){this.closeStream()},methods:{getList:function(){var e=this;this.loading=!0,Object(o["g"])(this.queryParams).then((function(t){e.channelList=t.rows.map((function(e){return{value:e.channelSipId,label:e.channelName}}))}))},changeChannel:function(){this.playinfo.channelId=this.channelId},initUrl:function(e){e?(this.streamId=e.ssrc,this.ssrc=e.ssrc,this.playurl=e.playurl):(this.streamId="",this.ssrc="",this.playurl="")},getBeijingTime:function(e){var t=288e5,i=new Date(new Date(e).getTime()-t);return i.getTime()},loadDevRecord:function(){var e=this;if(this.$refs.playbacker.registercallback("playbackSeek",this.seekPlay),""!==this.queryDate&&null!==this.queryDate){if(this.deviceId&&this.channelId){var t=this.getBeijingTime(this.queryDate),i=t/1e3,n=Math.floor((t+864e5-1)/1e3),a={start:i,end:n};this.vodData={start:i,end:n,base:i},this.setTime(this.queryDate+" 00:00:00",this.queryDate+" 23:59:59"),Object(r["a"])(this.deviceId,this.channelId,a).then((function(t){if(e.hisData=t.data.recordItems,t.data.recordItems){var a=e.hisData.length;a>0?(e.hisData[0].start<i?(e.hisData[0].start=i,e.vodData.start=i):e.vodData.start=e.hisData[0].start,0!==e.hisData[0].end&&e.hisData[0].end<n&&(e.vodData.end=e.hisData[0].end),e.playback()):e.$message({type:"warning",message:e.$t("views.components.player.deviceVideo.808340-14")})}else e.$message({type:"warning",message:e.$t("views.components.player.deviceVideo.808340-14")})}))}}else this.$message.error(this.$t("views.components.player.deviceVideo.808340-13"))},playback:function(){var e=this,t={start:this.vodData.start,end:this.vodData.end};this.ssrc?Object(o["c"])(this.deviceId,this.channelId,this.ssrc).then((function(i){Object(o["h"])(e.deviceId,e.channelId,t).then((function(t){e.initUrl(t.data)})).finally((function(){e.triggerPlay(e.hisData)}))})):Object(o["h"])(this.deviceId,this.channelId,t).then((function(t){e.initUrl(t.data)})).finally((function(){e.triggerPlay(e.hisData)}))},triggerPlay:function(e){this.$refs.playbacker.playback(this.playurl,e),this.playing=!0},seekPlay:function(e){console.log("seekPlay: ["+e+"]");var t=this.vodData.base+3600*e.hour+60*e.min+e.second;console.log("curTime: ["+t+"]"),console.log("start: ["+this.vodData.start+"]");var i=t-this.vodData.start;if(console.log("seekRange: ["+i+"]"),this.ssrc){var n={seek:i},a=this,s=(new Date).setHours(e.hour,e.min,e.second,0);Object(o["i"])(this.deviceId,this.channelId,this.streamId,n).then((function(e){console.log("setPlaybackStartTime: ["+t+"]"),console.log("setPlaybackStartTime: ["+s+"]"),a.$refs.playbacker.setPlaybackStartTime(1e3*t)}))}},closeStream:function(){var e=this;this.playing&&this.streamId&&(console.log("关闭推流: ["+this.playing+"]"),console.log("关闭推流: ["+this.streamId+"]"),Object(o["c"])(this.deviceId,this.channelId,this.streamId).then((function(t){e.streamId="",e.ssrc="",e.playurl="",e.playing=!1})))},destroy:function(){this.playing&&this.streamId&&this.$refs.playbacker.destroy()},closeDestroy:function(){this.closeStream(),this.destroy()},timePickerChange:function(e){this.setTime(e[0],e[1])},setTime:function(e,t){this.startTime=e,this.endTime=t,this.timeRange=[e,t]},downloadRecord:function(){var e=this,t=new Date(this.startTime).getTime()/1e3,i=new Date(this.endTime).getTime()/1e3,n={startTime:t,endTime:i,speed:"4"};Object(r["f"])(this.deviceId,this.channelId,n).then((function(t){console.log("开始转存到流服务器:"+e.deviceId+" : "+e.channelId),200===t.code&&e.$message({type:"success",message:e.$t("views.components.player.deviceVideo.808340-15")})}))}}},l=c,d=i("2877"),u=Object(d["a"])(l,n,a,!1,null,null,null);t["default"]=u.exports}}]); |