(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory() : typeof define === 'function' && define.amd ? define(factory) : (factory());}(this, function () {'use strict';var f="127.0.0.1",h=18529;f=null==window.RpcHost?f:window.RpcHost;h=null==window.RpcPort?h:window.RpcPort;var k=!1;l("toggleLog",function(){k=!k});function m(){if(k){for(var a=[],b=0;bb.j&&m("reload is needed");b.j=10;b.u=!1;b.w=!1;m("ws: onopen: number of cbs: "+b.c.length);for(var a in b.c)b.c[Number(a)](); b.c=[];null!=b.h&&b.h(!0)},c.onmessage=function(a){m("ws: onmessage: "+a.data);a:{a=a.data;var c={};try{c=JSON.parse(a)}catch(R){m("handleMsg: Failed to parse message: "+R+": "+a);break a}if(void 0!=c.method){if("2.0"==c.jsonrpc&&void 0!=c.method){var d=new w(!1,c.method,c.params,c.rev);d.id=c.id;var q=d}else q=null;null==q?m("handleMsg: Invalid req: "+a):(c=new z(q.id),null==(d=b.s[q.method])?(c.error=new v(-32601,"ERR_METHOD_NOT_FOUND"),m("handleMsg: Method not found: "+a)):null==d.S||d.S(q.rev)? (a=JSON.parse(q.R),d.Y(q,a,c)):(c.error=new v(-32E3,"ERR_INVALID_METHOD_REV"),m("handleMsg: Invalid method revision: "+a)),null!=q.id&&0!=q.id&&b.send(c.toString()))}else c="2.0"!=c.jsonrpc||void 0==c.result&&void 0==c.error?null:new z(c.id,c.result,c.error),null==c?m("handleMsg: Bad response: "+a):(c.l()&&m("handleMsg: Server responds with an error: ",a),d=b.b[c.id],null==d?m("handleMsg: Call is not found: "+a):(delete b.b[c.id],d.M(c)))}},c.onclose=function(){b.u||(m("ws: onclose"),null!=b.h&&b.h(!1), b.w||(u(ea),--b.j,m("Service stopped")))},c.onerror=function(a){m("ws: onerror: "+JSON.stringify(a));b.u=!0;u(ca);--b.j;m("Service is not available")})}};A.prototype.close=function(){window.clearInterval(this.ha);window.clearInterval(this.fa);this.na&&window.clearInterval(this.na);this.w=!0;this.a&&(this.a.close(),this.a=null)};A.prototype.send=function(a){var b=this;if(b.a.readyState==WebSocket.OPEN)try{b.a.send(a)}catch(c){m("Failed to send: "+a)}else this.connect(function(){b.a.send(a)})}; A.prototype.call=function(a,b,c,d){a=new w(!!d,a,b,c);b=a.toString();this.send(b);m("call: "+b);d&&(this.b[a.id]={M:d,method:a.method,time:Date.now()/1E3})};function ia(a){return function(b){return b==a}}function D(a,b,c){c=null==c?0:c;C.s[a]={name:a,Y:b,rev:c,S:ia(c)}}l("regEvent",D);var C=new A(p()+"://"+f+":"+h+"/rpc");function E(a,b,c,d){"object"==typeof b&&(b=JSON.stringify(b));C.call(a,b,d,c)}l("call",E);l("regRpcConnListener",function(a){B(a)});D("heartbeat",function(a,b,c){c.result="OK";m("recv heartbeat")}); D("jsonrpc::offline",function(a,b){C.close();console.log("You're offline. ",JSON.stringify(b));u(ha,b);C.P&&C.P(b)});l("regRpcForceOfflineListener",function(a){C.P=a});function F(a){var b;var c="";var d=a.length;for(b=0;b=g?c+=a.charAt(b):(2047>12&15),c+=String.fromCharCode(128|g>>6&63)):c+=String.fromCharCode(192|g>>6&31),c+=String.fromCharCode(128|g>>0&63))}return c} function G(a){var b;var c="";var d=a.length;for(b=0;b>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:c+=a.charAt(b-1);break;case 12:case 13:var e=a.charCodeAt(b++);c+=String.fromCharCode((g&31)<<6|e&63);break;case 14:e=a.charCodeAt(b++);var q=a.charCodeAt(b++);c+=String.fromCharCode((g&15)<<12|(e&63)<<6|(q&63)<<0)}}return c} var H=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]; function I(a){var b;var c=a.length;var d=0;for(b="";d>2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((g&3)<<4);b+="==";break}var e=a.charCodeAt(d++);if(d==c){b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(g>>2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((g&3)<<4|(e&240)>>4);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e& 15)<<2);b+="=";break}var q=a.charCodeAt(d++);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(g>>2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((g&3)<<4|(e&240)>>4);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&15)<<2|(q&192)>>6);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(q&63)}return b} function J(a){var b;var c=a.length;var d=0;for(b="";d>4);do{g=a.charCodeAt(d++)&255;if(61==g)return b;g=H[g]}while(d>2);do{e=a.charCodeAt(d++)&255;if(61==e)return b;e=H[e]}while(d/g,">")}catch(R){}E("serviceMessageSend",{messagetype:a,sid:I(F(b+"")),ipocids:I(F(c+"")),contenttext:I(F(d+"")),contentres:I(F(g+"")),contentres1:I(F(q+"")),allowOfflineSend:e})}function Ia(a,b,c,d,g){try{d=d.replace(//g,">")}catch(e){}E("servicePicMessageSend",{messagetype:a,sid:I(F(b+"")),ipocids:I(F(c+"")),picpath:I(F(d+"")),allowOfflineSend:g})} function Ua(a,b,c,d,g,e,q){E("serviceResourceReportCaptureLocalBuffer",{ownerId:I(F(a+"")),resType:b,resTypeExt:I(F(c+"")),picData:d,content:I(F(g+"")),picMark:I(F(e+"")),taskId:I(F(q+""))})}function Ta(a,b,c,d,g,e,q){E("serviceResourceReportCaptureLocal",{ownerId:I(F(a+"")),resType:b,resTypeExt:I(F(c+"")),picPath:I(F(d+"")),content:I(F(g+"")),picMark:I(F(e+"")),taskId:I(F(q+""))})}function Ja(a){E("serviceChatroomDelete",{roomId:I(F(a))})} function Ka(a,b,c,d){E("serviceChatroomModifyMember",{ipocid:I(F(b+"")),roomid:I(F(a)),memberType:c,memberTalkDuration:d})}function La(){E("serviceRecordStart")}function Ma(a){E("serviceRecordStop",{isCancel:a})}function Na(){mouseDownOrUpRecord(3);E("serviceRecordStart")}function Oa(){mouseDownOrUpRecord(3);E("serviceRecordStop",{isCancel:0})} function Pa(a){var b=$("#inputDownloadURL").val();b==""+str_select_store_path+""?Toast(""+str_select_save_path+"",2):E("serviceRecDataLoad",{resid:I(F(a+"")),path:I(F(b+"\\")),isEncrypt:0})}function Qa(a,b){E("serviceSessionLock",{sessionid:a,isLock:b})}function Ra(a,b,c,d,g){E("serviceSecretImageDownloadSync",{code:I(F(a)),url:I(F(b)),secret:c,secret_key:I(F(d))},function(a){a.l()&&m("serviceSecretImageDownloadSync: Failed:",a.error);g&&g(G(J(a.result)))})} function Sa(a,b,c,d){a=I(F(a));b=I(F(b));d=I(F(d));try{E("serviceSecretImageDownload",{code:a,url:b,secret:c,secret_key:d})}catch(g){}}D("eventLogin",function(a,b){onLogin(b.result,b.secret)});D("eventLogout",function(a,b){onLogout(b.ok)});D("eventChannelSessionAlertClose",function(a,b){eventChannelSessionAlertClose(b.result)});D("eventChannelSessionAlertSent",function(a,b){eventChannelSessionAlertSent(b.result,b.sid)}); D("eventChannelSessionAlertStart",function(a,b){eventChannelSessionAlertStart(b.channelId,b.callerId,b.callerName)});D("eventChatroomCreate",function(a,b){a=b.isOk;b=b.roomId;try{onChatroomCreate(a,b)}catch(c){K("[eventChatroomCreate ] : isOk= "+a+" roomId ="+b+" E:"+c)}});D("eventChatroomDelete",function(a,b){a=b.isOk;try{onChatroomDelete(a,null)}catch(c){K("[eventChatroomDelete ] :isOk="+a+" E:"+c)}}); D("eventChatroomEnter",function(a,b){a=b.replyOk;b=b.sessionIndex;try{onChatRoomEnter(a,b)}catch(c){K("[eventChatroomEnter ] : sessionIndex= "+b+" replyOk="+a+" E:"+c)}});D("eventChatroomExit",function(a,b){a=b.sessionIndex;try{onChatRoomExit(a)}catch(c){K("[eventChatroomExit ] : sessionIndex= "+a+" E:"+c)}});D("eventChatroomMemberAdd",function(a,b){a=b.isOk;try{onChatroomAddMember(a)}catch(c){K("[eventChatroomAddMember ] : isOk= "+a+" E:"+c)}}); D("eventChatroomMemberDelete",function(a,b){a=b.isOK;try{onChatroomMemberDelete(a)}catch(c){K("[onChatroomMemberDelete ] : isOk= "+a+" E:"+c)}});D("eventChatroomMemberModify",function(a,b){a=b.isOK;try{onMemberPrioritySave(a)}catch(c){K("[eventChannelMemberModify ] :isOk="+a+" E:"+c)}});D("eventChatroomPresence",function(a,b){$a(b.json)});D("eventChatroomPresenceAdd",function(a,b){ab(b.json)});D("eventChatroomPresenceDel",function(a,b){bb(b.json)});D("eventChatroomQueue",function(a,b){cb(b.jsonStr)}); D("eventChatroomUpdate",function(a,b){a=b.isOk;try{onChatroomUpdate(a)}catch(c){K("[onChatroomMemberDelete ] : isOk= "+a+" E:"+c)}});D("eventDialogMemberGet",function(a,b){db(b.json)});D("eventDialogMemberUpdate",function(a,b){eb(b.json)});D("eventDialogMemberUpdateNotify",function(a,b){fb(b.json)});D("eventDialogPresence",function(a,b){gb(b.json)});D("eventHeartbeat",function(a,b){a=b.result;try{onHeartbeat(a)}catch(c){K("[eventHeartBeat ] : result= "+a+" E:"+c)}});D("eventInqueueConfirm",function(){}); D("eventMediaInqueueConfirm",function(a,b){eventMediaInqueueConfirm(b.sessionIndex)});D("eventMediaOutqueueConfirm",function(a,b){eventMediaOutqueueConfirm(b.sessionIndex)});D("eventMediaStateIdle",function(a,b){a=b.sessionIndex;try{onMediaStateIdle(a,b.reason)}catch(c){K("[eventMediaStateIdle ] : sessionIndex= "+a+" E:"+c)}}); D("eventMediaStateListen",function(a,b){a=b.sessionIndex;b=b.speaker;try{b=G(J(b)),onMediaStateListern(a,b)}catch(c){K("[eventMediaStateListern ] : sessionIndex= "+a+"speaker="+b+" E:"+c)}});D("eventMediaStateTalk",function(a,b){a=b.sessionIndex;try{onMediaStateTalk(a)}catch(c){K("[eventMediaStateTalk ] : sessionIndex= "+a+" E:"+c)}}); D("eventMediaVoice",function(a,b){a=b.sessionIndex;b=b.speaker;try{currentTabSession&¤tTabSession||$("#current-speaker"+a).ra('
'+getUserDisplayName(b)+'
'+str_speaking+"
")}catch(c){K("[eventMediaVoice ] :sessionIndex="+a+"speaker="+b+" E:"+c)}}); D("eventMessageRecv",function(a,b){hb(b.result,b.json)});D("eventMessageSent",function(a,b){ib(b.result,b.json)});D("eventOutQueueConfirm",function(){});D("eventPushBroadcast",function(){try{newBroadcast(),onDialogClose()}catch(a){K("[eventPushBroadcast ] :json="+jsons+" E:"+a)}});D("eventPushContent",function(a,b){jb(b.json)});D("eventPushLocation",function(a,b){kb(b.json)});D("eventPushReport",function(a,b){lb(b.json)});D("eventRecDataLoaded",function(a,b){recordDownloadCheck(b.ret)}); D("eventRecRecordStart",function(a,b){a=b.wParam;try{eventRecRecordStart(a)}catch(c){K("[OnJsEventRecRecordStart ] :wParam="+a+" E:"+c)}});D("eventRecRecordStop",function(a,b){a=b.wParam;try{eventRecRecordStop(a,G(J(b.base64Resid)))}catch(c){K("[OnJsEventRecRecordStop ] :wParam="+a+" E:"+c)}});D("eventRecordPlayStart",function(a,b){a=b.code;b=b.resid;try{a=G(J(a)),onRecordPlayStart(a,G(J(b)))}catch(c){K("[eventRecordPlayStart ] : code= "+a+"resid= "+b+" E:"+c)}}); D("eventRecordPlayStop",function(a,b){a=b.code;b=b.resid;try{a=G(J(a)),onRecordPlayStop(a,G(J(b)))}catch(c){K("[eventRecordPlayStop ] : code= "+a+"resid= "+b+" E:"+c)}});D("eventSecretImageDownload",function(a,b){mb(b.info)});D("eventSessionEstablish",function(a,b){try{onSessionEstablish(b.sessionIndex,G(J(b.sid)))}catch(c){}}); D("eventSessionIncomingAlert",function(a,b){a=b.sessionIndex;var c=b.user;b=b.sid;try{onSessionIncomingAlert(a,G(J(c)),G(J(b)))}catch(d){K("[eventSessionIncomingAlert ] : sessionIndex= "+a+"user="+c+"sid="+b+" E:"+d)}});D("eventSessionOutgoingRinging",function(a,b){a=b.sessionIndex;b=b.sid;try{onSessionOutgoingRinging(a,G(J(b)))}catch(c){K("[eventSessionOutgoingRinging ] : sessionIndex= "+a+"sid="+b+" E:"+c)}}); D("eventSessionRelease",function(a,b){a=b.sessionIndex;b=b.releaseReason;try{onSessionRelease(a,b)}catch(c){K("[eventSessionRelease ] : sessionIndex= "+a+"releaseReason"+b+" E:"+c)}});D("eventUserPresence",function(a,b){nb(b.json)});D("eventVideoShare",function(a,b){ob(b.json)});D("eventVideoCaptureFinish",function(a,b){a=b.ok;try{onVideoReportCaptureLocalFinish(a)}catch(c){K("[onEventVideoCaptureFinish ] : ok= "+a+" E:"+c)}});D("eventRestart",function(){var a=window.eventSvcRestart;a&&a()}); function cb(a){try{var b=G(J(a));onChatroomQueue(eval("("+b+")"))}catch(c){K("[eventChatroomQueue ] : parseJson= "+b+" E:"+c)}}function nb(a){try{var b=G(J(a));onContactPresence(eval("("+b+")"))}catch(c){K("[eventContactPresenceAir ] : parseJson= "+b+" E:"+c)}}function lb(a){try{var b=G(J(a));onUserMessage(eval("("+b+")"))}catch(c){K("[eventPushReport ] : json= "+b+" E:"+c)}} function kb(a){try{var b=G(J(a));onUserLocaltionChanged(eval("("+b+")"))}catch(c){K("[eventUserLocaltionChanged ] : json= "+b+" E:"+c)}}function hb(a,b){try{if(null!=b&&""!=b){var c=G(J(b));if(null!=c){var d=eval("("+c+")");onMessageRecv(a,d)}}}catch(g){K("[eventMessageRecv ] : json= "+b+" E:"+g)}}function ib(a,b){try{var c=G(J(b));var d=eval("("+c+")");4==d.state&&onMessageSent(0,d)}catch(g){K("[eventMessageSent ] : result= "+a+"json="+c+" E:"+g)}} function jb(a){try{var b=G(J(a));b=eval("("+b+")");switch(b.t){case 210:pushWarningFence(b);break;case 216:pb(b);break;case 218:qb(b);break;case 129:rb(b);break;case 300:try{onPushUserNameChanged(b)}catch(c){K("[onPushUserNameChanged] :json="+b+" E:"+c)}break;case 301:try{onPushOrgNameChanged(b)}catch(c){K("[onPushOrgNameChanged] :json="+b+" E:"+c)}break;case 302:try{onPushUserRoleChanged(b)}catch(c){K("[onPushUserRoleChanged] :json="+b+" E:"+c)}break;case 303:try{onPushOrgStructChanged(b)}catch(c){K("[onPushOrgStructChanged] :json="+ b+" E:"+c)}}}catch(c){K("[eventPushContent ] :json="+b+" E:"+c)}}function pb(a){try{onVideoCaptureGet(a)}catch(b){K("[videoCaptureGet ] :json="+a+" E:"+b)}}function qb(a){try{onVideoLocalCaptureGet(a)}catch(b){K("[videoLocalCaptureGet ] :json="+a+" E:"+b)}}function rb(a){try{onVideoStorePush(a)}catch(b){K("[videoStorePush ] :json="+a+" E:"+b)}}function gb(a){try{var b=G(J(a));onSessionDialogPresence(eval("("+b+")"))}catch(c){K("[eventSessionDialogPresence ] :json="+b+" E:"+c)}} function db(a){try{var b=G(J(a));onSessionDialogMemberChange(eval("("+b+")"))}catch(c){K("[eventSessionDialogMemberGet ] :json="+b+" E:"+c)}}function eb(a){try{var b=G(J(a));onSessionDialogMemberChange(eval("("+b+")"))}catch(c){K("[eventSessionDialogMemberChange ] :json="+b+" E:"+c)}}function fb(a){try{onSessionDialogMemberChange(eval("("+G(J(a))+")"))}catch(b){K("[eventSessionDialogMemberNotify ] :json="+J(a)+" E:"+b)}} function $a(a){try{var b=G(J(a));onSessionChannelPresence(eval("("+b+")"))}catch(c){K("[eventSessionChannelPresence ] :json="+b+" E:"+c)}}function ab(a){try{var b=G(J(a));onSessionChannelUserEnter(eval("("+b+")"))}catch(c){K("[eventSessionChannelUserEnter ] :json="+b+" E:"+c)}}function bb(a){try{var b=G(J(a));onSessionChannelUserExit(eval("("+b+")"))}catch(c){K("[eventSessionChannelUserExit ] :json="+b+" E:"+c)}} function ob(a){try{var b=G(J(a));L(eval("("+b+")"))}catch(c){K("[eventVideoShare ] :json="+b+" E:"+c)}}function mb(a){try{var b=G(J(a));b=eval("("+b+")");setResPath(b.code,b.file_path);document.getElementById(b.code).src=b.file_path}catch(c){K("[eventSecretImageDownload ] : E:"+c)}}function K(a){console.log("setWebError:"+a)};function M(a,b,c){this.j="string"==typeof a?document.getElementById(a):a;this.b=b;this.u=c;this.c=!1;this.a=this.h=null}M.prototype.stop=function(){this.c&&(this.c=!1,"open"==this.a.readyState&&this.a.endOfStream(),this.h&&this.h.close(),this.buffer=this.a=this.h=null,this.m&&clearInterval(this.m))}; M.prototype.start=function(){if(!this.c){this.c=!0;var a=this.buffer,b=[],c=0,d=this,g=this.j,e=this.a=new MediaSource;g.addEventListener("loadeddata",function(){2<=g.readyState&&g.play()});g.addEventListener("loadedmetadata",function(){});g.addEventListener("error",function(){var a=g.error;console.log("video.error: err.code:",a.code,"; type:",typeof a,"; message:",a.message)});e.addEventListener("sourceopen",function(){a=this.buffer=e.addSourceBuffer(d.b);a.addEventListener("update",function(){0< b.length&&!a.updating&&a.appendBuffer(b.shift())});a.addEventListener("updateend",function(){!a.updating&&1<=a.buffered.length&&30=g.readyState?c++:c=0;var b=d.j,e=b.buffered;if(0!=e.length){if(b.readyState<=HTMLMediaElement.HAVE_CURRENT_DATA)for(var q=b.currentTime,x=0;xq){b.currentTime=e.start(x);m(b.id,"Advance playback time to next segment:",x,"of",e.length);break}}e=e.end(e.length-1);q=e-b.currentTime;0>q&&(b.currentTime=e-1,q=e-b.currentTime,m(b.id,"currentTime is out of range. fix it"));d.s==b.currentTime&&1b.playbackRate?(b.playbackRate=2,m(b.id,"Fastforward: lag="+q.toFixed(1)+"; playbackRate="+b.playbackRate)): 2b.playbackRate?(b.playbackRate=1.5,m(b.id,"Fastforward: lag="+q.toFixed(1)+"; playbackRate="+b.playbackRate)):1b.playbackRate?(b.playbackRate=1.2,m(b.id,"Fastforward: lag="+q.toFixed(1)+"; playbackRate="+b.playbackRate)):1>=q&&1!=b.playbackRate&&(b.playbackRate=1,m(b.id,"Stop Fastforward: lag="+q.toFixed(1)+"; playbackRate="+b.playbackRate))}},!1)},!1);var q=d.h=new WebSocket(d.u);q.binaryType="arraybuffer";q.addEventListener("message",function(c){c=c.data;"string"==typeof c?(c=JSON.parse(c), 1==c.type&&(d.b=c["MIME-Codecs"],console.log("Codecs:",d.b,"; supported:",MediaSource.isTypeSupported(d.b)),g.src=window.URL.createObjectURL(e))):!a||a.updating?b.push(c):a.appendBuffer(c)},!1)}};var O=new N(36);l("videoSessionList",O);var P="player.swf",Q=t(),S=0,T=!0;Date.ia=function(a){return a+28800};l("Date.sec",Date.ia);l("setPlayerPath",function(a){P=a});l("setRtmpPlayer",function(a){S=a});l("enableFullScreen",function(a){T=a});l("onVideoStalled",function(a,b){var c=O.K(a);c&&("stall"==b?c.U():(c=c.f,c.pause(),c.resume()));m(b,"detected for",a)});function W(a){a=null==a?t():a;E("setPlayerType",{type:a});Q=a;3==Q&&D("eventAVResync",function(a,c){m("eventAVResync",c)})} l("setPlayerType",W);B(function(a){a&&(O.T(window.onNewVideoHandler,window.onVideoStopHandler,function(a){alert(a.ssid+" too many videos")}),W())});l("playVideo",function(a,b,c,d,g,e){E("playVideo",{url:a,ipocid:b?b:"",opts:c?c:"",cls:d?d:0,sid:g?g:0,ssid:e?e:0})});function X(a,b){this.g=a;a.videoSession=this;this.time=new Date;this.i=b;this.paused=!1}X.prototype.Z=function(){return this.g};X.prototype.getInf=X.prototype.Z;X.prototype.ca=function(){return this.f};X.prototype.getPlayer=X.prototype.ca; X.prototype.startTime=function(){return this.time};X.prototype.startTime=X.prototype.startTime; function sb(a,b){a.f=b;b.videoSession=a;b.src=a.g.url;b.autoplay=!0;b.id="av_"+a.g.ssid;a.o(void 0);0==a.i?setTimeout(function(){try{b.VideoPlayUrl(b.src),b.Mute(b.muted)}catch(c){alert("\u64ad\u653e\u5668\u52a0\u8f7d\u5931\u8d25\u3002\n\n\u8bf7\u5c06\u5f53\u524d\u7f51\u7ad9\u52a0\u5165\u5230\u201c\u53d7\u4fe1\u4efb\u7684\u7ad9\u70b9\u201d\u4e2d\uff0c\u5e76\u5c06\u201c\u8be5\u533a\u57df\u7684\u5b89\u5168\u7ea7\u522b\u201d\u8bbe\u7f6e\u4e3a\u201c\u4f4e\u201d\uff0c\u7136\u540e\u91cd\u542f\u6d4f\u89c8\u5668\u3002")}}):2== a.i?(a.a=new M(b,"",p()+"://127.0.0.1:"+h+"/av/"+a.g.ssid),a.a.start()):1==a.i?a.a=window.Streamedian.sa(b,{ta:p()+"://127.0.0.1:"+h+"/rtsp"}):3==a.i&&1==S&&a.o()}X.prototype.o=function(a){var b=this.i,c=this.f;c.muted=null==a?!0:a;if(!c.muting){c.muting=!0;var d=function(a,b,c){var e=!b.D;try{0==a&&b.GetMute!=b.muted?b.Mute(b.muted):3==a&&b.getProperty("muted")!=b.muted&&b.setProperty("muted",b.muted)}catch(ub){e=!0}e&&c&&--c?setTimeout(function(){d(a,b,c)},20):b.muting=!1};d(b,c,500)}}; X.prototype.mute=X.prototype.o;X.prototype.F=function(){var a=this.f;return 3==this.i&&a.snapshot?a.snapshot():null};X.prototype.snapshot=X.prototype.F;X.prototype.v=function(a){if(T){var b=this.i,c=this.f;c.N=null==a?!0:a;if(!c.B){c.B=!0;var d=function(a,b,c){var e=!1;3==a&&(b.setProperty&&b.setProperty("enableDblClick",b.N),e=null==b.getProperty||b.getProperty("enableDblClick")!=b.N);b.B=e&&0<--c;b.B&&setTimeout(function(){d(a,b,c)},20)};d(b,c,500)}}};X.prototype.enableFullScreen=X.prototype.v; X.prototype.ea=function(){return this.paused};X.prototype.isPaused=X.prototype.ea;X.prototype.pause=function(){var a=this.f;this.paused||(a.pause&&a.pause(),E("pauseVideo",{ssid:this.g.ssid}),this.paused=!0)};X.prototype.pause=X.prototype.pause;X.prototype.resume=function(){var a=this.f;this.paused&&(a.resume&&a.resume(),E("resumeVideo",{ssid:this.g.ssid}),this.paused=!1)};X.prototype.resume=X.prototype.resume;X.prototype.rotate=function(a){var b=this.f;b.rotate&&b.rotate(null==a?a:90)}; X.prototype.rotate=X.prototype.rotate;X.prototype.ma=function(){E("syncVideo",{ssid:this.g.ssid})};X.prototype.syncSrc=X.prototype.ma;X.prototype.U=function(){var a=this.f;3==this.i&&a.sync&&a.sync()};X.prototype.syncPlayer=X.prototype.U;X.prototype.end=function(){E("stopVideo",{ssid:this.g.ssid})};X.prototype.end=X.prototype.end; X.prototype.stop=function(){try{this.f&&(0==this.i&&this.f.VideoStop?this.f.VideoStop():this.f.pause&&this.f.pause(),this.f.src=null),this.a&&(this.a.stop&&this.a.stop(),this.a.V&&setTimeout(function(a){try{a.V()}catch(b){m(b)}},1E3,this.a)),this.f.stop&&this.f.stop()}catch(a){}};function N(a){this.j=a;this.a=[];this.h=[];this.c=[];this.b=null}N.prototype.aa=function(){return this.j};N.prototype.getLimit=N.prototype.aa;N.prototype.ja=function(a){this.j=a};N.prototype.setLimit=N.prototype.ja; N.prototype.O=function(){return this.size()>=this.j};N.prototype.full=N.prototype.O;N.prototype.size=function(){return this.a.length};N.prototype.size=N.prototype.size;N.prototype.C=function(a){if(!a)return-1;var b=this.a.indexOf(a);-1!=b&&this.a.splice(b,1);a.stop();return b};N.prototype.hangup=N.prototype.C;N.prototype.X=function(a){for(var b=0;ba||a>=this.size()?0:a}else a=Y(this);this.b=null;0<=a&&a=a.size()&&(b=0);b>=a.size()&&(b=-1);return b} N.prototype.la=function(){var a=[],b=0,c=this;this.a.forEach(function(d){d!=c.b&&(-1==c.h.indexOf(d.g.sid)?a.push(d):a.splice(b++,0,d))});return a};N.prototype.showList=N.prototype.la;N.prototype.qa=function(){return this.c};N.prototype.waitList=N.prototype.qa;N.prototype.H=function(a){"number"===typeof a.J?this.c.splice(a.J,0,a):this.c.push(a)};N.prototype.wait=N.prototype.H; N.prototype.G=function(a){var b=this.c.length;if(null!=a)for(var c=0;c