1 line
6.3 KiB
JavaScript
1 line
6.3 KiB
JavaScript
![]() |
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-4fdc3fc4"],{"01a2":function(t,e,n){},"3c52":function(t,e,n){"use strict";n("01a2")},8076:function(t,e,n){"use strict";n.r(e);var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"player-webrtc"},[n("el-row",{staticStyle:{"margin-bottom":"16px"},attrs:{gutter:10}},[n("el-col",{attrs:{span:1.5}},[n("el-select",{attrs:{placeholder:t.$t("views.components.player.webrtc.08878-1"),clearable:""},on:{change:function(e){return t.changeChannel()}},model:{value:t.channelId,callback:function(e){t.channelId=e},expression:"channelId"}},t._l(t.channelList,(function(t){return n("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})})),1)],1)],1),n("div",{staticClass:"trank-wrap"},[n("el-button",{staticClass:"btn",attrs:{type:t.getBroadcastStatus(),disabled:-2===t.broadcastStatus||""===t.channelId,circle:"",icon:"el-icon-microphone"},on:{click:function(e){return t.broadcastStatusClick()}}}),n("div",{staticClass:"title-wrap"},[-2===t.broadcastStatus?n("span",[t._v(t._s(t.$t("views.components.player.webrtc.08878-2")))]):t._e(),-1===t.broadcastStatus?n("span",[t._v(t._s(t.$t("views.components.player.webrtc.08878-3")))]):t._e(),0===t.broadcastStatus?n("span",[t._v(t._s(t.$t("views.components.player.webrtc.08878-4")))]):t._e(),1===t.broadcastStatus?n("span",[t._v(t._s(t.$t("views.components.player.webrtc.08878-5")))]):t._e()])],1)],1)},s=[],c=(n("caad"),n("d81d"),n("2532"),n("e2de")),r={name:"webrtc",components:{},props:{device:{type:Object,default:null}},watch:{device:function(t,e){this.deviceInfo=t,this.deviceInfo.channelId&&(this.channelId=this.deviceInfo.channelId),this.deviceInfo&&0!==this.deviceInfo.deviceId&&(this.queryParams.deviceSipId=this.deviceInfo.serialNumber,this.deviceId=this.device.serialNumber)}},data:function(){return{deviceInfo:null,deviceId:"",channelId:"",broadcastMode:!0,broadcastRtc:null,broadcastStatus:-1,channelList:[],queryParams:{pageNum:1,pageSize:10,deviceSipId:null,channelSipId:null}}},created:function(){this.queryParams.deviceSipId=this.device.serialNumber,this.deviceId=this.device.serialNumber,this.getList()},destroyed:function(){},methods:{getList:function(){var t=this;Object(c["g"])(this.queryParams).then((function(e){t.channelList=e.rows.map((function(t){return{value:t.channelSipId,label:t.channelName}})),console.log(t.channelList)}))},changeChannel:function(){},getBroadcastStatus:function(){return-2==this.broadcastStatus||-1==this.broadcastStatus?"primary":0==this.broadcastStatus?"warning":1==this.broadcastStatus?"danger":void 0},broadcastStatusClick:function(){var t=this;-1==this.broadcastStatus?(this.broadcastStatus=0,Object(c["f"])(this.deviceId,this.channelId).then((function(e){if(console.log(e),200===e.code){var n=e.data;document.location.protocol.includes("https")?t.startwebrtc(n.rtcs):t.startwebrtc(n.rtc)}else t.$message({showClose:!0,message:e.msg,type:"error"})}))):1===this.broadcastStatus&&(this.broadcastStatus=-1,this.broadcastRtc.close())},startwebrtc:function(t){var e=this;this.broadcastRtc=new ZLMRTCClient.Endpoint({debug:!0,zlmsdpUrl:t,simulecast:!1,useCamera:!1,audioEnable:!0,videoEnable:!1,recvOnly:!1}),this.broadcastRtc.on(ZLMRTCClient.Events.WEBRTC_NOT_SUPPORT,(function(t){console.error("不支持webrtc",t),e.$message({showClose:!0,message:e.$t("views.components.player.webrtc.08878-6"),type:"error"}),e.broadcastStatus=-1})),this.broadcastRtc.on(ZLMRTCClient.Events.WEBRTC_ICE_CANDIDATE_ERROR,(function(t){console.error("ICE 协商出错"),e.$message({showClose:!0,message:e.$t("views.components.player.webrtc.08878-7"),type:"error"}),e.broadcastStatus=-1})),this.broadcastRtc.on(ZLMRTCClient.Events.WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED,(function(t){console.error("offer anwser 交换失败",t),e.$message({showClose:!0,message:e.$t("views.components.player.webrtc.08878-8")+t,type:"error"}),e.broadcastStatus=-1})),this.broadcastRtc.on(ZLMRTCClient.Events.WEBRTC_ON_CONNECTION_STATE_CHANGE,(function(t){console.log("状态改变",t),"connecting"===t?e.broadcastStatus=0:"connected"===t?(e.br
|