diff --git a/README.md b/README.md index 655f1a9..397653a 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,12 @@
this.length)return"";if((n=void 0===n||n>this.length?this.length:n)<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var i=this,r=t,s=n,c=i.length;(!s||s<0||ct&&(e+=" ... "),">>=0,isFinite(n)?(n>>>=0,void 0===o&&(o="utf8")):(o=n,n=void 0)}var a=this.length-t;if((void 0===n||a>1,d=-7,u=n?a-1:0,f=n?-1:1,a=e[t+u];for(u+=f,i=a&(1<<-d)-1,a>>=-d,d+=s;0
':t.innerHTML='Download '+e.name+'
'):console.error("No such progress-helper element exist.",e)}}},t={handle:function(a){a.autoTranslateText=!1,a.language="en",a.googKey="AIzaSyCgB5hmFY74WYB-EoWkhr9cAGr6TiTHrEE",a.Translator={TranslateText:function(e,t){var n=document.createElement("script"),e=(n.type="text/javascript",encodeURIComponent(e)),o="method"+a.token(),o=(window[o]=function(e){e.data&&e.data.translations[0]&&t?t(e.data.translations[0].translatedText):e.error&&"Daily Limit Exceeded"===e.error.message?console.error('Text translation failed. Error message: "Daily Limit Exceeded."'):e.error?console.error(e.error.message):console.error(e)},"https://www.googleapis.com/language/translate/v2?key="+a.googKey+"&target="+(a.language||"en-US")+"&callback=window."+o+"&q="+e);n.src=o,document.getElementsByTagName("head")[0].appendChild(n)},getListOfLanguages:function(t){var n=new XMLHttpRequest,e=(n.onreadystatechange=function(){var e;n.readyState==XMLHttpRequest.DONE&&((e=JSON.parse(n.responseText))&&e.data&&e.data.languages?t(e.data.languages):e.error&&"Daily Limit Exceeded"===e.error.message?console.error('Text translation failed. Error message: "Daily Limit Exceeded."'):e.error?console.error(e.error.message):console.error(e))},"https://www.googleapis.com/language/translate/v2/languages?key="+a.googKey+"&target=en");n.open("GET",e,!0),n.send(null)}}}};function I(t){if(j.socketAutoReConnect=!0,j.socket)t&&t(j.socket);else{if(void 0===n)if("undefined"!=typeof FirebaseConnection)window.SocketConnection=FirebaseConnection;else{if("undefined"==typeof PubNubConnection)throw"SocketConnection.js seems missed.";window.SocketConnection=PubNubConnection}new n(j,function(e){t&&t(j.socket)})}}function Oe(n,o){j.socket.emit("join-room",{sessionid:j.sessionid,session:j.session,mediaConstraints:j.mediaConstraints,sdpConstraints:j.sdpConstraints,streams:Re(),extra:j.extra,password:void 0!==j.password&&"object"!==Be(j.password)?j.password:""},function(e,t){if(!0===e){if(j.enableLogs&&console.log("isRoomJoined: ",e," roomid: ",j.sessionid),j.peers[j.sessionid])return;P.onNegotiationNeeded(n)}!1===e&&j.enableLogs&&console.warn("isRoomJoined: ",t," roomid: ",j.sessionid),o(e,j.sessionid,t)})}function Me(n){j.enableLogs&&console.log("Sending open-room signal to socket.io"),j.waitingForLocalMedia=!1,j.socket.emit("open-room",{sessionid:j.sessionid,session:j.session,mediaConstraints:j.mediaConstraints,sdpConstraints:j.sdpConstraints,streams:Re(),extra:j.extra,identifier:j.publicRoomIdentifier,password:void 0!==j.password&&"object"!==Be(j.password)?j.password:""},function(e,t){!0===e&&(j.enableLogs&&console.log("isRoomOpened: ",e," roomid: ",j.sessionid),n(e,j.sessionid)),!1===e&&(j.enableLogs&&console.warn("isRoomOpened: ",t," roomid: ",j.sessionid),n(e,j.sessionid,t))})}function Re(){try{return j.streamEvents.selectAll("local").map(function(e){return{streamid:e.streamid,tracks:e.stream.getTracks().length}})}catch(e){return[]}}function je(e,n){var t,o;j.dontCaptureUserMedia||e.isDataOnly?n():(t={},e.localPeerSdpConstraints.OfferToReceiveAudio&&(t.audio=j.mediaConstraints.audio),e.localPeerSdpConstraints.OfferToReceiveVideo&&(t.video=j.mediaConstraints.video),(o=e.session||j.session).oneway&&"two-way"!==o.audio&&"two-way"!==o.video&&"two-way"!==o.screen?n():((o=o.oneway&&o.audio&&"two-way"===o.audio?{audio:!0}:o).audio||o.video||o.screen)&&(o.screen?"Edge"===DetectRTC.browser.name?navigator.getDisplayMedia({video:!0,audio:x(j)}).then(function(e){e.isScreen=!0,P.onGettingLocalMedia(e),!o.audio&&!o.video||x(j)?n(e):j.invokeGetUserMedia(null,n)},function(e){console.error("Unable to capture screen on Edge. HTTPs and version 17+ is required.")}):j.getScreenConstraints(function(e,t){j.invokeGetUserMedia({audio:!!x(j)&&le(t),video:t,isScreen:!0},!o.audio&&!o.video||x(j)?n:j.invokeGetUserMedia(null,n))}):(o.audio||o.video)&&j.invokeGetUserMedia(null,n,o)))}function Pe(e,t){e?(t.audio&&_(e,"audio").forEach(function(e){e.applyConstraints(t.audio)}),t.video&&_(e,"video").forEach(function(e){e.applyConstraints(t.video)})):j.enableLogs&&console.error("No stream to applyConstraints.")}function Ne(t,e,n){e?P.replaceTrack(t,e,n):j.peers.getAllParticipants().forEach(function(e){P.replaceTrack(t,e,n)})}D=D||{useDefaultDevices:!0},(j=this).channel=j.sessionid=(L||location.href.replace(/\/|:|#|\?|\$|\^|%|\.|`|~|!|\+|@|\[|\||]|\|*. /g,"").split("\n").join("").split("\r").join(""))+"",P=new B(j),Ee={},P.onGettingLocalMedia=function(t,a){if(a=a||function(){},Ee[t.streamid])a();else{Ee[t.streamid]=!0;try{t.type="local"}catch(e){}j.setStreamEndHandler(t),F(t,function(e){e.id=t.streamid,e.muted=!0,e.volume=0,-1===j.attachStreams.indexOf(t)&&j.attachStreams.push(t),void 0!==k&&k.setHandlers(t,!0,j),j.streamEvents[t.streamid]={stream:t,type:"local",mediaElement:e,userid:j.userid,extra:j.extra,streamid:t.streamid,isAudioMuted:!0};try{var n=j,o=j.streamEvents[t.streamid];if(o.stream&&_(o.stream,"audio").length){if(!n||!o)throw"Both arguments are required.";if(n.onspeaking&&n.onsilence){if("undefined"==typeof hark)throw"hark.js not found.";hark(o.stream,{onspeaking:function(){n.onspeaking(o)},onsilence:function(){n.onsilence(o)},onvolumechange:function(e,t){n.onvolumechange&&n.onvolumechange(Fe({volume:e,threshold:t},o))}})}}U(j,j.streamEvents[t.streamid]),j.onstream(j.streamEvents[t.streamid])}catch(e){}a()},j)}},P.onGettingRemoteMedia=function(t,n){try{t.type="remote"}catch(e){}j.setStreamEndHandler(t,"remote-stream"),F(t,function(e){e.id=t.streamid,void 0!==k&&k.setHandlers(t,!1,j),j.streamEvents[t.streamid]={stream:t,type:"remote",userid:n,extra:j.peers[n]?j.peers[n].extra:{},mediaElement:e,streamid:t.streamid},U(j,j.streamEvents[t.streamid]),j.onstream(j.streamEvents[t.streamid])},j)},P.onRemovingRemoteMedia=function(e,t){var n=(n=j.streamEvents[e.streamid])||{stream:e,type:"remote",userid:t,extra:j.peers[t]?j.peers[t].extra:{},streamid:e.streamid,mediaElement:j.streamEvents[e.streamid]?j.streamEvents[e.streamid].mediaElement:null};j.peersBackup[n.userid]&&(n.extra=j.peersBackup[n.userid].extra),j.onstreamended(n),delete j.streamEvents[e.streamid]},P.onNegotiationNeeded=function(e,t,n){n=n||function(){};var o={remoteUserId:t=t||e.remoteUserId,message:e=e||"",sender:j.userid};e.remoteUserId&&e.message&&e.sender&&(o=e),I(function(){j.socket.emit(j.socketMessageEvent,o,n)})},P.onUserLeft=function(e){j.deletePeer(e)},P.disconnectWith=function(e,t){j.socket&&j.socket.emit("disconnect-with",e,t||function(){}),j.deletePeer(e)},j.socketOptions={transport:"polling"},j.openOrJoin=function(e,r){r=r||function(){},j.checkPresence(e,function(e,t){var n,o,a,i;e?(j.sessionid=t,e=!!j.session.oneway,n=c(j.session),o={OfferToReceiveAudio:j.sdpConstraints.mandatory.OfferToReceiveAudio,OfferToReceiveVideo:j.sdpConstraints.mandatory.OfferToReceiveVideo},a={OfferToReceiveAudio:e?!!j.session.audio:j.sdpConstraints.mandatory.OfferToReceiveAudio,OfferToReceiveVideo:e?!!j.session.video||!!j.session.screen:j.sdpConstraints.mandatory.OfferToReceiveVideo},je((i={remoteUserId:j.sessionid,message:{newParticipationRequest:!0,isOneWay:e,isDataOnly:n,localPeerSdpConstraints:a,remotePeerSdpConstraints:o},sender:j.userid}).message,function(){Oe(i,r)})):(j.waitingForLocalMedia=!0,j.isInitiator=!0,j.sessionid=t||j.sessionid,c(j.session)?Me(r):j.captureUserMedia(function(){Me(r)}))})},j.waitingForLocalMedia=!1,j.open=function(e,t){t=t||function(){},j.waitingForLocalMedia=!0,j.isInitiator=!0,j.sessionid=e||j.sessionid,I(function(){c(j.session)?Me(t):j.captureUserMedia(function(){Me(t)})})},j.peersBackup={},j.deletePeer=function(e){if(e&&j.peers[e]){var t={userid:e,extra:j.peers[e]?j.peers[e].extra:{}};if(j.peersBackup[t.userid]&&(t.extra=j.peersBackup[t.userid].extra),j.onleave(t),j.peers[e]){j.peers[e].streams.forEach(function(e){e.stop()});t=j.peers[e].peer;if(t&&"closed"!==t.iceConnectionState)try{t.close()}catch(e){}j.peers[e]&&(j.peers[e].peer=null,delete j.peers[e])}}},j.rejoin=function(e){var t;!j.isInitiator&&e&&Object.keys(e).length&&(t={},j.peers[e.remoteUserId]&&(t=j.peers[e.remoteUserId].extra,j.deletePeer(e.remoteUserId)),e&&e.remoteUserId&&(j.join(e.remoteUserId),j.onReConnecting({userid:e.remoteUserId,extra:t})))},j.join=function(e,t){j.sessionid=!!e&&(e.sessionid||e.remoteUserId||e)||j.sessionid,j.sessionid+="";var n=!1,o=!1,a=!1,i=!1,r=((e&&e.session||!e||"string"==typeof e)&&(a=!!(e=e&&e.session||j.session).oneway,i=c(e),o={OfferToReceiveAudio:j.sdpConstraints.mandatory.OfferToReceiveAudio,OfferToReceiveVideo:j.sdpConstraints.mandatory.OfferToReceiveVideo},n={OfferToReceiveAudio:a?!!j.session.audio:j.sdpConstraints.mandatory.OfferToReceiveAudio,OfferToReceiveVideo:a?!!j.session.video||!!j.session.screen:j.sdpConstraints.mandatory.OfferToReceiveVideo}),function(){}),s=("function"==typeof(t=t||{})&&(r=t,t={}),void 0!==t.localPeerSdpConstraints&&(n=t.localPeerSdpConstraints),void 0!==t.remotePeerSdpConstraints&&(o=t.remotePeerSdpConstraints),void 0!==t.isOneWay&&(a=t.isOneWay),void 0!==t.isDataOnly&&(i=t.isDataOnly),{remoteUserId:j.sessionid,message:{newParticipationRequest:!0,isOneWay:a,isDataOnly:i,localPeerSdpConstraints:n,remotePeerSdpConstraints:o},sender:j.userid});return je(s.message,function(){I(function(){Oe(s,r)})}),s},j.publicRoomIdentifier="",j.getUserMedia=j.captureUserMedia=function(o,a){o=o||function(){};var i=a||j.session;j.dontCaptureUserMedia||c(i)?o():(i.audio||i.video||i.screen)&&(i.screen?"Edge"===DetectRTC.browser.name?navigator.getDisplayMedia({video:!0,audio:x(j)}).then(function(e){if(e.isScreen=!0,P.onGettingLocalMedia(e),!i.audio&&!i.video||x(j))o(e);else{var t,n={};for(t in i)"screen"!==t&&(n[t]=i[t]);j.invokeGetUserMedia(a,o,n)}},function(e){console.error("Unable to capture screen on Edge. HTTPs and version 17+ is required.")}):j.getScreenConstraints(function(e,t){if(e)throw e;j.invokeGetUserMedia({audio:!!x(j)&&le(t),video:t,isScreen:!0},function(e){if(!i.audio&&!i.video||x(j))o(e);else{var t,n={};for(t in i)"screen"!==t&&(n[t]=i[t]);j.invokeGetUserMedia(a,o,n)}})}):(i.audio||i.video)&&j.invokeGetUserMedia(a,o,i))},j.onbeforeunload=function(e,t){j.closeBeforeUnload&&(j.peers.getAllParticipants().forEach(function(e){P.onNegotiationNeeded({userLeft:!0},e),j.peers[e]&&j.peers[e].peer&&j.peers[e].peer.close(),delete j.peers[e]}),t||j.closeSocket(),j.isInitiator=!1)},window.ignoreBeforeUnload?j.closeBeforeUnload=!1:(j.closeBeforeUnload=!0,window.addEventListener("beforeunload",j.onbeforeunload,!1)),j.userid=f(),j.changeUserId=function(e,t){t=t||function(){},j.userid=e||f(),j.socket.emit("changed-uuid",j.userid,t)},j.extra={},j.attachStreams=[],j.session={audio:!0,video:!0},j.enableFileSharing=!1,j.bandwidth={screen:!1,audio:!1,video:!1},j.codecs={audio:"opus",video:"VP9"},j.processSdp=function(e){return function(){var t=!1;try{if("undefined"==typeof RTCRtpTransceiver)return;if(!("currentDirection"in RTCRtpTransceiver.prototype))return;var e=new T;try{e.addTransceiver("audio"),t=!0}catch(e){}e.close()}catch(e){t=!1}return t&&function(){var t=!1;try{var e=new T({sdpSemantics:"unified-plan"});try{var n=e.getConfiguration(),t="unified-plan"==n.sdpSemantics||(n.sdpSemantics,!1)}catch(e){t=!1}}catch(e){t=!1}return t}()}()||"Safari"!==DetectRTC.browser.name&&("VP8"===j.codecs.video.toUpperCase()&&(e=E.preferCodec(e,"vp8")),"VP9"===j.codecs.video.toUpperCase()&&(e=E.preferCodec(e,"vp9")),"H264"===j.codecs.video.toUpperCase()&&(e=E.preferCodec(e,"h264")),"G722"===j.codecs.audio&&(e=E.removeNonG722(e)),"Firefox"!==DetectRTC.browser.name&&((j.bandwidth.video||j.bandwidth.screen)&&(e=E.setApplicationSpecificBandwidth(e,j.bandwidth,!!j.session.screen)),j.bandwidth.video&&(e=E.setVideoBitrates(e,{min:8*j.bandwidth.video*1024,max:8*j.bandwidth.video*1024})),j.bandwidth.audio&&(e=E.setOpusAttributes(e,{maxaveragebitrate:8*j.bandwidth.audio*1024,maxplaybackrate:8*j.bandwidth.audio*1024,stereo:1,maxptime:3})))),e},void 0!==E&&(j.BandwidthHandler=j.CodecsHandler=E),j.mediaConstraints={audio:{mandatory:{},optional:j.bandwidth.audio?[{bandwidth:8*j.bandwidth.audio*1024||1048576}]:[]},video:{mandatory:{},optional:j.bandwidth.video?[{bandwidth:8*j.bandwidth.video*1024||1048576},{facingMode:"user"}]:[{facingMode:"user"}]}},"Firefox"===DetectRTC.browser.name&&(j.mediaConstraints={audio:!0,video:!0}),D.useDefaultDevices||DetectRTC.isMobileDevice||DetectRTC.load(function(){var t,n;if(DetectRTC.MediaDevices.forEach(function(e){"audioinput"===e.kind&&!1!==j.mediaConstraints.audio&&(t=e),"videoinput"===e.kind&&!1!==j.mediaConstraints.video&&(n=e)}),t){if("Firefox"===DetectRTC.browser.name)return void(!0!==j.mediaConstraints.audio?j.mediaConstraints.audio.deviceId=t.id:j.mediaConstraints.audio={deviceId:t.id});1==j.mediaConstraints.audio&&(j.mediaConstraints.audio={mandatory:{},optional:[]}),j.mediaConstraints.audio.optional||(j.mediaConstraints.audio.optional=[]);var e=[{sourceId:t.id}];j.mediaConstraints.audio.optional=e.concat(j.mediaConstraints.audio.optional)}n&&("Firefox"===DetectRTC.browser.name?!0!==j.mediaConstraints.video?j.mediaConstraints.video.deviceId=n.id:j.mediaConstraints.video={deviceId:n.id}:(1==j.mediaConstraints.video&&(j.mediaConstraints.video={mandatory:{},optional:[]}),j.mediaConstraints.video.optional||(j.mediaConstraints.video.optional=[]),e=[{sourceId:n.id}],j.mediaConstraints.video.optional=e.concat(j.mediaConstraints.video.optional)))}),j.sdpConstraints={mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0},optional:[{VoiceActivityDetection:!1}]},j.sdpSemantics=null,j.iceCandidatePoolSize=null,j.bundlePolicy=null,j.rtcpMuxPolicy=null,j.iceTransportPolicy=null,j.optionalArgument={optional:[{DtlsSrtpKeyAgreement:!0},{googImprovedWifiBwe:!0},{googScreencastMinBitrate:300},{googIPv6:!0},{googDscp:!0},{googCpuUnderuseThreshold:55},{googCpuOveruseThreshold:85},{googSuspendBelowMinBitrate:!0},{googCpuOveruseDetection:!0}],mandatory:{}},j.iceServers=l(j),j.candidates={host:!0,stun:!0,turn:!0},j.iceProtocols={tcp:!0,udp:!0},j.onopen=function(e){j.enableLogs&&console.info("Data connection has been opened between you & ",e.userid)},j.onclose=function(e){j.enableLogs&&console.warn("Data connection has been closed between you & ",e.userid)},j.onerror=function(e){j.enableLogs&&console.error(e.userid,"data-error",e)},j.onmessage=function(e){j.enableLogs&&console.debug("data-message",e.userid,e.data)},j.send=function(e,t){j.peers.send(e,t)},j.close=j.disconnect=j.leave=function(){j.onbeforeunload(!1,!0)},j.closeEntireSession=function(t){t=t||function(){},j.socket.emit("close-entire-session",function e(){j.getAllParticipants().length?setTimeout(e,100):(j.onEntireSessionClosed({sessionid:j.sessionid,userid:j.userid,extra:j.extra}),j.changeUserId(null,function(){j.close(),t()}))})},j.onEntireSessionClosed=function(e){j.enableLogs&&console.info("Entire session is closed: ",e.sessionid,e.extra)},j.onstream=function(e){var t=j.videosContainer,t=(t.insertBefore(e.mediaElement,t.firstChild),e.mediaElement.play());void 0===t?setTimeout(function(){e.mediaElement.play()},2e3):t.catch(function(){}).then(function(){setTimeout(function(){e.mediaElement.play()},2e3)})},j.onstreamended=function(e){e.mediaElement||(e.mediaElement=document.getElementById(e.streamid)),e.mediaElement&&e.mediaElement.parentNode&&e.mediaElement.parentNode.removeChild(e.mediaElement)},j.direction="many-to-many",j.removeStream=function(t,n){var o;j.attachStreams.forEach(function(e){e.id===t&&(o=e)}),o?(j.peers.getAllParticipants().forEach(function(e){if(!n||e===n){e=j.peers[e];try{e.peer.removeStream(o)}catch(e){}}}),j.renegotiate()):console.warn("No such stream exist.",t)},j.addStream=function(n,t){if(n.getTracks)return-1===j.attachStreams.indexOf(n)&&(n.streamid||(n.streamid=n.id),j.attachStreams.push(n)),void j.renegotiate(t);function o(e){n.streamCallback&&n.streamCallback(e),j.renegotiate(t)}c(n)?j.renegotiate(t):(n.audio||n.video||n.screen)&&(n.screen?"Edge"===DetectRTC.browser.name?navigator.getDisplayMedia({video:!0,audio:x(j)}).then(function(e){e.isScreen=!0,P.onGettingLocalMedia(e),!n.audio&&!n.video||x(j)?o(e):j.invokeGetUserMedia(null,function(e){o(e)})},function(e){console.error("Unable to capture screen on Edge. HTTPs and version 17+ is required.")}):j.getScreenConstraints(function(e,t){if(e)return"PermissionDeniedError"===e?(n.streamCallback&&n.streamCallback(null),void(j.enableLogs&&console.error("User rejected to share his screen."))):alert(e);j.invokeGetUserMedia({audio:!!x(j)&&le(t),video:t,isScreen:!0},function(e){!n.audio&&!n.video||x(j)?o(e):j.invokeGetUserMedia(null,function(e){o(e)})})}):(n.audio||n.video)&&j.invokeGetUserMedia(null,o))},j.invokeGetUserMedia=function(n,o,e){e=e||j.session,we({onGettingLocalMedia:function(e){var t=n.video;t&&(t.mediaSource||t.mozMediaSource||t.mandatory&&t.mandatory.chromeMediaSource)&&(e.isScreen=!0),e.isScreen||(e.isVideo=!!_(e,"video").length,e.isAudio=!e.isVideo&&_(e,"audio").length),P.onGettingLocalMedia(e,function(){"function"==typeof o&&o(e)})},onLocalMediaError:function(e,t){P.onLocalMediaError(e,t)},localMediaConstraints:(n=n||j.mediaConstraints)||{audio:!!e.audio&&n.audio,video:!!e.video&&n.video}})},j.applyConstraints=function(t,e){var n;C&&C.prototype.applyConstraints?e?Pe(n=j.streamEvents[e]?j.streamEvents[e].stream:n,t):j.attachStreams.forEach(function(e){Pe(e,t)}):alert("track.applyConstraints is NOT supported in your browser.")},j.replaceTrack=function(n,t,o){if(n=n||{},T.prototype.getSenders)if(n instanceof C)Ne(n,t,o);else{if(n instanceof w)return _(n,"video").length&&Ne(_(n,"video")[0],t,!0),void(_(n,"audio").length&&Ne(_(n,"audio")[0],t,!1));if(c(n))throw"connection.replaceTrack requires audio and/or video and/or screen.";(n.audio||n.video||n.screen)&&(n.screen?"Edge"===DetectRTC.browser.name?navigator.getDisplayMedia({video:!0,audio:x(j)}).then(function(e){e.isScreen=!0,P.onGettingLocalMedia(e),!n.audio&&!n.video||x(j)?a(e):j.invokeGetUserMedia(null,a)},function(e){console.error("Unable to capture screen on Edge. HTTPs and version 17+ is required.")}):j.getScreenConstraints(function(e,t){if(e)return alert(e);j.invokeGetUserMedia({audio:!!x(j)&&le(t),video:t,isScreen:!0},!n.audio&&!n.video||x(j)?a:j.invokeGetUserMedia(null,a))}):(n.audio||n.video)&&j.invokeGetUserMedia(null,a))}else j.addStream(n);function a(e){j.replaceTrack(e,t,o||n.video||n.screen)}},j.resetTrack=function(e,n){(e="string"==typeof(e=e||j.getAllParticipants())?[e]:e).forEach(function(e){var t=j.peers[e].peer;void 0!==n&&!0!==n||!t.lastVideoTrack||j.replaceTrack(t.lastVideoTrack,e,!0),void 0!==n&&!1!==n||!t.lastAudioTrack||j.replaceTrack(t.lastAudioTrack,e,!1)})},j.renegotiate=function(e){e?P.renegotiatePeer(e):j.peers.getAllParticipants().forEach(function(e){P.renegotiatePeer(e)})},j.setStreamEndHandler=function(o,a){var e;o&&o.addEventListener&&(a=!!a,!o.alreadySetEndHandler)&&(o.alreadySetEndHandler=!0,e="ended","oninactive"in o&&(e="inactive"),o.addEventListener(e,function(){o.idInstance&¤tUserMediaRequest.remove(o.idInstance),a||(t=[],j.attachStreams.forEach(function(e){e.id!=o.id&&t.push(e)}),j.attachStreams=t);var e,t,n=(n=j.streamEvents[o.streamid])||{stream:o,streamid:o.streamid,type:a?"remote":"local",userid:j.userid,extra:j.extra,mediaElement:j.streamEvents[o.streamid]?j.streamEvents[o.streamid].mediaElement:null};a&&j.peers[n.userid]&&(e=j.peers[n.userid].peer,t=[],e.getRemoteStreams().forEach(function(e){e.id!=o.id&&t.push(e)}),j.peers[n.userid].streams=t),n.userid===j.userid&&"remote"===n.type||(j.peersBackup[n.userid]&&(n.extra=j.peersBackup[n.userid].extra),j.onstreamended(n),delete j.streamEvents[o.streamid])},!1))},j.onMediaError=function(e,t){j.enableLogs&&console.error(e,t)},j.autoCloseEntireSession=!1,j.filesContainer=j.videosContainer=document.body||document.documentElement,j.isInitiator=!1,j.shareFile=P.shareFile,i.handle(j),t.handle(j),j.token=f,j.onNewParticipant=function(e,t){j.acceptParticipationRequest(e,t)},j.acceptParticipationRequest=function(e,t){t.successCallback&&(t.successCallback(),delete t.successCallback),P.createNewPeer(e,t)},void 0!==k&&(j.StreamsHandler=k),j.onleave=function(e){},j.invokeSelectFileDialog=function(e){var t=new Ue;t.accept="*.*",t.selectSingleFile(e)},j.onmute=function(e){var t;e&&e.mediaElement&&("both"===e.muteType||"video"===e.muteType?(e.mediaElement.src=null,void 0!==(t=e.mediaElement.pause())?t.then(function(){e.mediaElement.poster=e.snapshot||"https://cdn.webrtc-experiment.com/images/muted.png"}):e.mediaElement.poster=e.snapshot||"https://cdn.webrtc-experiment.com/images/muted.png"):"audio"===e.muteType&&(e.mediaElement.muted=!0))},j.onunmute=function(e){e&&e.mediaElement&&e.stream&&("both"===e.unmuteType||"video"===e.unmuteType?(e.mediaElement.poster=null,e.mediaElement.srcObject=e.stream,e.mediaElement.play()):"audio"===e.unmuteType&&(e.mediaElement.muted=!1))},j.onExtraDataUpdated=function(e){e.status="online",j.onUserStatusChanged(e,!0)},j.getAllParticipants=function(e){return j.peers.getAllParticipants(e)},void 0!==k&&(k.onSyncNeeded=function(t,n,o){j.peers.getAllParticipants().forEach(function(e){P.onNegotiationNeeded({streamid:t,action:n,streamSyncNeeded:!0,type:o||"both"},e)})}),j.connectSocket=function(e){I(e)},j.closeSocket=function(){try{De.a.sockets={}}catch(e){}j.socket&&("function"==typeof j.socket.disconnect&&j.socket.disconnect(),"function"==typeof j.socket.resetProps&&j.socket.resetProps(),j.socket=null)},j.getSocket=function(e){return!e&&j.enableLogs&&console.warn("getSocket.callback paramter is required."),e=e||function(){},j.socket?e(j.socket):I(function(){e(j.socket)}),j.socket},j.getRemoteStreams=P.getRemoteStreams,Ae=["selectFirst","selectAll","forEach"],j.streamEvents={selectFirst:function(e){return j.streamEvents.selectAll(e)[0]},selectAll:function(n){"video"==(n="audio"==(n="screen"==(n="remote"==(n="local"==(n=n||{local:!0,remote:!0,isScreen:!0,isAudio:!0,isVideo:!0})?{local:!0}:n)?{remote:!0}:n)?{isScreen:!0}:n)?{isAudio:!0}:n)&&(n={isVideo:!0});var o=[];return Object.keys(j.streamEvents).forEach(function(e){var t=j.streamEvents[e];-1===Ae.indexOf(e)&&(e=!0,n.local&&"local"===t.type&&(e=!1),n.remote&&"remote"===t.type&&(e=!1),n.isScreen&&t.stream.isScreen&&(e=!1),n.isVideo&&t.stream.isVideo&&(e=!1),n.isAudio&&t.stream.isAudio&&(e=!1),!1===(e=n.userid&&t.userid===n.userid?!1:e)&&o.push(t))}),o}},j.socketURL="/",j.socketMessageEvent="RTCMultiConnection-Message",j.socketCustomEvent="RTCMultiConnection-Custom-Message",j.DetectRTC=DetectRTC,j.setCustomSocketEvent=function(e){e&&(j.socketCustomEvent=e),j.socket&&j.socket.emit("set-custom-socket-event-listener",j.socketCustomEvent)},j.getNumberOfBroadcastViewers=function(e,t){j.socket&&e&&t&&j.socket.emit("get-number-of-users-in-specific-broadcast",e,t)},j.onNumberOfBroadcastViewersUpdated=function(e){j.enableLogs&&j.isInitiator&&console.info("Number of broadcast (",e.broadcastId,") viewers",e.numberOfBroadcastViewers)},j.onUserStatusChanged=function(e,t){j.enableLogs&&!t&&console.info(e.userid,e.status)},j.getUserMediaHandler=we,j.multiPeersHandler=P,j.enableLogs=!0,j.setCustomSocketHandler=function(e){void 0!==n&&(n=e)},j.chunkSize=4e4,j.maxParticipantsAllowed=1e3,j.disconnectWith=P.disconnectWith,j.checkPresence=function(e,o){e=e||j.sessionid,"SSEConnection"!==n.name?j.socket?j.socket.emit("check-presence",e+"",function(e,t,n){j.enableLogs&&console.log("checkPresence.isRoomExist: ",e," roomid: ",t),o(e,t,n)}):j.connectSocket(function(){j.checkPresence(e,o)}):SSEConnection.checkPresence(e,function(e,t,n){if(!j.socket)return e||(j.userid=t),void j.connectSocket(function(){o(e,t,n)});o(e,t)})},j.onReadyForOffer=function(e,t){j.multiPeersHandler.createNewPeer(e,t)},j.setUserPreferences=function(e){return j.dontAttachStream&&(e.dontAttachLocalStream=!0),j.dontGetRemoteStream&&(e.dontGetRemoteStream=!0),e},j.updateExtraData=function(){j.socket.emit("extra-data-updated",j.extra)},j.enableScalableBroadcast=!1,j.maxRelayLimitPerUser=3,j.dontCaptureUserMedia=!1,j.dontAttachStream=!1,j.dontGetRemoteStream=!1,j.onReConnecting=function(e){j.enableLogs&&console.info("ReConnecting with",e.userid,"...")},j.beforeAddingStream=function(e){return e},j.beforeRemovingStream=function(e){return e},j.checkIfChromeExtensionAvailable=_e,"undefined"!=typeof isFirefoxExtensionAvailable&&(j.checkIfChromeExtensionAvailable=isFirefoxExtensionAvailable),j.getChromeExtensionStatus=Se,j.getScreenConstraints=function(n,e){x(j,e)&&(e=!0);var o,a=function(e,t){e||(t=j.modifyScreenConstraints(t),n(e,t))};Te?a(null,{mozMediaSource:"window",mediaSource:"window"}):(o={mandatory:{chromeMediaSource:R,maxWidth:1920
'+h.localization("Room Name")+" | \n"+h.localization("Players")+' | \n\n |
\n | \n | \n |
'+h.localization("Player")+" | \n"+h.localization("Name")+" | \n\n |
1 | \n"+h.localization("Name")+" 1 | \n\n |
2 | \n"+h.localization("Name")+" 2 | \n\n |
3 | \n"+h.localization("Name")+" 3 | \n\n |
4 | \n"+h.localization("Name")+' 4 | \n\n |
\s*$/g;function Ne(e,t){return c(e,"table")&&c(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function Ie(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Le(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function De(e,t){var n,o,a,i;if(1===t.nodeType){if(w.hasData(e)&&(i=w.get(e).events))for(a in w.remove(t,"handle events"),i)for(n=0,o=i[a].length;n").append(S.parseHTML(e)).find(o):e)}).always(n&&function(e,t){r.each(function(){n.apply(this,i||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var o,a,i,r,s=S.css(e,"position"),c=S(e),l={};"static"===s&&(e.style.position="relative"),i=c.offset(),o=S.css(e,"top"),r=S.css(e,"left"),s=("absolute"===s||"fixed"===s)&&-1<(o+r).indexOf("auto")?(a=(s=c.position()).top,s.left):(a=parseFloat(o)||0,parseFloat(r)||0),null!=(t=y(t)?t.call(e,n,S.extend({},i)):t).top&&(l.top=t.top-i.top+a),null!=t.left&&(l.left=t.left-i.left+s),"using"in t?t.using.call(e,l):c.css(l)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n=this[0];return n?n.getClientRects().length?(e=n.getBoundingClientRect(),n=n.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,o=this[0],a={top:0,left:0};if("fixed"===S.css(o,"position"))t=o.getBoundingClientRect();else{for(t=this.offset(),n=o.ownerDocument,e=o.offsetParent||n.documentElement;e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position");)e=e.parentNode;e&&e!==o&&1===e.nodeType&&((a=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),a.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-a.top-S.css(o,"marginTop",!0),left:t.left-a.left-S.css(o,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent;e&&"static"===S.css(e,"position");)e=e.offsetParent;return e||x})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,a){var i="pageYOffset"===a;S.fn[t]=function(e){return u(this,function(e,t,n){var o;if(m(e)?o=e:9===e.nodeType&&(o=e.defaultView),void 0===n)return o?o[a]:e[t];o?o.scrollTo(i?o.pageXOffset:n,i?n:o.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=$e(g.pixelPosition,function(e,t){if(t)return t=Ke(e,n),Ye.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(r,s){S.each({padding:"inner"+r,content:s,"":"outer"+r},function(o,i){S.fn[i]=function(e,t){var n=arguments.length&&(o||"boolean"!=typeof e),a=o||(!0===e||!0===t?"margin":"border");return u(this,function(e,t,n){var o;return m(e)?0===i.indexOf("outer")?e["inner"+r]:e.document.documentElement["client"+r]:9===e.nodeType?(o=e.documentElement,Math.max(e.body["scroll"+r],o["scroll"+r],e.body["offset"+r],o["offset"+r],o["client"+r])):void 0===n?S.css(e,t,a):S.style(e,t,n,a)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,o){return this.on(t,e,n,o)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0