function H5sPlayerWS(t){this.sourceBuffer,this.buffer=[],this.t,this.s,this.i,this.o,this.h,this.l=0,this.u=0,this.S=0,this.v=!1,this.k=!1,this.p=!1,this.H,this.P=t,this.W=t.videoid,this.C=t.token,void 0===this.W?(this.I=t.videodom,console.log(t.token,"use dom directly")):(this.I=document.getElementById(this.W)),this.s=this.I;var s=this.P.protocol+"//"+this.P.host+this.P.rootpath+"api/v1/GetImage?token="+this.C+"&session="+this.P.session;this.I.setAttribute("poster",s)}function H5sPlayerHls(t){this.i,this.h,this.P=t,this.W=t.videoid,this.C=t.token,this.R,this.m=t.hlsver,void 0===this.W?(this.I=t.videodom,console.log(t.token,"use dom directly")):(this.I=document.getElementById(this.W)),this.A=this.I,this.A.type="application/x-mpegURL",this.T=0,this.M=0;var s=this.P.protocol+"//"+window.location.host+"/api/v1/GetImage?token="+this.C+"&session="+this.P.session;this.I.setAttribute("poster",s)}function H5sPlayerRTC(t){this.i,this.o,this.h,this.l=0,this.u=0,this.S=0,this.v=!1,this.k=!1,this.P=t,this.W=t.videoid,this.C=t.token,void 0===this.W?(this.I=t.videodom,console.log(t.token,"use dom directly")):(this.I=document.getElementById(this.W)),this.s=this.I,this.O=null,this.J={optional:[{DtlsSrtpKeyAgreement:!0}]},this.N={mandatory:{offerToReceiveAudio:!0,offerToReceiveVideo:!0}},this.g={B:[]},this.L=[];var s=this.P.protocol+"//"+this.P.host+this.P.rootpath+"api/v1/GetImage?token="+this.C+"&session="+this.P.session;this.I.setAttribute("poster",s)}function createRTCSessionDescription(t){return console.log("createRTCSessionDescription "),new RTCSessionDescription(t)}function H5sPlayerAudio(t){this.buffer=[],this.i,this.v=!1,this.k=!1,this.P=t,console.log("Aduio Player Conf:",t),this.C=t.token,this.D=new AudioContext}function H5sPlayerAudBack(t){this.buffer=[],this.i,this.v=!1,this.k=!1,this.P=t,this.U=0,console.log("Aduio Back Conf:",t),this.C=t.token,this.D=new AudioContext}function float32ToInt16(t){for(l=t.length,buf=new Int16Array(l);l--;)buf[l]=32767*Math.min(1,t[l]);return buf}H5sPlayerWS.prototype.G=function(){console.log("Try Reconnect...",this.v),!0===this.v&&(console.log("Reconnect..."),this._(this.C),this.v=!1),console.log("Try Reconnect...",this.v)},H5sPlayerWS.prototype.K=function(t){var s;console.log("H5SWebSocketClient");try{"http:"==this.P.protocol&&(s="undefined"!=typeof MozWebSocket?new MozWebSocket("ws://"+this.P.host+t):new WebSocket("ws://"+this.P.host+t)),"https:"==this.P.protocol&&(console.log(this.P.host),s="undefined"!=typeof MozWebSocket?new MozWebSocket("wss://"+this.P.host+t):new WebSocket("wss://"+this.P.host+t)),console.log(this.P.host)}catch(t){return void alert("error")}return s},H5sPlayerWS.prototype.V=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){console.log(t)}}else console.log(this.sourceBuffer,"is null or undefined")},H5sPlayerWS.prototype.j=function(){try{var t={cmd:"H5_KEEPALIVE",nSpeed:"1.0",nTime:"0"};this.i.send(JSON.stringify(t))}catch(t){console.log(t)}},H5sPlayerWS.prototype.q=function(t){if(!0!==this.k)return!1===this.p?(this.H=String.fromCharCode.apply(null,new Uint8Array(t.data)),this.F(this),void(this.p=!0)):(this.buffer.push(t.data),void this.V())},H5sPlayerWS.prototype.F=function(t){try{window.MediaSource=window.MediaSource||window.WebKitMediaSource,window.MediaSource||console.log("MediaSource API is not available");var s='video/mp4; codecs="avc1.42E01E, mp4a.40.2"';"MediaSource"in window&&MediaSource.isTypeSupported(s)?console.log("MIME type or codec: ",s):console.log("Unsupported MIME type or codec: ",s),t.t=new window.MediaSource,t.s.autoplay=!0,console.log(t.W);t.s.src=window.URL.createObjectURL(t.t),t.s.play(),t.t.addEventListener("sourceopen",t.X.bind(t),!1)}catch(t){console.log(t)}},H5sPlayerWS.prototype.X=function(){console.log("Add SourceBuffer"),this.sourceBuffer=this.t.addSourceBuffer(this.H),this.t.duration=1/0,this.t.removeEventListener("sourceopen",this.X,!1),this.sourceBuffer.addEventListener("updateend",this.V.bind(this),!1)},H5sPlayerWS.prototype._=function(t){this.s.autoplay=!0;var s="api/v1/h5swsapi";s=this.P.rootpath+s+"?token="+t+"&session="+this.P.session,console.log(s),this.i=this.K(s),console.log("setupWebSocket",this.i),this.i.binaryType="arraybuffer",(this.i.Y=this).i.onmessage=this.q.bind(this),this.i.onopen=function(){console.log("wsSocket.onopen",this.Y),this.Y.o=setInterval(this.Y.Z.bind(this.Y),1e4),this.Y.h=setInterval(this.Y.j.bind(this.Y),1e3)},this.i.onclose=function(){console.log("wsSocket.onclose",this.Y),!0===this.Y.k?console.log("wsSocket.onclose disconnect"):this.Y.v=!0,this.Y.$(this.Y),this.Y.tt(this.Y),this.Y.H="",this.Y.p=!1}},H5sPlayerWS.prototype.$=function(t){console.log("Cleanup Source Buffer",t);try{t.sourceBuffer.removeEventListener("updateend",t.V,!1),t.sourceBuffer.abort(),document.documentMode||/Edge/.test(navigator.userAgent)?console.log("IE or EDGE!"):t.t.removeSourceBuffer(t.sourceBuffer),t.sourceBuffer=null,t.t=null,t.buffer=[]}catch(t){console.log(t)}},H5sPlayerWS.prototype.tt=function(t){console.log("CleanupWebSocket",t),clearInterval(t.h),clearInterval(t.o),t.l=0,t.u=0,t.S=0},H5sPlayerWS.prototype.Z=function(){!0===this.k&&(console.log("CheckSourceBuffer has been disconnect",this),clearInterval(this.h),clearInterval(this.o),clearInterval(this.st));try{if(console.log("CheckSourceBuffer",this),this.sourceBuffer.buffered.length<=0){if(this.l++,8