1 line
10 KiB
JavaScript
1 line
10 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-1a3a5d01","chunk-688a2787"],{"0aa9":function(t,e,i){"use strict";i("dfc8")},"14f8":function(t,e,i){"use strict";i.r(e);var n=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],staticClass:"device-inline-video",attrs:{"element-loading-background":"#ffff"}},[i("el-row",{directives:[{name:"show",rawName:"v-show",value:t.total>0,expression:"total > 0"}],attrs:{gutter:10}},t._l(t.sipList,(function(e,n){return i("el-col",{key:n,staticStyle:{"margin-bottom":"10px"},attrs:{id:"deviceVideoCol",span:8}},[i("div",{staticClass:"video"},[i("player",{ref:"player_"+n,refInFor:!0,attrs:{playerinfo:{playtype:"play",deviceId:e.deviceSipId,channelId:e.channelId}}}),1===e.status?i("span",{staticClass:"status",staticStyle:{color:"#ffba00"}},[t._v(t._s(t.$t("home.notActive")))]):t._e(),2===e.status?i("span",{staticClass:"status",staticStyle:{color:"#ff4949"}},[t._v(t._s(t.$t("home.disabled")))]):t._e(),4===e.status?i("span",{staticClass:"status",staticStyle:{color:"#909399"}},[t._v(t._s(t.$t("home.offline")))]):t._e(),3===e.status?i("i",{staticClass:"el-icon-caret-right btn",on:{click:function(i){return t.handlePlay(i,e,n)}}}):t._e()],1)])})),1),0===t.total?i("el-empty",{attrs:{description:t.$t("device.inline-video.986754-0")}}):t._e(),i("pagination",{directives:[{name:"show",rawName:"v-show",value:t.total>0,expression:"total > 0"}],attrs:{total:t.total,page:t.pageNum,limit:t.pageSize,pageSizes:[9,18,27,36]},on:{"update:page":function(e){t.pageNum=e},"update:limit":function(e){t.pageSize=e},pagination:t.getSipList}})],1)},a=[],s=i("5530"),o=(i("fb6a"),i("d3b7"),i("159b"),i("2f62")),l=i("97d6"),r=i("e2de"),c={name:"DeviceInlineVideo",components:{player:l["default"]},props:{sipRelationList:{type:Array,default:function(){return[]}}},watch:{sidebarStatus:function(){this.calculatePlayerHeight()},sipRelationList:{handler:function(t,e){t&&0!==t.length&&(this.total=t.length,this.tempSipList=this.sipRelationList)},deep:!0}},computed:Object(s["a"])(Object(s["a"])({},Object(o["c"])({sidebarStatus:function(t){return t.app.sidebar.opened}})),{},{sipList:function(){var t=(this.pageNum-1)*this.pageSize,e=t+this.pageSize;return this.sipRelationList.slice(t,e)}}),data:function(){return{loading:!1,pageNum:1,pageSize:9,total:0,tempSipList:[]}},mounted:function(){this.calculatePlayerHeight(),window.addEventListener("resize",this.calculatePlayerHeight,!0),this.tempSipList=this.sipRelationList,this.total=this.sipRelationList.length},methods:{calculatePlayerHeight:function(){var t=this;t.loading=!0,setTimeout((function(){t.sipList&&t.sipList.forEach((function(e,i){var n=t.$refs["player_".concat(i)][0].$refs.container,a=document.getElementById("deviceVideoCol").offsetWidth;n.style.width=a?a-10+"px":"300px",n.style.height="230px"})),t.loading=!1}),100)},getSipList:function(t){this.pageNum=t.page,this.pageSize=t.limit},handlePlay:function(t,e,i){var n=this;Object(r["k"])(e.deviceSipId,e.channelId).then((function(e){200===e.code&&(n.$refs["player_".concat(i)][0].isInit||n.$refs["player_".concat(i)][0].init(),n.tempSipList[i].streamId=e.data.streamId,n.tempSipList[i].playurl=e.data.playurl,n.$refs["player_".concat(i)][0].play(e.data.playurl),t.target.style.visibility="hidden")}))},handleClose:function(){if(this.sipList&&0!==this.sipList.length){var t=this;this.sipList.forEach((function(e,i){t.tempSipList[i].streamId&&Object(r["c"])(e.deviceSipId,e.channelId,t.tempSipList[i].streamId).then((function(t){})),t.$refs["player_".concat(i)][0]&&t.$refs["player_".concat(i)][0].close()}))}}},destroyed:function(){this.handleClose()}},u=c,p=(i("0aa9"),i("2877")),d=Object(p["a"])(u,n,a,!1,null,"43305f81",null);e["default"]=d.exports},5169:function(t,e,i){"use strict";i("bdbe")},"97d6":function(t,e,i){"use strict";i.r(e);var n=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"root"},[i("div",{staticClass:"container-shell"},[i("div",{ref:"container",attrs:{id:"container"}})])])},a=[],s=i("c7eb"),o=i("1da1"),l=(i("a9e3"),i("ac1f"),i("00b4"),i("f5a7")),r={},c={name:"player",props:{playerinfo:{type:Object,default:null}},mounted:function(){console.log(this._uid)},watch:{playerinfo:function(t,e){console.log("playerinfo 发生变化"),this.playinfo=t,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 t=this,e="gpu"in navigator;e?(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(){t.initplayer()}))},initplayer:function(){this.isPlaybackPause=!1,this.initconf(),r[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 t=r[this._uid];this.initcallback(t),this.isInit=!0},initconf:function(){"play"===this.playtype?this.operateBtns.ptz=!0:this.operateBtns.ptz=!1},initcallback:function(t){var e=this;t.on("error",(function(t){console.log("jessibuca error"),console.log(t)})),t.on("playFailedAndPaused",(function(t,e,i){console.log("playFailedAndPaused",t,i)})),t.on("visibilityChange",(function(t){!0===t?console.log("visibilityChange true"):console.log("visibilityChange false")})),t.on("pause",(function(t){console.log("pause success!"),console.log(t)})),t.on("play",(function(t){console.log("play!"),console.log(t)})),t.on("loading",(function(t){console.log("loading success!"),console.log(t)})),t.on("stats",(function(t){console.log("stats is",t)})),t.on("timeout",(function(t){console.log("timeout:",t)})),t.on("playbackPreRateChange",(function(e){t.forward(e)}));var i=0,n=0;t.on("timeUpdate",(function(t){n=parseInt(t/6e4),i!==n&&i++})),t.on(JessibucaPro.EVENTS.ptz,(function(t){console.log("ptz arrow",t),e.handlePtz(t)})),t.on("crashLog",(function(t){console.log("crashLog is",t)}))},registercallback:function(t,e){r[this._uid]&&r[this._uid].on(t,e)},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(t){r[this._uid]&&r[this._uid].play(t)},pause:function(){r[this._uid]&&r[this._uid].pause()},replay:function(t){var e=this;r[this._uid]?r[this._uid].destroy().then((function(){e.initplayer(),e.play(t)})):(this.initplayer(),this.play(t))},handlePtz:function(t){var e=0,i=0;"left"===t?e=2:"right"===t?e=1:"up"===t?i=1:"down"===t&&(i=2);var n={leftRight:e,upDown:i,moveSpeed:125};this.playinfo&&""!==this.playinfo.playtype&&Object(l["c"])(this.playinfo.deviceId,this.playinfo.channelId,n).then(function(){var t=Object(o["a"])(Object(s["a"])().mark((function t(e){return Object(s["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())},playback:function(t,e){r[this._uid]&&(r[this._uid].playback(t,{playList:e,fps:25,showControl:!0,isUseFpsRender:!0,isCacheBeforeDecodeForFpsRender:!1,supportWheel:!0}),this.isPlaybackPause=!1)},playbackPause:function(){r[this._uid]&&(r[this._uid].playbackPause(),this.isPlaybackPause=!0)},replayback:function(t,e){var i=this;r[this._uid]?r[this._uid].destroy().then((function(){i.initplayer(),i.playback(t,e)})):(this.initplayer(),this.playback(t,e))},setPlaybackStartTime:function(t){r[this._uid]&&r[this._uid].setPlaybackStartTime(t)},destroy:function(){var t=this;r[this._uid]&&r[this._uid].destroy().then((function(){t.initplayer()}))},close:function(){r[this._uid]&&r[this._uid].close()}}},u=c,p=(i("5169"),i("2877")),d=Object(p["a"])(u,n,a,!1,null,"5072a715",null);e["default"]=d.exports},bdbe:function(t,e,i){},dfc8:function(t,e,i){},e2de:function(t,e,i){"use strict";i.d(e,"g",(function(){return a})),i.d(e,"e",(function(){return s})),i.d(e,"a",(function(){return o})),i.d(e,"d",(function(){return l})),i.d(e,"k",(function(){return r})),i.d(e,"h",(function(){return c})),i.d(e,"c",(function(){return u})),i.d(e,"i",(function(){return p})),i.d(e,"b",(function(){return d})),i.d(e,"f",(function(){return h})),i.d(e,"j",(function(){return f})),i.d(e,"l",(function(){return y}));var n=i("b775");function a(t){return Object(n["a"])({url:"/sip/channel/list",method:"get",params:t})}function s(t){return Object(n["a"])({url:"/sip/channel/"+t,method:"get"})}function o(t,e){return Object(n["a"])({url:"/sip/channel/"+t,method:"post",data:e})}function l(t){return Object(n["a"])({url:"/sip/channel/"+t,method:"delete"})}function r(t,e){return Object(n["a"])({url:"/sip/player/play/"+t+"/"+e,method:"get"})}function c(t,e,i){return Object(n["a"])({url:"/sip/player/playback/"+t+"/"+e,method:"get",params:i})}function u(t,e,i){return Object(n["a"])({url:"/sip/player/closeStream/"+t+"/"+e+"/"+i,method:"get"})}function p(t,e,i,a){return Object(n["a"])({url:"/sip/player/playbackSeek/"+t+"/"+e+"/"+i,method:"get",params:a})}function d(t){return Object(n["a"])({url:"/iot/relation/addOrUp",method:"post",data:t})}function h(t,e){return Object(n["a"])({url:"/sip/talk/getPushUrl/"+t+"/"+e,method:"get"})}function f(t,e){return Object(n["a"])({url:"/sip/talk/broadcast/"+t+"/"+e,method:"get"})}function y(t,e){return Object(n["a"])({url:"/sip/talk/broadcast/stop/"+t+"/"+e,method:"get"})}},f5a7:function(t,e,i){"use strict";i.d(e,"b",(function(){return a})),i.d(e,"a",(function(){return s})),i.d(e,"c",(function(){return o}));var n=i("b775");function a(t){return Object(n["a"])({url:"/sip/device/listchannel/"+t,method:"get"})}function s(t){return Object(n["a"])({url:"/sip/device/sipid/"+t,method:"delete"})}function o(t,e,i){return Object(n["a"])({url:"/sip/ptz/direction/"+t+"/"+e,method:"post",data:i})}}}]); |