function createRTCSessionDescription(t){return new RTCSessionDescription(t)}var gStrH5SPlayerVersion="h5splayer r15.0.1025";function H5sPlayerWS(t){this.sourceBuffer,this.buffer=[],this.t,this.video,this.s,this.i,this.o,this.h=0,this.l=0,this.u=0,this.S=!1,this.v=!1,this.C=!1,this.H,this.p=1,this.P=!0,void 0!==t.consolelog&&"false"===t.consolelog&&(this.P=!1),this.R=t,!0===this.P&&console.log("[WS] Websocket Conf:",t),this.k=t.videoid,this.W=t.pbconf,this.T=t.token,void 0===this.k?(this.m=t.videodom,!0===this.P&&console.log("[WS] use dom directly",t.token)):(this.m=document.getElementById(this.k),!0===this.P&&console.log("[WS] use videoid",t.token)),void 0!=this.m.I&&(!0===this.P&&console.log("[WS] set latencyHint to 0"),this.m.I=0),this.video=this.m,this.A,void 0!=this.W&&"false"==this.W.showposter?(this.A=this.R.protocol+"//"+this.R.host+this.R.rootpath+"api/v1/GetLoadingImage?session="+this.R.session+"&refresh="+Math.floor(1e6*Math.random()),!0===this.P&&console.log("[WS] connect src",t.token),this.m.setAttribute("poster",this.A)):(this.A=this.R.protocol+"//"+this.R.host+this.R.rootpath+"api/v1/GetImage?token="+this.T+"&session="+this.R.session+"&refresh="+Math.floor(1e6*Math.random()),!0===this.P&&console.log("[WS] connect src",t.token),this.m.setAttribute("poster",this.A))}function H5sPlayerRTC(t){this.s,this.o,this.S=!1,this.v=!1,this.P=!0,void 0!==t.consolelog&&"false"===t.consolelog&&(this.P=!1),this.R=t,this.k=t.videoid,this.W=t.pbconf,this.T=t.token,this.p=1,void 0===this.k?(this.m=t.videodom,!0===this.P&&console.log("[RTC] use dom directly",t.token)):(this.m=document.getElementById(this.k),!0===this.P&&console.log("[RTC] use videoid",t.token)),this.video=this.m,this.M=null,this.U={optional:[{DtlsSrtpKeyAgreement:!0}]},this.O={mandatory:{offerToReceiveAudio:!0,offerToReceiveVideo:!0}},this.g={iceServers:[]},this.N=[],this.A,void 0!=this.W&&"false"==this.W.showposter?(this.A=this.R.protocol+"//"+this.R.host+this.R.rootpath+"api/v1/GetLoadingImage?session="+this.R.session+"&refresh="+Math.floor(1e6*Math.random()),!0===this.P&&console.log("[WS] connect src",t.token),this.m.setAttribute("poster",this.A)):(this.A=this.R.protocol+"//"+this.R.host+this.R.rootpath+"api/v1/GetImage?token="+this.T+"&session="+this.R.session+"&refresh="+Math.floor(1e6*Math.random()),!0===this.P&&console.log("[WS] connect src",t.token),this.m.setAttribute("poster",this.A))}function H5sPlayerHls(t){this.s,this.o,this.R=t,this.k=t.videoid,this.T=t.token,this.J,this.F=t.hlsver,this.P=!0,void 0!==t.consolelog&&"false"===t.consolelog&&(this.P=!1),void 0===this.k?(this.m=t.videodom,!0===this.P&&console.log("[HLS] use dom directly",t.token)):(this.m=document.getElementById(this.k),!0===this.P&&console.log("[HLS] use videoid",t.token)),this.D=this.m,this.D.type="application/x-mpegURL",this._=0,this.L=0;var s=this.R.protocol+"//"+window.location.host+"/api/v1/GetImage?token="+this.T+"&session="+this.R.session;this.m.setAttribute("poster",s)}function H5sPlayerAudio(t){this.buffer=[],this.s,this.S=!1,this.v=!1,this.R=t,this.P=!0,void 0!==t.consolelog&&"false"===t.consolelog&&(this.P=!1),!0===this.P&&console.log("[AUD] Aduio Player Conf:",t),this.T=t.token,this.B=new AudioContext}function H5sPlayerAudBack(t){this.buffer=[],this.s,this.S=!1,this.v=!1,this.R=t,this.K=0,this.V=48e3,this.G=!1,this.P=!0,void 0!==t.consolelog&&"false"===t.consolelog&&(this.P=!1),!0===this.P&&console.log("[AUDBACK] Aduio Back Conf:",t),this.T=t.token,this.B=new AudioContext,!0===this.P&&console.log("[AUDBACK] sampleRate",this.B.sampleRate),this.j()}function float32ToInt16(t){for(var s=t.length,e=new Int16Array(s);s--;)e[s]=32767*Math.min(1,t[s]);return e}function H5sConference(t){this.s,this.o,this.S=!1,this.v=!1,this.q=!1,this.X,this.Y,this.Z=!1,this.$=!1,this.tt,this.st,this.et=[],this.it=[],this.P=!0,void 0!==t.consolelog&&"false"===t.consolelog&&(this.P=!1),void 0!==t.ot&&"true"===t.ot&&(this.Z=!0),void 0!==t.nt&&"true"===t.nt&&(this.$=!0),this.R=t,void 0===t.localvideoid?(this.ht=t.localvideodom,!0===this.P&&console.log(t.token,"[CFE] local use dom directly")):(this.ht=document.getElementById(t.localvideoid),!0===this.P&&console.log(t.token,"[CFE] local use videoid")),void 0===t.remotevideoid?(this.ct=t.remotevideodom,!0===this.P&&console.log(t.token,"[CFE] remote use dom directly")):(this.ct=document.getElementById(t.remotevideoid),!0===this.P&&console.log(t.token,"[CFE] remote use videoid")),this.M=null,this.U={optional:[{DtlsSrtpKeyAgreement:!0}]},this.O={mandatory:{offerToReceiveAudio:!0,offerToReceiveVideo:!0,rt:!1}},this.g={iceServers:[]},this.N=[]}function makeLink(t,s,e){const i=new Blob(t,{type:"video/webm"}),o=window.URL.createObjectURL(i),n=document.createElement("a");n.style.display="none",n.href=o;const h=new Date;var c=s+"_"+h.getFullYear()+"-"+(h.getMonth()+1)+"-"+h.getDate()+"-"+h.getHours()+"-"+h.getMinutes()+"-"+h.getSeconds()+e;n.download=c,document.body.appendChild(n),n.click(),setTimeout(()=>{document.body.removeChild(n),window.URL.revokeObjectURL(o)},100)}function H5sRTCPush(t){this.s,this.o,this.S=!1,this.v=!1,this.P=!0,void 0!==t.consolelog&&"false"===t.consolelog&&(this.P=!1),this.R=t,this.k=t.localvideoid,this.lt=t.user,this.p=1,void 0===this.k?(this.dt=t.localvideodom,!0===this.P&&console.log("[PUSH] use dom directly",t.user)):(this.dt=document.getElementById(this.k),!0===this.P&&console.log("[PUSH] use videoid",t.user)),this.video=this.dt,this.M=null,this.U={optional:[{DtlsSrtpKeyAgreement:!0}]},this.O={mandatory:{offerToReceiveAudio:!1,offerToReceiveVideo:!1}},this.g={iceServers:[]},this.N=[]}function H5sRTCGetCapability(t,s){var i={},o=[],n=[],h=[],c=[];if(navigator.mediaDevices.getUserMedia({audio:!0,video:!0}).then(function(t){t&&t.getTracks().forEach(t=>{t.stop()})}).catch(function(t){var s="[PUSH] getUserMedia failed: "+t.name+" "+t.message;alert(s)}),window.RTCRtpTransceiver&&"setCodecPreferences"in window.RTCRtpTransceiver.prototype){const t=window.RTCRtpSender.getCapabilities("video").codecs;var r=!1,a=!1;for(let s=0;s!==t.length;++s){const e=t[s];["video/red","video/ulpfec","video/rtx"].includes(e.mimeType)||(["video/VP9"].includes(e.mimeType)?r=!0:["video/H264"].includes(e.mimeType)&&(a=!0))}1==r&&o.push("VP9"),1==a&&o.push("H264")}else o.push("Default");navigator.mediaDevices.enumerateDevices().then(function(s){for(let t=0;t!==s.length;++t){const i=s[t];var e={};e.id=i.deviceId,e.name=i.label,"audioinput"===i.kind?n.push(e):"audiooutput"===i.kind?h.push(e):"videoinput"===i.kind&&c.push(e)}i.videocodec=o,i.videoin=c,i.audioin=n,i.audioout=h,t(i)}).catch(function(t){alert("[PUSH] enumerateDevices failed",e)})}function H5sGetClientWSDecoder(){var t,s='video/mp4; codecs="avc1.42E01E, mp4a.40.2"';"MediaSource"in window&&MediaSource.isTypeSupported(s)&&(t="H264");s='video/mp4; codecs="hev1.1.6.L93.B0, mp4a.40.2"';return"MediaSource"in window&&MediaSource.isTypeSupported(s)&&(t+=" H265"),t}console.log("[h5s]",gStrH5SPlayerVersion),H5sPlayerWS.prototype.ut=function(){if(!0===this.S){!0===this.P&&console.log("[WS] Reconnect...");var t=this.A+"&update="+this.p;this.m.setAttribute("poster",t),!0===this.P&&console.log("[WS] Reconnect image",t),this.p++,this.ft(this.T),this.S=!1}},H5sPlayerWS.prototype.St=function(t){var s;!0===this.P&&console.log("[WS] H5SWebSocketClient");try{"http:"==this.R.protocol&&(s="undefined"!=typeof MozWebSocket?new MozWebSocket("ws://"+this.R.host+t):new WebSocket("ws://"+this.R.host+t)),"https:"==this.R.protocol&&(!0===this.P&&console.log(this.R.host),s="undefined"!=typeof MozWebSocket?new MozWebSocket("wss://"+this.R.host+t):new WebSocket("wss://"+this.R.host+t)),!0===this.P&&console.log(this.R.host)}catch(t){return void alert("WebSocketClient error")}return s},H5sPlayerWS.prototype.vt=function(){if(null!==this.sourceBuffer&&void 0!==this.sourceBuffer){if(0!==this.buffer.length&&!this.sourceBuffer.updating)try{var t=this.buffer.shift(),s=new Uint8Array(t);this.sourceBuffer.appendBuffer(s)}catch(t){!0===this.P&&console.log(t),this.s.close()}}else!0===this.P&&console.log("[WS] is null or undefined",this.sourceBuffer)},H5sPlayerWS.prototype.Ct=function(){try{var t={cmd:"H5_KEEPALIVE"};this.s.send(JSON.stringify(t))}catch(t){!0===this.P&&console.log(t)}},H5sPlayerWS.prototype.Ht=function(t){return t.data,ArrayBuffer,"string"==typeof t.data?(!0===this.P&&console.log("[WS] string"),void(void 0!=this.W&&void 0!=this.W.callback&&this.W.callback(t.data,this.W.userdata))):!0!==this.v?!1===this.C?(this.H=String.fromCharCode.apply(null,new Uint8Array(t.data)),this.yt(this),void(this.C=!0)):(this.buffer.push(t.data),void this.vt()):void 0},H5sPlayerWS.prototype.yt=function(t){try{window.MediaSource=window.MediaSource||window.WebKitMediaSource,window.MediaSource||!0===t.P&&console.log("[WS] MediaSource API is not available");var s='video/mp4; codecs="avc1.42E01E, mp4a.40.2"';"MediaSource"in window&&MediaSource.isTypeSupported(s)?!0===t.P&&console.log("[WS] MIME type or codec: ",s):!0===t.P&&console.log("[WS] Unsupported MIME type or codec: ",s),t.t=new window.MediaSource,t.video.autoplay=!0,!0===t.P&&console.log(t.k);t.video.src=window.URL.createObjectURL(t.t),t.t.addEventListener("sourceopen",t.pt.bind(t),!1)}catch(s){!0===t.P&&console.log(s)}},H5sPlayerWS.prototype.pt=function(){!0===this.P&&console.log("[WS] Add SourceBuffer"),this.sourceBuffer=this.t.addSourceBuffer(this.H),this.t.duration=1/0,this.t.removeEventListener("sourceopen",this.pt,!1),this.sourceBuffer.addEventListener("updateend",this.vt.bind(this),!1)},H5sPlayerWS.prototype.ft=function(t){if(this.video.autoplay=!0,window.MediaSource=window.MediaSource||window.WebKitMediaSource,window.MediaSource){var s="false",e='video/mp4; codecs="hev1.1.6.L93.B0, mp4a.40.2"';"MediaSource"in window&&MediaSource.isTypeSupported(e)?(!0===this.P&&console.log("[WS] MIME type or codec: ",e),s="true"):(!0===this.P&&console.log("[WS] Unsupported MIME type or codec: ",e),s="false");var i="api/v1/h5swsapi",o="main";if(void 0===this.R.streamprofile||(o=this.R.streamprofile),void 0===this.W)i=this.R.rootpath+i+"?token="+t+"&hevc="+s+"&profile="+o+"&session="+this.R.session;else{var n="false",h="fake";void 0===this.W.serverpb||(n=this.W.serverpb),void 0===this.W.filename||(h=this.W.filename),i=this.R.rootpath+i+"?token="+t+"&playback=true&profile="+o+"&serverpb="+n+"&begintime="+encodeURIComponent(this.W.begintime)+"&endtime="+encodeURIComponent(this.W.endtime)+"&filename="+h+"&session="+this.R.session}this.R.session,!0===this.P&&console.log(i),this.s=this.St(i),!0===this.P&&console.log("[WS] setupWebSocket",this.s),this.s.binaryType="arraybuffer",this.s.Pt=this,this.s.onmessage=this.Ht.bind(this),this.s.onopen=function(){!0===this.Pt.P&&console.log("[WS] wsSocket.onopen",this.Pt),this.Pt.i=setInterval(this.Pt.wt.bind(this.Pt),1e4),this.Pt.o=setInterval(this.Pt.Ct.bind(this.Pt),1e3),void 0!=this.Pt.W&&"true"===this.Pt.W.autoplay&&this.Pt.start()},this.s.onclose=function(){!0===this.Pt.P&&console.log("[WS] wsSocket.onclose",this.Pt),!0===this.Pt.v?!0===this.Pt.P&&console.log("[WS] wsSocket.onclose disconnect"):this.Pt.S=!0;try{this.Pt.Rt(this.Pt)}catch(t){}this.Pt.kt(this.Pt),this.Pt.H="",this.Pt.C=!1}}else!0===this.P&&console.log("[WS] MediaSource API is not available")},H5sPlayerWS.prototype.Rt=function(t){!0===t.P&&console.log("[WS] Cleanup Source Buffer",t);try{t.sourceBuffer.removeEventListener("updateend",t.vt,!1),t.sourceBuffer.abort(),document.documentMode||/Edge/.test(navigator.userAgent)?!0===t.P&&console.log("[WS] IE or EDGE!"):t.t.removeSourceBuffer(t.sourceBuffer),t.sourceBuffer=null,t.t=null,t.buffer=[]}catch(s){!0===t.P&&console.log(s)}},H5sPlayerWS.prototype.kt=function(t){!0===t.P&&console.log("[WS] CleanupWebSocket",t),clearInterval(t.o),clearInterval(t.i),t.h=0,t.l=0,t.u=0},H5sPlayerWS.prototype.wt=function(){if(void 0===this.W){if(void 0===this.R.Et);else if("false"==this.R.Et)return void(!0===this.P&&console.log("[WS] Stream check has been disabled ",this));!0===this.v&&(!0===this.P&&console.log("[WS] CheckSourceBuffer has been disconnect",this),clearInterval(this.o),clearInterval(this.i),clearInterval(this.Wt));try{if(!0===this.P&&console.log("[WS] CheckSourceBuffer",this),this.sourceBuffer.buffered.length<=0){if(this.h++,this.h>8)return!0===this.P&&console.log("[WS] CheckSourceBuffer Close 1"),clearInterval(this.o),void this.s.close()}else{this.h=0;this.sourceBuffer.buffered.start(0);var t=this.sourceBuffer.buffered.end(0),s=t-this.video.currentTime;if(s>5)return!0===this.P&&console.log("[WS] CheckSourceBuffer Close 2",s),clearInterval(this.o),void this.s.close();if(t==this.l){if(this.u++,this.u>3)return!0===this.P&&console.log("[WS] CheckSourceBuffer Close 3"),clearInterval(this.o),void this.s.close()}else this.u=0;this.l=t}}catch(t){!0===this.P&&console.log(t),clearInterval(this.o),this.s.close()}}},H5sPlayerWS.prototype.connect=function(){this.ft(this.T),this.Wt=setInterval(this.ut.bind(this),800)},H5sPlayerWS.prototype.disconnect=function(){!0===this.P&&console.log("[WS] disconnect",this),this.v=!0,clearInterval(this.Wt);try{null!=this.s&&(this.s.close(),this.s=null)}catch(t){}!0===this.P&&console.log("[WS] disconnect",this)},H5sPlayerWS.prototype.start=function(){try{var t={cmd:"H5_START"};this.s.send(JSON.stringify(t))}catch(t){!0===this.P&&console.log(t)}},H5sPlayerWS.prototype.pause=function(){try{var t={cmd:"H5_PAUSE"};this.s.send(JSON.stringify(t))}catch(t){!0===this.P&&console.log(t)}},H5sPlayerWS.prototype.resume=function(){try{var t={cmd:"H5_RESUME"};this.s.send(JSON.stringify(t))}catch(t){!0===this.P&&console.log(t)}},H5sPlayerWS.prototype.seek=function(t){try{var s={cmd:"H5_SEEK"};s.nSeekTime=t,this.s.send(JSON.stringify(s))}catch(t){!0===this.P&&console.log(t)}},H5sPlayerWS.prototype.speed=function(t){try{var s={cmd:"H5_SPEED"};s.nSpeed=t,this.s.send(JSON.stringify(s))}catch(t){!0===this.P&&console.log(t)}},H5sPlayerRTC.prototype.ut=function(){if(!0===this.S){!0===this.P&&console.log("[RTC] Reconnect...");var t=this.A+"&update="+this.p;this.m.setAttribute("poster",t),!0===this.P&&console.log("[RTC] Reconnect image",t),this.p++,this.ft(this.T),this.S=!1}},H5sPlayerRTC.prototype.St=function(t){var s;!0===this.P&&console.log("[RTC] H5SWebSocketClient");try{"http:"==this.R.protocol&&(s="undefined"!=typeof MozWebSocket?new MozWebSocket("ws://"+this.R.host+t):new WebSocket("ws://"+this.R.host+t)),"https:"==this.R.protocol&&(!0===this.P&&console.log(this.R.host),s="undefined"!=typeof MozWebSocket?new MozWebSocket("wss://"+this.R.host+t):new WebSocket("wss://"+this.R.host+t)),!0===this.P&&console.log(this.R.host)}catch(t){return void alert("WebSocketClient error")}return s},H5sPlayerRTC.prototype.Ct=function(){try{var t={type:"keepalive"};this.s.send(JSON.stringify(t))}catch(t){!0===this.P&&console.log(t)}},H5sPlayerRTC.prototype.Tt=function(t){if(t.candidate){var s;!0===this.P&&console.log("[RTC] onIceCandidate currentice",t.candidate),s=t.candidate,!0===this.P&&console.log("[RTC] onIceCandidate currentice",JSON.stringify(s));var e=JSON.parse(JSON.stringify(s));e.type="remoteice",!0===this.P&&console.log("[RTC] onIceCandidate currentice new",JSON.stringify(e)),this.s.send(JSON.stringify(e))}else!0===this.P&&console.log("End of candidates.")},H5sPlayerRTC.prototype.It=function(t){var s;!0===this.P&&console.log("[RTC] Remote track added:"+JSON.stringify(t)),s=t.At?t.At[0]:t.stream;var e=this.m;e.srcObject=s,e.play()},H5sPlayerRTC.prototype.bt=function(){!0===this.P&&console.log("[RTC] createPeerConnection config: "+JSON.stringify(this.g)+" option:"+JSON.stringify(this.U));var t=new RTCPeerConnection(this.g,this.U),s=this;return t.onicecandidate=function(t){s.Tt.call(s,t)},void 0!==t.Mt?t.Mt=function(t){s.It.call(s,t)}:t.onaddstream=function(t){s.It.call(s,t)},t.oniceconnectionstatechange=function(e){!0===s.P&&console.log("[RTC] oniceconnectionstatechange state: "+t.iceConnectionState)},!0===this.P&&console.log("[RTC] Created RTCPeerConnnection with config: "+JSON.stringify(this.g)+"option:"+JSON.stringify(this.U)),t},H5sPlayerRTC.prototype.Ut=function(t){!0===this.P&&console.log("[RTC] ProcessRTCOffer",t);try{this.M=this.bt(),this.N.length=0;var s=this;!0===this.P&&console.log("[RTC] createRTCSessionDescription "),this.M.setRemoteDescription(createRTCSessionDescription(t)),this.M.createAnswer(this.O).then(function(t){!0===s.P&&console.log("[RTC] Create answer:"+JSON.stringify(t)),s.M.setLocalDescription(t,function(){!0===s.P&&console.log("[RTC] ProcessRTCOffer createAnswer",t),s.s.send(JSON.stringify(t))},function(){})},function(t){alert("[RTC] Create awnser error:"+JSON.stringify(t))})}catch(t){this.disconnect(),alert("[RTC] connect error: "+t)}},H5sPlayerRTC.prototype.Ot=function(t){!0===this.P&&console.log("[RTC] ProcessRemoteIce",t);try{var s=new RTCIceCandidate({sdpMLineIndex:t.sdpMLineIndex,candidate:t.candidate});!0===this.P&&console.log("[RTC] ProcessRemoteIce",s),!0===this.P&&console.log("[RTC] Adding ICE candidate :"+JSON.stringify(s)),this.M.addIceCandidate(s,function(){},function(t){console.log("[RTC] addIceCandidate error:"+JSON.stringify(t))})}catch(t){alert("connect ProcessRemoteIce error: "+t)}},H5sPlayerRTC.prototype.Ht=function(t){t.data,ArrayBuffer,t.data,!0===this.P&&console.log("[RTC] RTC received ",t.data);var s=JSON.parse(t.data);return!0===this.P&&console.log("[RTC] Get Message type ",s.type),"offer"===s.type?(!0===this.P&&console.log("[RTC] Process Message type ",s.type),void this.Ut(s)):"iceserver"===s.type?(!0===this.P&&console.log("[RTC] Process Message type ",s.type),this.g.iceServers=s.iceServers,this.g.iceTransportPolicy=s.iceTransportPolicy,void(!0===this.P&&console.log("[RTC] Iceserver:",this.g))):"remoteice"===s.type?(!0===this.P&&console.log("[RTC] Process Message type ",s.type),void this.Ot(s)):void(void 0!=this.W&&void 0!=this.W.callback&&this.W.callback(t.data,this.W.userdata))},H5sPlayerRTC.prototype.ft=function(t){this.video.autoplay=!0;var s="api/v1/h5srtcapi";void 0===this.R.rtcengine||"v2"===this.R.rtcengine&&(s="api/v1/h5srtcapi2"),!0===this.P&&console.log("[RTC] API path",s);var e="main";void 0===this.R.streamprofile||(e=this.R.streamprofile);var i="false",o='video/mp4; codecs="hev1.1.6.L93.B0, mp4a.40.2"';if("MediaSource"in window&&MediaSource.isTypeSupported(o)||(!0===this.P&&console.log("[RTC] Unsupported MIME type or codec: ",o),i="false"),void 0===this.W)s=this.R.rootpath+s+"?token="+t+"&hevc="+i+"&profile="+e+"&session="+this.R.session;else{var n="false",h="fake";void 0===this.W.serverpb||(n=this.W.serverpb),void 0===this.W.filename||(h=this.W.filename),s=this.R.rootpath+s+"?token="+t+"&playback=true&hevc="+i+"&profile="+e+"&serverpb="+n+"&begintime="+encodeURIComponent(this.W.begintime)+"&endtime="+encodeURIComponent(this.W.endtime)+"&filename="+h+"&session="+this.R.session}!0===this.P&&console.log(s),this.s=this.St(s),!0===this.P&&console.log("[RTC] setupWebSocket",this.s),this.s.binaryType="arraybuffer",this.s.Pt=this,this.s.onmessage=this.Ht.bind(this),this.s.onopen=function(){!0===this.Pt.P&&console.log("[RTC] wsSocket.onopen",this.Pt);var t={type:"open"};this.Pt.s.send(JSON.stringify(t)),this.Pt.o=setInterval(this.Pt.Ct.bind(this.Pt),1e3),void 0!=this.Pt.W&&"true"===this.Pt.W.autoplay&&this.Pt.start()},this.s.onclose=function(){!0===this.P&&console.log("[RTC] wsSocket.onclose",this.Pt),!0===this.Pt.v?!0===this.Pt.P&&console.log("[RTC] wsSocket.onclose disconnect"):this.Pt.S=!0,this.Pt.kt(this.Pt)}},H5sPlayerRTC.prototype.kt=function(t){!0===t.P&&console.log("[RTC] CleanupWebSocket",t),clearInterval(t.o)},H5sPlayerRTC.prototype.connect=function(){this.ft(this.T),this.Wt=setInterval(this.ut.bind(this),3e3)},H5sPlayerRTC.prototype.disconnect=function(){if(!0===this.P&&console.log("[RTC] disconnect",this),this.v=!0,clearInterval(this.Wt),null!=this.s&&(this.s.close(),this.s=null),this.m&&(this.m.src=""),this.M){try{this.M.close()}catch(t){!0===this.P&&console.log("[RTC] close peer connection failed:"+t)}this.M=null}!0===this.P&&console.log("[RTC] disconnect",this)},H5sPlayerRTC.prototype.start=function(){try{var t={cmd:"H5_START"};this.s.send(JSON.stringify(t))}catch(t){!0===this.P&&console.log(t)}},H5sPlayerRTC.prototype.pause=function(){try{var t={cmd:"H5_PAUSE"};this.s.send(JSON.stringify(t))}catch(t){!0===this.P&&console.log(t)}},H5sPlayerRTC.prototype.resume=function(){try{var t={cmd:"H5_RESUME"};this.s.send(JSON.stringify(t))}catch(t){!0===this.P&&console.log(t)}},H5sPlayerRTC.prototype.seek=function(t){try{var s={cmd:"H5_SEEK"};s.nSeekTime=t,this.s.send(JSON.stringify(s))}catch(t){!0===this.P&&console.log(t)}},H5sPlayerRTC.prototype.speed=function(t){try{var s={cmd:"H5_SPEED"};s.nSpeed=t,this.s.send(JSON.stringify(s))}catch(t){!0===this.P&&console.log(t)}},H5sPlayerHls.prototype.St=function(t){var s;!0===this.P&&console.log("[HLS] H5SWebSocketClient");try{"http:"==this.R.protocol&&(s="undefined"!=typeof MozWebSocket?new MozWebSocket("ws://"+this.R.host+t):new WebSocket("ws://"+this.R.host+t)),"https:"==this.R.protocol&&(!0===this.P&&console.log("[HLS] ",this.R.host),s="undefined"!=typeof MozWebSocket?new MozWebSocket("wss://"+this.R.host+t):new WebSocket("wss://"+this.R.host+t)),!0===this.P&&console.log(this.R.host)}catch(t){return void alert("WebSocketClient error")}return s},H5sPlayerHls.prototype.Ct=function(){try{var t={type:"keepalive"};this.s.send(JSON.stringify(t))}catch(t){!0===this.P&&console.log(t)}},H5sPlayerHls.prototype.Ht=function(t){!0===this.P&&console.log("[HLS] HLS received ",t.data)},H5sPlayerHls.prototype.ft=function(t){var s="api/v1/h5swscmnapi";s=this.R.rootpath+s+"?token="+t+"&session="+this.R.session,!0===this.P&&console.log(s),this.s=this.St(s),!0===this.P&&console.log("[HLS] setupWebSocket",this.s),this.s.binaryType="arraybuffer",this.s.Pt=this,this.s.onmessage=this.Ht.bind(this),this.s.onopen=function(){!0===this.Pt.P&&console.log("[HLS] wsSocket.onopen",this.Pt),this.Pt.o=setInterval(this.Pt.Ct.bind(this.Pt),1e3)},this.s.onclose=function(){!0===this.Pt.P&&console.log("[HLS] wsSocket.onclose",this.Pt),this.Pt.kt(this.Pt)}},H5sPlayerHls.prototype.kt=function(t){!0===t.P&&console.log("[HLS] H5sPlayerHls CleanupWebSocket",t),clearInterval(t.o)},H5sPlayerHls.prototype.gt=function(){!0===this.P&&console.log("[HLS] video.ended",this.D.ended),!0===this.P&&console.log("[HLS] video.currentTime",this.D.currentTime);var t=this.D.currentTime,s=t-this._;!0===this.P&&console.log("[HLS] diff",s),0===s&&this.L++,this._=t,this.L>3&&(null!=this.s&&(this.s.close(),this.s=null),this.ft(this.T),!0===this.P&&console.log("[HLS] reconnect"),this.D.src="",this._=0,this.L=0,this.D.src=this.R.protocol+"//"+this.R.host+this.R.rootpath+"hls/"+this.F+"/"+this.T+"/hls.m3u8",this.D.play())},H5sPlayerHls.prototype.connect=function(){this.ft(this.T),this._=0,this.L=0,this.D.onended=function(t){!0===this.P&&console.log("[HLS] The End")},this.D.onpause=function(t){!0===this.P&&console.log("[HLS] Pause")},this.D.onplaying=function(t){!0===this.P&&console.log("[HLS] Playing")},this.D.onseeking=function(t){!0===this.P&&console.log("[HLS] seeking")},this.D.onvolumechange=function(t){!0===this.P&&console.log("[HLS] volumechange")},this.D.src=this.R.protocol+"//"+this.R.host+this.R.rootpath+"hls/"+this.F+"/"+this.T+"/hls.m3u8",this.D.play(),this.J=setInterval(this.gt.bind(this),3e3)},H5sPlayerHls.prototype.disconnect=function(){clearInterval(this.J),this._=0,this.L=0,null!=this.s&&(this.s.close(),this.s=null),!0===this.P&&console.log("[HLS] disconnect",this)},H5sPlayerAudio.prototype.St=function(t){var s;!0===this.P&&console.log("[AUD] H5SWebSocketClient");try{"http:"==this.R.protocol&&(s="undefined"!=typeof MozWebSocket?new MozWebSocket("ws://"+this.R.host+t):new WebSocket("ws://"+this.R.host+t)),"https:"==this.R.protocol&&(!0===this.P&&console.log(this.R.host),s="undefined"!=typeof MozWebSocket?new MozWebSocket("wss://"+this.R.host+t):new WebSocket("wss://"+this.R.host+t)),!0===this.P&&console.log(this.R.host)}catch(t){return void alert("WebSocketClient error")}return s},H5sPlayerAudio.prototype.Ct=function(){try{this.s.send("keepalive")}catch(t){!0===this.P&&console.log(t)}},H5sPlayerAudio.prototype.Ht=function(t){for(var s=new Int16Array(t.data),e=s.length,i=this.B.createBuffer(1,e,8e3),o=0;o<1;o++)for(var n=i.getChannelData(o),h=0;h0&&console.log("[CFE] Using video device:",e[0].label),i.length>0&&console.log("[CFE] Using audio device:",i[0].label),this.Bt.getTracks().forEach(t=>this.M.addTrack(t,this.Bt)),!0===this.P&&console.log("[CFE] createRTCSessionDescription "),this.M.setRemoteDescription(createRTCSessionDescription(t)),this.M.createAnswer(this.O).then(function(t){!0===s.P&&console.log("[CFE] Create answer:"+JSON.stringify(t)),s.M.setLocalDescription(t,function(){!0===s.P&&console.log("[CFE] ProcessOffer createAnswer",t);var e={type:"CFE_CMD_CALL_ANSWER"},i={};console.log("[CFE] createAnswer to",s.Y),i.strTo=s.Y,i.msg=t,e.answer=i,s.s.send(JSON.stringify(e))},function(){})},function(t){alert("[CFE ]Create awnser error:"+JSON.stringify(t))})}catch(t){this.disconnect(),alert("connect error: "+t)}},H5sConference.prototype.xt=function(t){!0===this.P&&console.log("[CFE] ProcessAnswer",t);try{this.M.setRemoteDescription(createRTCSessionDescription(t))}catch(t){this.disconnect(),alert("connect error: "+t)}},H5sConference.prototype.Kt=function(){!0===this.P&&console.log("[CFE] CreateOffer");try{this.M=this.bt(),this.N.length=0;var t=this;const s=this.Bt.getVideoTracks(),e=this.Bt.getAudioTracks();return s.length>0&&console.log("[CFE] Using video device:",s[0].label),e.length>0&&console.log("[CFE] Using audio device:",e[0].label),this.Bt.getTracks().forEach(t=>this.M.addTrack(t,this.Bt)),void this.M.createOffer(this.O).then(function(s){!0===t.P&&console.log("[CFE] Create answer:"+JSON.stringify(s)),t.M.setLocalDescription(s,function(){!0===t.P&&console.log("[CFE] ProcessOffer createAnswer",s);var e=s;!0===t.P&&console.log("[CFE] createOffer ",JSON.stringify(e));var i={type:"CFE_CMD_CALL_OFFER"},o={};!0===t.P&&console.log("[CFE] createOffer to",t.Y),o.strTo=t.Y,o.msg=e,i.offer=o,t.s.send(JSON.stringify(i))},function(){})},function(t){alert("[CFE ]Create offer error:"+JSON.stringify(t))})}catch(t){this.disconnect(),alert("connect error: "+t)}},H5sConference.prototype.Ot=function(t){!0===this.P&&console.log("[CFE] ProcessRemoteIce",t);try{var s=new RTCIceCandidate({sdpMLineIndex:t.sdpMLineIndex,candidate:t.candidate});!0===this.P&&console.log("[CFE] ProcessRemoteIce",s),!0===this.P&&console.log("[CFE] Adding ICE candidate :"+JSON.stringify(s)),this.M.addIceCandidate(s,function(){},function(t){console.log("[CFE] addIceCandidate error:"+JSON.stringify(t))})}catch(t){alert("connect ProcessRemoteIce error: "+t)}},H5sConference.prototype.Ht=function(t){!0===this.P&&console.log("[CFE] received ",t.data);var s=JSON.parse(t.data);if(!0===this.P&&console.log("[CFE] Get Message type ",s.type),"CFE_CMD_INVITE_REQ"!==s.type){if("CFE_CMD_INVITE_RESP"===s.type)return this.Y=s.inviteResp.strFrom,void this.Kt();if("CFE_CMD_CALL_OFFER"!==s.type)if("CFE_CMD_CALL_ANSWER"!==s.type)if("CFE_CMD_REMOTE_ICE"!==s.type){if("CFE_EVENT_ID_ASSIGN"===s.type){this.X=s.idAssign.strId,1==s.idAssign.bEnableRelay&&(this.g.iceServers=s.idAssign.iceServers,this.g.iceTransportPolicy=s.idAssign.iceTransportPolicy,!0===this.P&&console.log("[CFE] Iceserver:",this.g));var e={type:"CFE_EVENT_ID_ASSIGN",idAssign:{}};return e.idAssign.strId=s.idAssign.strId,void(void 0!=this.R.callback&&this.R.callback(JSON.stringify(e),this.R.userdata))}void 0!=this.R.callback&&this.R.callback(t.data,this.R.userdata)}else this.Ot(s.remoteIce.msg);else this.xt(s.answer.msg);else this.zt(s.offer.msg)}},H5sConference.prototype.ft=function(t){this.ht.autoplay=!0,this.ct.autoplay=!0;var s="api/v1/h5sconference";s=void 0===this.X?this.R.rootpath+s+"?name="+this.R.user+"&session="+this.R.session:this.R.rootpath+s+"?name="+this.R.user+"?id="+this.X+"&session="+this.R.session,!0===this.P&&console.log(s),this.s=this.St(s),!0===this.P&&console.log("[CFE] setupWebSocket",this.s),this.s.binaryType="arraybuffer",this.s.Pt=this,this.s.onmessage=this.Ht.bind(this),this.s.onopen=function(){!0===this.Pt.P&&console.log("[CFE] wsSocket.onopen",this.Pt),this.Pt.o=setInterval(this.Pt.Ct.bind(this.Pt),1e3),void 0!=this.Pt.W&&"true"===this.Pt.W.autoplay&&this.Pt.start()},this.s.onclose=function(){!0===this.Pt.P&&console.log("[CFE] wsSocket.onclose",this.Pt),!0===this.Pt.v?!0===this.Pt.P&&console.log("[CFE] wsSocket.onclose disconnect"):this.Pt.S=!0,this.Pt.kt(this.Pt)}},H5sConference.prototype.kt=function(t){!0===t.P&&console.log("[CFE] CleanupWebSocket",t),clearInterval(t.o)},H5sConference.prototype.connect=function(){this.ft(this.T),this.Wt=setInterval(this.ut.bind(this),3e3)},H5sConference.prototype.call=function(t,s,e,i,o){if(1!=this.q){this.Vt=e,this.Gt=o,this.Qt=i;var n=1280,h=720;"QVGA"==i?(n=320,h=240):"VGA"==i?(n=640,h=480):"D1"==i?(n=720,h=576):"720P"==i?(n=1280,h=720):"1080P"==i?(n=1920,h=1080):"4K"==i?(n=4096,h=2160):"8K"==i&&(n=7680,h=4320);try{try{var c;c=0!=t&&{deviceId:{exact:e},width:{exact:n},height:{exact:h}};var r=this;navigator.mediaDevices.getUserMedia({audio:{deviceId:{exact:o}},video:c}).then(function(e){1==t&&(r.ht.srcObject=e),r.Bt=e;var i={type:"CFE_CMD_INVITE_REQ"},o={};o.strFrom=r.X,o.strTo=s,i.inviteReq=o,r.s.send(JSON.stringify(i))}).catch(function(t){var s="[CFE] getUserMedia failed: "+t.name+" "+t.message;alert(s)})}catch(t){var a="[CFE] getUserMedia failed: "+err.name+" "+err.message;alert(a)}}catch(t){!0===this.P&&console.log(t)}this.q=!0}},H5sConference.prototype.answer=function(t,s,e,i,o){if(1!=this.q){this.Vt=e,this.Gt=o,this.Qt=i;var n=1280,h=720;"QVGA"==i?(n=320,h=240):"VGA"==i?(n=640,h=480):"D1"==i?(n=720,h=576):"720P"==i?(n=1280,h=720):"1080P"==i?(n=1920,h=1080):"4K"==i?(n=4096,h=2160):"8K"==i&&(n=7680,h=4320);try{try{var c;c=0!=t&&{deviceId:{exact:e},width:{exact:n},height:{exact:h}};var r=this;navigator.mediaDevices.getUserMedia({audio:{deviceId:{exact:o}},video:c}).then(function(e){1==t&&(r.ht.srcObject=e),r.Bt=e;var i={type:"CFE_CMD_INVITE_RESP"},o={};o.strFrom=r.X,o.strTo=s,r.Y=s,i.inviteResp=o,r.s.send(JSON.stringify(i))}).catch(function(t){var s="[CFE] getUserMedia failed: "+t.name+" "+t.message;alert(s)})}catch(t){var a="[CFE] getUserMedia failed: "+err.name+" "+err.message;alert(a)}}catch(t){!0===this.P&&console.log(t)}this.q=!0}},H5sConference.prototype.hangup=function(){if(0!=this.q){try{1==this.Z&&this.tt.stop(),1==this.$&&this.st.stop()}catch(t){alert("stop record error: "+t)}try{var t={cmd:"H5_PAUSE"};this.s.send(JSON.stringify(t))}catch(t){!0===this.P&&console.log(t)}if(this.ht&&(this.ht.src=""),this.ct&&(this.ct.src=""),this.Bt&&(this.Bt=null),this.M){try{this.M.close()}catch(t){!0===this.P&&console.log("[CFE] close peer connection failed:"+t)}this.M=null}this.q=!1}},H5sConference.prototype.disconnect=function(){!0===this.P&&console.log("[CFE] disconnect",this),this.v=!0,clearInterval(this.Wt),this.hangup(),null!=this.s&&(this.s.close(),this.s=null),!0===this.P&&console.log("[CFE] disconnect",this)},H5sRTCPush.prototype.ut=function(){!0===this.S&&(!0===this.P&&console.log("[PUSH] Reconnect..."),this.ft(this.lt),this.S=!1)},H5sRTCPush.prototype.St=function(t){var s;!0===this.P&&console.log("[PUSH] H5SWebSocketClient");try{"http:"==this.R.protocol&&(s="undefined"!=typeof MozWebSocket?new MozWebSocket("ws://"+this.R.host+t):new WebSocket("ws://"+this.R.host+t)),"https:"==this.R.protocol&&(!0===this.P&&console.log(this.R.host),s="undefined"!=typeof MozWebSocket?new MozWebSocket("wss://"+this.R.host+t):new WebSocket("wss://"+this.R.host+t)),!0===this.P&&console.log(this.R.host)}catch(t){return void alert("WebSocketClient error")}return s},H5sRTCPush.prototype.Ct=function(){try{var t={type:"keepalive"};this.s.send(JSON.stringify(t))}catch(t){!0===this.P&&console.log(t)}},H5sRTCPush.prototype.Tt=function(t){if(t.candidate){var s;!0===this.P&&console.log("[PUSH] onIceCandidate currentice",t.candidate),s=t.candidate,!0===this.P&&console.log("[PUSH] onIceCandidate currentice",JSON.stringify(s));var e=JSON.parse(JSON.stringify(s));e.type="remoteice",!0===this.P&&console.log("[PUSH] onIceCandidate currentice new",JSON.stringify(e)),this.s.send(JSON.stringify(e))}else!0===this.P&&console.log("End of candidates.")},H5sRTCPush.prototype.It=function(t){!0===this.P&&console.log("[PUSH] Remote track added:"+JSON.stringify(t)),t.At?t.At[0]:t.stream},H5sRTCPush.prototype.bt=function(){!0===this.P&&console.log("[PUSH] createPeerConnection config: "+JSON.stringify(this.g)+" option:"+JSON.stringify(this.U));var t=new RTCPeerConnection(this.g,this.U),s=this;return t.onicecandidate=function(t){s.Tt.call(s,t)},void 0!==t.Mt?t.Mt=function(t){s.It.call(s,t)}:t.onaddstream=function(t){s.It.call(s,t)},t.oniceconnectionstatechange=function(e){!0===s.P&&console.log("[PUSH] oniceconnectionstatechange state: "+t.iceConnectionState)},!0===this.P&&console.log("[PUSH] Created RTCPeerConnnection with config: "+JSON.stringify(this.g)+"option:"+JSON.stringify(this.U)),t},H5sRTCPush.prototype.jt=function(t,s){if(("chrome"===adapter.browserDetails.browser||"safari"===adapter.browserDetails.browser||"firefox"===adapter.browserDetails.browser&&adapter.browserDetails.version>=64)&&"RTCRtpSender"in window&&"setParameters"in window.RTCRtpSender.prototype){const e=t.getSenders();for(let t=0;t!==e.length;++t){const i=e[t];if("video"==i.track.kind){const t=i.getParameters();t.encodings||(t.encodings=[{}]),t.encodings[0].maxBitrate=1e3*s,i.setParameters(t).then(()=>{}).catch(t=>console.error(t))}}}},H5sRTCPush.prototype.Kt=function(){!0===this.P&&console.log("[PUSH] CreateOffer");try{this.M=this.bt(),this.N.length=0;var t=this;const i=this.Bt.getVideoTracks(),o=this.Bt.getAudioTracks();if(i.length>0&&console.log("[PUSH] Using video device:",i[0].label),o.length>0&&console.log("[PUSH] Using audio device:",o[0].label),this.Bt.getTracks().forEach(t=>this.M.addTrack(t,this.Bt)),window.RTCRtpTransceiver&&"setCodecPreferences"in window.RTCRtpTransceiver.prototype){var s="video/H264";"VP9"==this.qt?s="video/VP9":"H264"==this.qt&&(s="video/H264");const i=window.RTCRtpSender.getCapabilities("video").codecs;var e=[];for(let t=0;t!==i.length;++t){const o=i[t];[s].includes(o.mimeType)&&e.push(o)}!0===t.P&&console.log("[PUSH] Select codec:",e),this.M.getTransceivers().find(t=>t.sender&&t.sender.track===this.Bt.getVideoTracks()[0]).setCodecPreferences(e)}return void this.M.createOffer(this.O).then(function(s){!0===t.P&&console.log("[PUSH] Create offer:"+JSON.stringify(s)),t.M.setLocalDescription(s,function(){var e=s;t.s.send(JSON.stringify(e))},function(){})},function(t){alert("[PUSH ]Create offer error:"+JSON.stringify(t))})}catch(t){this.disconnect(),alert("connect error: "+t)}},H5sRTCPush.prototype.xt=function(t){!0===this.P&&console.log("[PUSH] ProcessAnswer",t);try{this.M.setRemoteDescription(createRTCSessionDescription(t))}catch(t){this.disconnect(),alert("connect error: "+t)}this.jt(this.M,this.Xt)},H5sRTCPush.prototype.Ot=function(t){!0===this.P&&console.log("[PUSH] ProcessRemoteIce",t);try{var s=new RTCIceCandidate({sdpMid:t.sdpMid,sdpMLineIndex:t.sdpMLineIndex,candidate:t.candidate});!0===this.P&&console.log("[PUSH] ProcessRemoteIce",s),!0===this.P&&console.log("[PUSH] Adding ICE candidate :"+JSON.stringify(s)),this.M.addIceCandidate(s,function(){},function(t){console.log("[PUSH] addIceCandidate error:"+JSON.stringify(t)),console.log(t)})}catch(t){alert("connect ProcessRemoteIce error: "+t)}},H5sRTCPush.prototype.Ht=function(t){t.data,ArrayBuffer,t.data,!0===this.P&&console.log("[PUSH] RTC received ",t.data);var s=JSON.parse(t.data);return!0===this.P&&console.log("[PUSH] Get Message type ",s.type),"iceserver"===s.type?(!0===this.P&&console.log("[PUSH] Process Message type ",s.type),this.g.iceServers=s.iceServers,!0===this.P&&console.log("[PUSH] Iceserver:",this.g),void this.Kt()):"answer"===s.type?(!0===this.P&&console.log("[PUSH] Process Message type ",s.type),void this.xt(s)):"remoteice"===s.type?(!0===this.P&&console.log("[PUSH] Process Message type ",s.type),void this.Ot(s)):void(void 0!=this.R.callback&&this.R.callback(t.data,this.R.userdata))},H5sRTCPush.prototype.ft=function(t){this.video.autoplay=!0;var s="api/v1/h5srtcpushapi";s=this.R.rootpath+s+"?token="+t+"&type="+this.R.type+"&audio="+this.R.audio+"&session="+this.R.session,!0===this.P&&console.log(s),this.s=this.St(s),!0===this.P&&console.log("[PUSH] setupWebSocket",this.s),this.s.binaryType="arraybuffer",this.s.Pt=this,this.s.onmessage=this.Ht.bind(this),this.s.onopen=function(){!0===this.Pt.P&&console.log("[PUSH] wsSocket.onopen",this.Pt);var t={type:"open"};this.Pt.s.send(JSON.stringify(t)),this.Pt.o=setInterval(this.Pt.Ct.bind(this.Pt),1e3),void 0!=this.Pt.W&&"true"===this.Pt.W.autoplay&&this.Pt.start()},this.s.onclose=function(){!0===this.P&&console.log("[PUSH] wsSocket.onclose",this.Pt),!0===this.Pt.v?!0===this.Pt.P&&console.log("[PUSH] wsSocket.onclose disconnect"):this.Pt.S=!0,this.Pt.kt(this.Pt)}},H5sRTCPush.prototype.kt=function(t){!0===t.P&&console.log("[PUSH] CleanupWebSocket",t),clearInterval(t.o)},H5sRTCPush.prototype.connect=function(t,s,e,i,o,n){this.Vt=t,this.qt=s,this.Xt=e,this.Qt=i,this.Gt=o,!0===this.P&&console.log("[PUSH] videoin:",t,"codec:",s,"bitrate:",e,"resolution:",i,"audioin:",o);var h,c=1280,r=720;"QVGA"==i?(c=320,r=240):"VGA"==i?(c=640,r=480):"D1"==i?(c=720,r=576):"720P"==i?(c=1280,r=720):"1080P"==i?(c=1920,r=1080):"4K"==i?(c=4096,r=2160):"8K"==i&&(c=7680,r=4320);var a="",l=!1;void 0!==this.R.facingmode&&(a=this.R.facingmode,!0===this.P&&console.log("[PUSH] facing mode:",a),l=!0),h="true"==this.R.audio&&{deviceId:{exact:o}};try{const s={audio:h,video:l?{facingMode:{exact:a},width:{exact:c},height:{exact:r}}:{deviceId:{exact:t},width:{exact:c},height:{exact:r}}};try{var d=this;0==n?navigator.mediaDevices.getUserMedia(s).then(function(t){d.dt.srcObject=t,d.Bt=t,d.ft(d.lt)}).catch(function(t){var s="[PUSH] getUserMedia failed: "+t.name+" "+t.message;alert(s)}):navigator.mediaDevices.getDisplayMedia({video:!0}).then(function(t){d.dt.srcObject=t,d.Bt=t,d.ft(d.lt)}).catch(function(t){alert("[PUSH] getUserMedia failed:",t.name+": "+t.message)})}catch(t){var u="[PUSH] getUserMedia failed: "+err.name+" "+err.message;return void alert(u)}}catch(t){return void(!0===this.P&&console.log(t))}},H5sRTCPush.prototype.send=function(t,s){var e={type:"message"};e.user=this.lt,e.token=t,e.msg=s,this.s.send(JSON.stringify(e))},H5sRTCPush.prototype.disconnect=function(){if(!0===this.P&&console.log("[PUSH] disconnect",this),this.v=!0,clearInterval(this.Wt),null!=this.s&&(this.s.close(),this.s=null),this.dt&&(this.dt.src=""),this.M){try{this.M.close()}catch(t){!0===this.P&&console.log("[PUSH] close peer connection failed:"+t)}this.M=null}!0===this.P&&console.log("[PUSH] disconnect",this)};