Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simplewebrtc

Package Overview
Dependencies
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simplewebrtc - npm Package Compare versions

Comparing version 0.8.2 to 0.8.3

2

latest.js

@@ -1,2 +0,2 @@

!function(t){if("function"==typeof bootstrap)bootstrap("simplewebrtc",t);else if("object"==typeof exports)module.exports=t();else if("function"==typeof define&&define.amd)define(t);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeSimpleWebRTC=t}else"undefined"!=typeof window?window.SimpleWebRTC=t():global.SimpleWebRTC=t()}(function(){return function(t,e,o){function n(o,r){if(!e[o]){if(!t[o]){var s="function"==typeof require&&require;if(!r&&s)return s(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var a=e[o]={exports:{}};t[o][0].call(a.exports,function(e){var i=t[o][1][e];return n(i?i:e)},a,a.exports)}return e[o].exports}for(var i="function"==typeof require&&require,r=0;r<o.length;r++)n(o[r]);return n}({1:[function(t,e){function o(t){var e,o,s=this,a=t||{},p=this.config={url:"http://signaling.simplewebrtc.com:8888",debug:!1,localVideoEl:"",remoteVideosEl:"",autoRequestMedia:!1,autoRemoveVideos:!0,adjustPeerVolume:!0,peerVolumeWhenSpeaking:.25};this.logger=function(){return t.debug?t.logger||console:t.logger||c}();for(e in a)this.config[e]=a[e];this.capabilities=r,i.call(this),o=this.connection=io.connect(this.config.url),o.on("connect",function(){s.emit("connectionReady",o.socket.sessionid),s.sessionReady=!0,s.testReadiness()}),o.on("message",function(t){var e,o=s.webrtc.getPeers(t.from,t.roomType);"offer"===t.type?(e=s.webrtc.createPeer({id:t.from,type:t.roomType,sharemyscreen:"screen"===t.roomType&&!t.broadcaster}),e.handleMessage(t)):o.length&&o.forEach(function(e){e.handleMessage(t)})}),o.on("remove",function(t){t.id!==s.connection.socket.sessionid&&s.webrtc.removePeers(t.id,t.type)}),t.logger=this.logger,t.debug=!1,this.webrtc=new n(t),["mute","unmute","pause","resume"].forEach(function(t){s[t]=s.webrtc[t].bind(s.webrtc)}),this.webrtc.on("*",function(){s.emit.apply(s,arguments)}),p.debug&&this.on("*",this.logger.log.bind(this.logger,"SimpleWebRTC event:")),this.webrtc.on("localStream",function(){s.testReadiness()}),this.webrtc.on("message",function(t){s.connection.emit("message",t)}),this.webrtc.on("peerStreamAdded",this.handlePeerStreamAdded.bind(this)),this.webrtc.on("peerStreamRemoved",this.handlePeerStreamRemoved.bind(this)),this.config.adjustPeerVolume&&(this.webrtc.on("speaking",this.setVolumeForAll.bind(this,this.config.peerVolumeWhenSpeaking)),this.webrtc.on("stoppedSpeaking",this.setVolumeForAll.bind(this,1))),this.config.autoRequestMedia&&this.startLocalVideo()}var n=t("webrtc"),i=t("wildemitter"),r=t("webrtcsupport"),s=t("attachmediastream"),a=t("getscreenmedia"),c=t("mockconsole");o.prototype=Object.create(i.prototype,{constructor:{value:o}}),o.prototype.leaveRoom=function(){this.roomName&&(this.connection.emit("leave",this.roomName),this.webrtc.peers.forEach(function(t){t.end()}),this.getLocalScreen()&&this.stopScreenShare(),this.emit("leftRoom",this.roomName))},o.prototype.handlePeerStreamAdded=function(t){var e=this.getRemoteVideoContainer(),o=s(t.stream);t.videoEl=o,o.id=this.getDomId(t),e&&e.appendChild(o),this.emit("videoAdded",o,t)},o.prototype.handlePeerStreamRemoved=function(t){var e=this.getRemoteVideoContainer(),o=t.videoEl;this.config.autoRemoveVideos&&e&&o&&e.removeChild(o),o&&this.emit("videoRemoved",o,t)},o.prototype.getDomId=function(t){return[t.id,t.type,t.broadcaster?"broadcasting":"incoming"].join("_")},o.prototype.setVolumeForAll=function(t){this.webrtc.peers.forEach(function(e){e.videoEl&&(e.videoEl.volume=t)})},o.prototype.joinRoom=function(t,e){var o=this;this.roomName=t,this.connection.emit("join",t,function(n,i){if(n)o.emit("error",n);else{var r,s,a,c;for(r in i.clients){s=i.clients[r];for(a in s)s[a]&&(c=o.webrtc.createPeer({id:r,type:a}),c.start())}}e&&e(n,i),o.emit("joinedRoom",t)})},o.prototype.getEl=function(t){return"string"==typeof t?document.getElementById(t):t},o.prototype.startLocalVideo=function(){var t=this;this.webrtc.startLocalMedia(null,function(e,o){e?t.emit(e):s(o,t.getLocalVideoContainer(),{muted:!0,mirror:!0})})},o.prototype.stopLocalVideo=function(){this.webrtc.stopLocalMedia()},o.prototype.getLocalVideoContainer=function(){var t=this.getEl(this.config.localVideoEl);if(t&&"VIDEO"===t.tagName)return t;if(t){var e=document.createElement("video");return t.appendChild(e),e}},o.prototype.getRemoteVideoContainer=function(){return this.getEl(this.config.remoteVideosEl)},o.prototype.shareScreen=function(t){var e=this;a(function(o,n){var i=document.createElement("video"),r=e.getRemoteVideoContainer();o?e.emit(o):(e.webrtc.localScreen=n,i.id="localScreen",s(n,i),r&&r.appendChild(i),e.emit("localScreenAdded",i),e.connection.emit("shareScreen"),e.webrtc.peers.forEach(function(t){var o;"video"===t.type&&(o=e.webrtc.createPeer({id:t.id,type:"screen",sharemyscreen:!0,broadcaster:e.connection.socket.sessionid}),o.start())})),t&&t(o,n)})},o.prototype.getLocalScreen=function(){return this.webrtc.localScreen},o.prototype.stopScreenShare=function(){this.connection.emit("unshareScreen");var t=document.getElementById("localScreen"),e=this.getRemoteVideoContainer(),o=this.getLocalScreen();this.config.autoRemoveVideos&&e&&t&&e.removeChild(t),t&&this.emit("videoRemoved",t),o&&o.stop(),this.webrtc.peers.forEach(function(t){t.broadcaster&&t.end()}),delete this.webrtc.localScreen},o.prototype.testReadiness=function(){var t=this;this.webrtc.localStream&&this.sessionReady&&setTimeout(function(){t.emit("readyToCall",t.connection.socket.sessionid)},1e3)},o.prototype.createRoom=function(t,e){2===arguments.length?this.connection.emit("create",t,e):this.connection.emit("create",t)},e.exports=o},{attachmediastream:5,getscreenmedia:6,mockconsole:7,webrtc:2,webrtcsupport:4,wildemitter:3}],3:[function(t,e){function o(){this.callbacks={}}e.exports=o,o.prototype.on=function(t){var e=3===arguments.length,o=e?arguments[1]:void 0,n=e?arguments[2]:arguments[1];return n._groupName=o,(this.callbacks[t]=this.callbacks[t]||[]).push(n),this},o.prototype.once=function(t){function e(){o.off(t,e),r.apply(this,arguments)}var o=this,n=3===arguments.length,i=n?arguments[1]:void 0,r=n?arguments[2]:arguments[1];return this.on(t,i,e),this},o.prototype.releaseGroup=function(t){var e,o,n,i;for(e in this.callbacks)for(i=this.callbacks[e],o=0,n=i.length;n>o;o++)i[o]._groupName===t&&(i.splice(o,1),o--,n--);return this},o.prototype.off=function(t,e){var o,n=this.callbacks[t];return n?1===arguments.length?(delete this.callbacks[t],this):(o=n.indexOf(e),n.splice(o,1),this):this},o.prototype.emit=function(t){var e,o,n=[].slice.call(arguments,1),i=this.callbacks[t],r=this.getWildcardCallbacks(t);if(i)for(e=0,o=i.length;o>e&&i[e];++e)i[e].apply(this,n);if(r)for(e=0,o=r.length;o>e&&r[e];++e)r[e].apply(this,[t].concat(n));return this},o.prototype.getWildcardCallbacks=function(t){var e,o,n=[];for(e in this.callbacks)o=e.split("*"),("*"===e||2===o.length&&t.slice(0,o[1].length)===o[1])&&(n=n.concat(this.callbacks[e]));return n}},{}],4:[function(t,e){var o=window.mozRTCPeerConnection||window.webkitRTCPeerConnection||window.RTCPeerConnection,n=window.mozRTCIceCandidate||window.RTCIceCandidate,i=window.mozRTCSessionDescription||window.RTCSessionDescription,r=function(){return window.mozRTCPeerConnection?"moz":window.webkitRTCPeerConnection?"webkit":void 0}(),s=window.webkitMediaStream||window.MediaStream,a=navigator.userAgent.match("Chrome")&&parseInt(navigator.userAgent.match(/Chrome\/(.*) /)[1],10)>=26,c=window.webkitAudioContext||window.AudioContext;e.exports={support:!!o,dataChannel:!!(o&&o.prototype&&o.prototype.createDataChannel),prefix:r,webAudio:!(!c||!c.prototype.createMediaStreamSource),mediaStream:!(!s||!s.prototype.removeTrack),screenSharing:a,AudioContext:c,PeerConnection:o,SessionDescription:i,IceCandidate:n}},{}],5:[function(t,e){e.exports=function(t,e,o){var n,i=window.URL,r={autoplay:!0,mirror:!1,muted:!1},s=e||document.createElement("video");if(o)for(n in o)r[n]=o[n];if(r.autoplay&&(s.autoplay="autoplay"),r.muted&&(s.muted=!0),r.mirror&&["","moz","webkit","o","ms"].forEach(function(t){var e=t?t+"Transform":"transform";s.style[e]="scaleX(-1)"}),i&&i.createObjectURL)s.src=i.createObjectURL(t);else if(s.srcObject)s.srcObject=t;else{if(!s.mozSrcObject)return!1;s.mozSrcObject=t}return s}},{}],7:[function(t,e){for(var o="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),n=o.length,i=function(){},r={};n--;)r[o[n]]=i;e.exports=r},{}],6:[function(t,e){var o=t("getusermedia");e.exports=function(t){var e,n={video:{mandatory:{chromeMediaSource:"screen"}}};return"http:"===window.location.protocol?(e=new Error("NavigatorUserMediaError"),e.name="HTTPS_REQUIRED",t(e)):(o(n,t),void 0)}},{getusermedia:8}],9:[function(t,e){var o=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;e.exports=function(t,e){var n,i=2===arguments.length,r={video:!0,audio:!0},s="PERMISSION_DENIED",a="CONSTRAINT_NOT_SATISFIED";return i||(e=t,t=r),o?(o.call(navigator,t,function(t){e(null,t)},function(t){var o;"string"==typeof t?(o=new Error("NavigatorUserMediaError"),o.name=t===s?s:a):(o=t,o.name||(t.name=o[s]?s:a)),e(o)}),void 0):(n=new Error("NavigatorUserMediaError"),n.name="NOT_SUPPORTED_ERROR",e(n))}},{}],8:[function(t,e){var o=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;e.exports=function(t,e){var n,i=2===arguments.length,r={video:!0,audio:!0},s="PERMISSION_DENIED",a="CONSTRAINT_NOT_SATISFIED";return i||(e=t,t=r),o?(o.call(navigator,t,function(t){e(null,t)},function(t){var o;"string"==typeof t?(o=new Error("NavigatorUserMediaError"),o.name=t===s?s:a):(o=t,o.name||(t.name=o[s]?s:a)),e(o)}),void 0):(n=new Error("NavigatorUserMediaError"),n.name="NOT_SUPPORTED_ERROR",e(n))}},{}],2:[function(t,e){function o(t){var e=this,o=t||{};this.config={debug:!1,localVideoEl:"",remoteVideosEl:"",autoRequestMedia:!1,peerConnectionConfig:{iceServers:[{url:"stun:stun.l.google.com:19302"}]},peerConnectionContraints:{optional:[{DtlsSrtpKeyAgreement:!0},{RtpDataChannels:!0}]},autoAdjustMic:!1,media:{audio:!0,video:!0}};var n;this.screenSharingSupport=i.screenSharing,this.logger=function(){return t.debug?t.logger||console:t.logger||u}();for(n in o)this.config[n]=o[n];i.support||this.logger.error("Your browser doesn't seem to support WebRTC"),this.peers=[],a.call(this),this.config.debug&&this.on("*",function(t,o,n){var i;i=e.config.logger===u?console:e.logger,i.log("event:",t,o,n)})}function n(t){var e=this;this.id=t.id,this.parent=t.parent,this.type=t.type||"video",this.oneway=t.oneway||!1,this.sharemyscreen=t.sharemyscreen||!1,this.browserPrefix=t.prefix,this.stream=t.stream,this.pc=new s(this.parent.config.peerConnectionConfig,this.parent.config.peerConnectionContraints),this.pc.on("ice",this.onIceCandidate.bind(this)),this.pc.on("addStream",this.handleRemoteStreamAdded.bind(this)),this.pc.on("removeStream",this.handleStreamRemoved.bind(this)),this.logger=this.parent.logger,"screen"===t.type?this.parent.localScreen&&this.sharemyscreen&&(this.logger.log("adding local screen stream to peer connection"),this.pc.addStream(this.parent.localScreen),this.broadcaster=t.broadcaster):this.pc.addStream(this.parent.localStream),a.call(this),this.on("*",function(t,o){e.parent.emit(t,o,e)})}var i=t("webrtcsupport"),r=t("getusermedia"),s=t("rtcpeerconnection"),a=t("wildemitter"),c=t("hark"),p=t("mediastream-gain"),u=t("mockconsole");o.prototype=Object.create(a.prototype,{constructor:{value:o}}),o.prototype.createPeer=function(t){var e;return t.parent=this,e=new n(t),this.peers.push(e),e},o.prototype.startLocalMedia=function(t,e){var o=this,n=t||{video:!0,audio:!0};r(n,function(t,i){t||(n.audio&&o.setupAudioMonitor(i),o.localStream=i,o.gainController=new p(i),o.setMicIfEnabled(.5),o.emit("localStream",i)),e&&e(t,i)})},o.prototype.stopLocalMedia=function(){this.localStream&&(this.localStream.stop(),this.emit("localStreamStopped"))},o.prototype.mute=function(){this._audioEnabled(!1),this.hardMuted=!0,this.emit("audioOff")},o.prototype.unmute=function(){this._audioEnabled(!0),this.hardMuted=!1,this.emit("audioOn")},o.prototype.setupAudioMonitor=function(t){this.logger.log("Setup audio");var e,o=c(t),n=this;o.on("speaking",function(){n.hardMuted||(n.setMicIfEnabled(1),n.sendToAll("speaking",{}),n.emit("speaking"))}),o.on("stopped_speaking",function(){n.hardMuted||(e&&clearTimeout(e),e=setTimeout(function(){n.setMicIfEnabled(.5),n.sendToAll("stopped_speaking",{}),n.emit("stoppedSpeaking")},1e3))})},o.prototype.setMicIfEnabled=function(t){this.config.autoAdjustMic&&this.gainController.setGain(t)},o.prototype.pauseVideo=function(){this._videoEnabled(!1),this.emit("videoOff")},o.prototype.resumeVideo=function(){this._videoEnabled(!0),this.emit("videoOn")},o.prototype.pause=function(){this._audioEnabled(!1),this.pauseVideo()},o.prototype.resume=function(){this._audioEnabled(!0),this.resumeVideo()},o.prototype._audioEnabled=function(t){this.setMicIfEnabled(t?1:0),this.localStream.getAudioTracks().forEach(function(e){e.enabled=!!t})},o.prototype._videoEnabled=function(t){this.localStream.getVideoTracks().forEach(function(e){e.enabled=!!t})},o.prototype.removePeers=function(t,e){this.getPeers(t,e).forEach(function(t){t.end()})},o.prototype.getPeers=function(t,e){return this.peers.filter(function(o){return!(t&&o.id!==t||e&&o.type!==e)})},o.prototype.sendToAll=function(t,e){this.peers.forEach(function(o){o.send(t,e)})},n.prototype=Object.create(a.prototype,{constructor:{value:n}}),n.prototype.handleMessage=function(t){var e=this;this.logger.log("getting",t.type,t),t.prefix&&(this.browserPrefix=t.prefix),"offer"===t.type?this.pc.answer(t.payload,function(t,o){e.send("answer",o)}):"answer"===t.type?this.pc.handleAnswer(t.payload):"candidate"===t.type?this.pc.processIce(t.payload):"speaking"===t.type?this.parent.emit("speaking",{id:t.from}):"stopped_speaking"===t.type&&this.parent.emit("stopped_speaking",{id:t.from})},n.prototype.send=function(t,e){var o={to:this.id,broadcaster:this.broadcaster,roomType:this.type,type:t,payload:e,prefix:i.prefix};this.logger.log("sending",t,o),this.parent.emit("message",o)},n.prototype.onIceCandidate=function(t){this.closed||(t?this.send("candidate",t):this.logger.log("End of candidates."))},n.prototype.start=function(){var t=this;this.pc.offer(function(e,o){t.send("offer",o)})},n.prototype.end=function(){this.pc.close(),this.handleStreamRemoved()},n.prototype.handleRemoteStreamAdded=function(t){this.stream=t.stream,this.parent.emit("peerStreamAdded",this)},n.prototype.handleStreamRemoved=function(){this.parent.peers.splice(this.parent.peers.indexOf(this),1),this.closed=!0,this.parent.emit("peerStreamRemoved",this)},e.exports=o},{getusermedia:9,hark:12,"mediastream-gain":11,mockconsole:7,rtcpeerconnection:10,webrtcsupport:4,wildemitter:3}],13:[function(t,e){var o=window.mozRTCPeerConnection||window.webkitRTCPeerConnection||window.RTCPeerConnection,n=window.mozRTCIceCandidate||window.RTCIceCandidate,i=window.mozRTCSessionDescription||window.RTCSessionDescription,r=function(){return window.mozRTCPeerConnection?"moz":window.webkitRTCPeerConnection?"webkit":void 0}(),s=navigator.userAgent.match("Chrome")&&parseInt(navigator.userAgent.match(/Chrome\/(.*) /)[1],10)>=26,a=window.webkitAudioContext||window.AudioContext;e.exports={support:!!o,dataChannel:!!(o&&o.prototype&&o.prototype.createDataChannel),prefix:r,webAudio:!(!a||!a.prototype.createMediaStreamSource),screenSharing:s,AudioContext:a,PeerConnection:o,SessionDescription:i,IceCandidate:n}},{}],10:[function(t,e){function o(t,e){this.pc=new i.PeerConnection(t,e),n.call(this),this.pc.onicecandidate=this._onIce.bind(this),this.pc.onaddstream=this._onAddStream.bind(this),this.pc.onremovestream=this._onRemoveStream.bind(this),t.debug&&this.on("*",function(t,e){console.log("PeerConnection event:",t,e)})}var n=t("wildemitter"),i=t("webrtcsupport");o.prototype=Object.create(n.prototype,{constructor:{value:o}}),o.prototype.addStream=function(t){this.localStream=t,this.pc.addStream(t)},o.prototype._onIce=function(t){t.candidate?this.emit("ice",t.candidate):this.emit("endOfCandidates")},o.prototype._onAddStream=function(t){this.emit("addStream",t)},o.prototype._onRemoveStream=function(t){this.emit("removeStream",t)},o.prototype.processIce=function(t){this.pc.addIceCandidate(new i.IceCandidate(t))},o.prototype.offer=function(t,e){var o=this,n=2===arguments.length,i=n?t:{mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}},r=n?e:t;this.pc.createOffer(function(t){o.pc.setLocalDescription(t),o.emit("offer",t),r&&r(null,t)},function(t){o.emit("error",t),r&&r(t)},i)},o.prototype.answerAudioOnly=function(t,e){var o={mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!1}};this._answer(t,o,e)},o.prototype.answerBroadcastOnly=function(t,e){var o={mandatory:{OfferToReceiveAudio:!1,OfferToReceiveVideo:!1}};this._answer(t,o,e)},o.prototype._answer=function(t,e,o){var n=this;this.pc.setRemoteDescription(new i.SessionDescription(t)),this.pc.createAnswer(function(t){n.pc.setLocalDescription(t),n.emit("answer",t),o&&o(null,t)},function(t){n.emit("error",t),o&&o(t)},e)},o.prototype.answer=function(t,e,o){var n=3===arguments.length,i=n?o:e,r=n?e:{mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}};this._answer(t,r,i)},o.prototype.handleAnswer=function(t){this.pc.setRemoteDescription(new i.SessionDescription(t))},o.prototype.close=function(){this.pc.close(),this.emit("close")},e.exports=o},{webrtcsupport:13,wildemitter:3}],11:[function(t,e){function o(t){if(this.support=n.webAudio&&n.mediaStream,this.gain=1,this.support){var e=this.context=new n.AudioContext;this.microphone=e.createMediaStreamSource(t),this.gainFilter=e.createGain(),this.destination=e.createMediaStreamDestination(),this.outputStream=this.destination.stream,this.microphone.connect(this.gainFilter),this.gainFilter.connect(this.destination),t.removeTrack(t.getAudioTracks()[0]),t.addTrack(this.outputStream.getAudioTracks()[0])}this.stream=t}var n=t("webrtcsupport");o.prototype.setGain=function(t){this.support&&(this.gainFilter.gain.value=t,this.gain=t)},o.prototype.getGain=function(){return this.gain},o.prototype.off=function(){return this.setGain(0)},o.prototype.on=function(){this.setGain(1)},e.exports=o},{webrtcsupport:4}],12:[function(t,e){function o(t,e){var o=-1/0;t.getFloatFrequencyData(e);for(var n=0,i=e.length;i>n;n++)e[n]>o&&e[n]<0&&(o=e[n]);return o}var n=t("wildemitter");e.exports=function(t,e){var i=new n;if(!window.webkitAudioContext)return i;var r,s,a,e=e||{},c=e.smoothing||.5,p=e.interval||100,u=e.threshold,h=e.play,d=new webkitAudioContext;a=d.createAnalyser(),a.fftSize=512,a.smoothingTimeConstant=c,s=new Float32Array(a.fftSize),t.jquery&&(t=t[0]),t instanceof HTMLAudioElement?(r=d.createMediaElementSource(t),"undefined"==typeof h&&(h=!0),u=u||-65):(r=d.createMediaStreamSource(t),u=u||-45),r.connect(a),h&&a.connect(d.destination),i.speaking=!1,i.setThreshold=function(t){u=t},i.setInterval=function(t){p=t};var l=function(){setTimeout(function(){var t=o(a,s);i.emit("volume_change",t,u),t>u?i.speaking||(i.speaking=!0,i.emit("speaking")):i.speaking&&(i.speaking=!1,i.emit("stopped_speaking")),l()},p)};return l(),i}},{wildemitter:3}]},{},[1])(1)});var io="undefined"==typeof module?{}:module.exports;!function(){!function(t,e){var o=t;o.version="0.9.11",o.protocol=1,o.transports=[],o.j=[],o.sockets={},o.connect=function(t,n){var i,r,s=o.util.parseUri(t);e&&e.location&&(s.protocol=s.protocol||e.location.protocol.slice(0,-1),s.host=s.host||(e.document?e.document.domain:e.location.hostname),s.port=s.port||e.location.port),i=o.util.uniqueUri(s);var a={host:s.host,secure:"https"==s.protocol,port:s.port||("https"==s.protocol?443:80),query:s.query||""};return o.util.merge(a,n),(a["force new connection"]||!o.sockets[i])&&(r=new o.Socket(a)),!a["force new connection"]&&r&&(o.sockets[i]=r),r=r||o.sockets[i],r.of(s.path.length>1?s.path:"")}}("object"==typeof module?module.exports:this.io={},this),function(t,e){var o=t.util={},n=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,i=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];o.parseUri=function(t){for(var e=n.exec(t||""),o={},r=14;r--;)o[i[r]]=e[r]||"";return o},o.uniqueUri=function(t){var o=t.protocol,n=t.host,i=t.port;return"document"in e?(n=n||document.domain,i=i||("https"==o&&"https:"!==document.location.protocol?443:document.location.port)):(n=n||"localhost",i||"https"!=o||(i=443)),(o||"http")+"://"+n+":"+(i||80)},o.query=function(t,e){var n=o.chunkQuery(t||""),i=[];o.merge(n,o.chunkQuery(e||""));for(var r in n)n.hasOwnProperty(r)&&i.push(r+"="+n[r]);return i.length?"?"+i.join("&"):""},o.chunkQuery=function(t){for(var e,o={},n=t.split("&"),i=0,r=n.length;r>i;++i)e=n[i].split("="),e[0]&&(o[e[0]]=e[1]);return o};var r=!1;o.load=function(t){return"document"in e&&"complete"===document.readyState||r?t():(o.on(e,"load",t,!1),void 0)},o.on=function(t,e,o,n){t.attachEvent?t.attachEvent("on"+e,o):t.addEventListener&&t.addEventListener(e,o,n)},o.request=function(t){if(t&&"undefined"!=typeof XDomainRequest&&!o.ua.hasCORS)return new XDomainRequest;if("undefined"!=typeof XMLHttpRequest&&(!t||o.ua.hasCORS))return new XMLHttpRequest;if(!t)try{return new(window[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}return null},"undefined"!=typeof window&&o.load(function(){r=!0}),o.defer=function(t){return o.ua.webkit&&"undefined"==typeof importScripts?(o.load(function(){setTimeout(t,100)}),void 0):t()},o.merge=function(t,e,n,i){var r,s=i||[],a="undefined"==typeof n?2:n;for(r in e)e.hasOwnProperty(r)&&o.indexOf(s,r)<0&&("object"==typeof t[r]&&a?o.merge(t[r],e[r],a-1,s):(t[r]=e[r],s.push(e[r])));return t},o.mixin=function(t,e){o.merge(t.prototype,e.prototype)},o.inherit=function(t,e){function o(){}o.prototype=e.prototype,t.prototype=new o},o.isArray=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},o.intersect=function(t,e){for(var n=[],i=t.length>e.length?t:e,r=t.length>e.length?e:t,s=0,a=r.length;a>s;s++)~o.indexOf(i,r[s])&&n.push(r[s]);return n},o.indexOf=function(t,e,o){for(var n=t.length,o=0>o?0>o+n?0:o+n:o||0;n>o&&t[o]!==e;o++);return o>=n?-1:o},o.toArray=function(t){for(var e=[],o=0,n=t.length;n>o;o++)e.push(t[o]);return e},o.ua={},o.ua.hasCORS="undefined"!=typeof XMLHttpRequest&&function(){try{var t=new XMLHttpRequest}catch(e){return!1}return void 0!=t.withCredentials}(),o.ua.webkit="undefined"!=typeof navigator&&/webkit/i.test(navigator.userAgent),o.ua.iDevice="undefined"!=typeof navigator&&/iPad|iPhone|iPod/i.test(navigator.userAgent)}("undefined"!=typeof io?io:module.exports,this),function(t,e){function o(){}t.EventEmitter=o,o.prototype.on=function(t,o){return this.$events||(this.$events={}),this.$events[t]?e.util.isArray(this.$events[t])?this.$events[t].push(o):this.$events[t]=[this.$events[t],o]:this.$events[t]=o,this},o.prototype.addListener=o.prototype.on,o.prototype.once=function(t,e){function o(){n.removeListener(t,o),e.apply(this,arguments)}var n=this;return o.listener=e,this.on(t,o),this},o.prototype.removeListener=function(t,o){if(this.$events&&this.$events[t]){var n=this.$events[t];if(e.util.isArray(n)){for(var i=-1,r=0,s=n.length;s>r;r++)if(n[r]===o||n[r].listener&&n[r].listener===o){i=r;break}if(0>i)return this;n.splice(i,1),n.length||delete this.$events[t]}else(n===o||n.listener&&n.listener===o)&&delete this.$events[t]}return this},o.prototype.removeAllListeners=function(t){return void 0===t?(this.$events={},this):(this.$events&&this.$events[t]&&(this.$events[t]=null),this)},o.prototype.listeners=function(t){return this.$events||(this.$events={}),this.$events[t]||(this.$events[t]=[]),e.util.isArray(this.$events[t])||(this.$events[t]=[this.$events[t]]),this.$events[t]},o.prototype.emit=function(t){if(!this.$events)return!1;var o=this.$events[t];if(!o)return!1;var n=Array.prototype.slice.call(arguments,1);if("function"==typeof o)o.apply(this,n);else{if(!e.util.isArray(o))return!1;for(var i=o.slice(),r=0,s=i.length;s>r;r++)i[r].apply(this,n)}return!0}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports),function(exports,nativeJSON){"use strict";function f(t){return 10>t?"0"+t:t}function date(t){return isFinite(t.valueOf())?t.getUTCFullYear()+"-"+f(t.getUTCMonth()+1)+"-"+f(t.getUTCDate())+"T"+f(t.getUTCHours())+":"+f(t.getUTCMinutes())+":"+f(t.getUTCSeconds())+"Z":null}function quote(t){return escapable.lastIndex=0,escapable.test(t)?'"'+t.replace(escapable,function(t){var e=meta[t];return"string"==typeof e?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}function str(t,e){var o,n,i,r,s,a=gap,c=e[t];switch(c instanceof Date&&(c=date(t)),"function"==typeof rep&&(c=rep.call(e,t,c)),typeof c){case"string":return quote(c);case"number":return isFinite(c)?String(c):"null";case"boolean":case"null":return String(c);case"object":if(!c)return"null";if(gap+=indent,s=[],"[object Array]"===Object.prototype.toString.apply(c)){for(r=c.length,o=0;r>o;o+=1)s[o]=str(o,c)||"null";return i=0===s.length?"[]":gap?"[\n"+gap+s.join(",\n"+gap)+"\n"+a+"]":"["+s.join(",")+"]",gap=a,i}if(rep&&"object"==typeof rep)for(r=rep.length,o=0;r>o;o+=1)"string"==typeof rep[o]&&(n=rep[o],i=str(n,c),i&&s.push(quote(n)+(gap?": ":":")+i));else for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(i=str(n,c),i&&s.push(quote(n)+(gap?": ":":")+i));return i=0===s.length?"{}":gap?"{\n"+gap+s.join(",\n"+gap)+"\n"+a+"}":"{"+s.join(",")+"}",gap=a,i}}if(nativeJSON&&nativeJSON.parse)return exports.JSON={parse:nativeJSON.parse,stringify:nativeJSON.stringify};var JSON=exports.JSON={},cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;JSON.stringify=function(t,e,o){var n;if(gap="",indent="","number"==typeof o)for(n=0;o>n;n+=1)indent+=" ";else"string"==typeof o&&(indent=o);if(rep=e,e&&"function"!=typeof e&&("object"!=typeof e||"number"!=typeof e.length))throw new Error("JSON.stringify");return str("",{"":t})},JSON.parse=function(text,reviver){function walk(t,e){var o,n,i=t[e];if(i&&"object"==typeof i)for(o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n=walk(i,o),void 0!==n?i[o]=n:delete i[o]);return reviver.call(t,e,i)}var j;if(text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(t){return"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof JSON?JSON:void 0),function(t,e){var o=t.parser={},n=o.packets=["disconnect","connect","heartbeat","message","json","event","ack","error","noop"],i=o.reasons=["transport not supported","client not handshaken","unauthorized"],r=o.advice=["reconnect"],s=e.JSON,a=e.util.indexOf;o.encodePacket=function(t){var e=a(n,t.type),o=t.id||"",c=t.endpoint||"",p=t.ack,u=null;switch(t.type){case"error":var h=t.reason?a(i,t.reason):"",d=t.advice?a(r,t.advice):"";(""!==h||""!==d)&&(u=h+(""!==d?"+"+d:""));break;case"message":""!==t.data&&(u=t.data);break;case"event":var l={name:t.name};t.args&&t.args.length&&(l.args=t.args),u=s.stringify(l);break;case"json":u=s.stringify(t.data);break;case"connect":t.qs&&(u=t.qs);break;case"ack":u=t.ackId+(t.args&&t.args.length?"+"+s.stringify(t.args):"")}var f=[e,o+("data"==p?"+":""),c];return null!==u&&void 0!==u&&f.push(u),f.join(":")},o.encodePayload=function(t){var e="";if(1==t.length)return t[0];for(var o=0,n=t.length;n>o;o++){var i=t[o];e+="�"+i.length+"�"+t[o]}return e};var c=/([^:]+):([0-9]+)?(\+)?:([^:]+)?:?([\s\S]*)?/;o.decodePacket=function(t){var e=t.match(c);if(!e)return{};var o=e[2]||"",t=e[5]||"",a={type:n[e[1]],endpoint:e[4]||""};switch(o&&(a.id=o,a.ack=e[3]?"data":!0),a.type){case"error":var e=t.split("+");a.reason=i[e[0]]||"",a.advice=r[e[1]]||"";break;case"message":a.data=t||"";break;case"event":try{var p=s.parse(t);a.name=p.name,a.args=p.args}catch(u){}a.args=a.args||[];break;case"json":try{a.data=s.parse(t)}catch(u){}break;case"connect":a.qs=t||"";break;case"ack":var e=t.match(/^([0-9]+)(\+)?(.*)/);if(e&&(a.ackId=e[1],a.args=[],e[3]))try{a.args=e[3]?s.parse(e[3]):[]}catch(u){}break;case"disconnect":case"heartbeat":}return a},o.decodePayload=function(t){if("�"==t.charAt(0)){for(var e=[],n=1,i="";n<t.length;n++)"�"==t.charAt(n)?(e.push(o.decodePacket(t.substr(n+1).substr(0,i))),n+=Number(i)+1,i=""):i+=t.charAt(n);return e}return[o.decodePacket(t)]}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports),function(t,e){function o(t,e){this.socket=t,this.sessid=e}t.Transport=o,e.util.mixin(o,e.EventEmitter),o.prototype.heartbeats=function(){return!0},o.prototype.onData=function(t){if(this.clearCloseTimeout(),(this.socket.connected||this.socket.connecting||this.socket.reconnecting)&&this.setCloseTimeout(),""!==t){var o=e.parser.decodePayload(t);if(o&&o.length)for(var n=0,i=o.length;i>n;n++)this.onPacket(o[n])}return this},o.prototype.onPacket=function(t){return this.socket.setHeartbeatTimeout(),"heartbeat"==t.type?this.onHeartbeat():("connect"==t.type&&""==t.endpoint&&this.onConnect(),"error"==t.type&&"reconnect"==t.advice&&(this.isOpen=!1),this.socket.onPacket(t),this)},o.prototype.setCloseTimeout=function(){if(!this.closeTimeout){var t=this;this.closeTimeout=setTimeout(function(){t.onDisconnect()},this.socket.closeTimeout)}},o.prototype.onDisconnect=function(){return this.isOpen&&this.close(),this.clearTimeouts(),this.socket.onDisconnect(),this},o.prototype.onConnect=function(){return this.socket.onConnect(),this},o.prototype.clearCloseTimeout=function(){this.closeTimeout&&(clearTimeout(this.closeTimeout),this.closeTimeout=null)},o.prototype.clearTimeouts=function(){this.clearCloseTimeout(),this.reopenTimeout&&clearTimeout(this.reopenTimeout)},o.prototype.packet=function(t){this.send(e.parser.encodePacket(t))},o.prototype.onHeartbeat=function(){this.packet({type:"heartbeat"})},o.prototype.onOpen=function(){this.isOpen=!0,this.clearCloseTimeout(),this.socket.onOpen()},o.prototype.onClose=function(){this.isOpen=!1,this.socket.onClose(),this.onDisconnect()},o.prototype.prepareUrl=function(){var t=this.socket.options;return this.scheme()+"://"+t.host+":"+t.port+"/"+t.resource+"/"+e.protocol+"/"+this.name+"/"+this.sessid},o.prototype.ready=function(t,e){e.call(this)}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports),function(t,e,o){function n(t){if(this.options={port:80,secure:!1,document:"document"in o?document:!1,resource:"socket.io",transports:e.transports,"connect timeout":1e4,"try multiple transports":!0,reconnect:!0,"reconnection delay":500,"reconnection limit":1/0,"reopen delay":3e3,"max reconnection attempts":10,"sync disconnect on unload":!1,"auto connect":!0,"flash policy port":10843,manualFlush:!1},e.util.merge(this.options,t),this.connected=!1,this.open=!1,this.connecting=!1,this.reconnecting=!1,this.namespaces={},this.buffer=[],this.doBuffer=!1,this.options["sync disconnect on unload"]&&(!this.isXDomain()||e.util.ua.hasCORS)){var n=this;e.util.on(o,"beforeunload",function(){n.disconnectSync()},!1)}this.options["auto connect"]&&this.connect()}function i(){}t.Socket=n,e.util.mixin(n,e.EventEmitter),n.prototype.of=function(t){return this.namespaces[t]||(this.namespaces[t]=new e.SocketNamespace(this,t),""!==t&&this.namespaces[t].packet({type:"connect"})),this.namespaces[t]
!function(t){if("function"==typeof bootstrap)bootstrap("simplewebrtc",t);else if("object"==typeof exports)module.exports=t();else if("function"==typeof define&&define.amd)define(t);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeSimpleWebRTC=t}else"undefined"!=typeof window?window.SimpleWebRTC=t():global.SimpleWebRTC=t()}(function(){return function(t,e,o){function n(o,r){if(!e[o]){if(!t[o]){var s="function"==typeof require&&require;if(!r&&s)return s(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var a=e[o]={exports:{}};t[o][0].call(a.exports,function(e){var i=t[o][1][e];return n(i?i:e)},a,a.exports)}return e[o].exports}for(var i="function"==typeof require&&require,r=0;r<o.length;r++)n(o[r]);return n}({1:[function(t,e){function o(t){var e,o,s=this,a=t||{},p=this.config={url:"http://signaling.simplewebrtc.com:8888",debug:!1,localVideoEl:"",remoteVideosEl:"",autoRequestMedia:!1,autoRemoveVideos:!0,adjustPeerVolume:!0,peerVolumeWhenSpeaking:.25};this.logger=function(){return t.debug?t.logger||console:t.logger||c}();for(e in a)this.config[e]=a[e];this.capabilities=r,i.call(this),o=this.connection=io.connect(this.config.url),o.on("connect",function(){s.emit("connectionReady",o.socket.sessionid),s.sessionReady=!0,s.testReadiness()}),o.on("message",function(t){var e,o=s.webrtc.getPeers(t.from,t.roomType);"offer"===t.type?(e=s.webrtc.createPeer({id:t.from,type:t.roomType,sharemyscreen:"screen"===t.roomType&&!t.broadcaster}),e.handleMessage(t)):o.length&&o.forEach(function(e){e.handleMessage(t)})}),o.on("remove",function(t){t.id!==s.connection.socket.sessionid&&s.webrtc.removePeers(t.id,t.type)}),t.logger=this.logger,t.debug=!1,this.webrtc=new n(t),["mute","unmute","pause","resume"].forEach(function(t){s[t]=s.webrtc[t].bind(s.webrtc)}),this.webrtc.on("*",function(){s.emit.apply(s,arguments)}),p.debug&&this.on("*",this.logger.log.bind(this.logger,"SimpleWebRTC event:")),this.webrtc.on("localStream",function(){s.testReadiness()}),this.webrtc.on("message",function(t){s.connection.emit("message",t)}),this.webrtc.on("peerStreamAdded",this.handlePeerStreamAdded.bind(this)),this.webrtc.on("peerStreamRemoved",this.handlePeerStreamRemoved.bind(this)),this.config.adjustPeerVolume&&(this.webrtc.on("speaking",this.setVolumeForAll.bind(this,this.config.peerVolumeWhenSpeaking)),this.webrtc.on("stoppedSpeaking",this.setVolumeForAll.bind(this,1))),this.config.autoRequestMedia&&this.startLocalVideo()}var n=t("webrtc"),i=t("wildemitter"),r=t("webrtcsupport"),s=t("attachmediastream"),a=t("getscreenmedia"),c=t("mockconsole");o.prototype=Object.create(i.prototype,{constructor:{value:o}}),o.prototype.leaveRoom=function(){this.roomName&&(this.connection.emit("leave",this.roomName),this.webrtc.peers.forEach(function(t){t.end()}),this.getLocalScreen()&&this.stopScreenShare(),this.emit("leftRoom",this.roomName))},o.prototype.handlePeerStreamAdded=function(t){var e=this.getRemoteVideoContainer(),o=s(t.stream);t.videoEl=o,o.id=this.getDomId(t),e&&e.appendChild(o),this.emit("videoAdded",o,t)},o.prototype.handlePeerStreamRemoved=function(t){var e=this.getRemoteVideoContainer(),o=t.videoEl;this.config.autoRemoveVideos&&e&&o&&e.removeChild(o),o&&this.emit("videoRemoved",o,t)},o.prototype.getDomId=function(t){return[t.id,t.type,t.broadcaster?"broadcasting":"incoming"].join("_")},o.prototype.setVolumeForAll=function(t){this.webrtc.peers.forEach(function(e){e.videoEl&&(e.videoEl.volume=t)})},o.prototype.joinRoom=function(t,e){var o=this;this.roomName=t,this.connection.emit("join",t,function(n,i){if(n)o.emit("error",n);else{var r,s,a,c;for(r in i.clients){s=i.clients[r];for(a in s)s[a]&&(c=o.webrtc.createPeer({id:r,type:a}),c.start())}}e&&e(n,i),o.emit("joinedRoom",t)})},o.prototype.getEl=function(t){return"string"==typeof t?document.getElementById(t):t},o.prototype.startLocalVideo=function(){var t=this;this.webrtc.startLocalMedia(null,function(e,o){e?t.emit(e):s(o,t.getLocalVideoContainer(),{muted:!0,mirror:!0})})},o.prototype.stopLocalVideo=function(){this.webrtc.stopLocalMedia()},o.prototype.getLocalVideoContainer=function(){var t=this.getEl(this.config.localVideoEl);if(t&&"VIDEO"===t.tagName)return t;if(t){var e=document.createElement("video");return t.appendChild(e),e}},o.prototype.getRemoteVideoContainer=function(){return this.getEl(this.config.remoteVideosEl)},o.prototype.shareScreen=function(t){var e=this;a(function(o,n){var i=document.createElement("video"),r=e.getRemoteVideoContainer();o?e.emit(o):(e.webrtc.localScreen=n,i.id="localScreen",s(n,i),r&&r.appendChild(i),e.emit("localScreenAdded",i),e.connection.emit("shareScreen"),e.webrtc.peers.forEach(function(t){var o;"video"===t.type&&(o=e.webrtc.createPeer({id:t.id,type:"screen",sharemyscreen:!0,broadcaster:e.connection.socket.sessionid}),o.start())})),t&&t(o,n)})},o.prototype.getLocalScreen=function(){return this.webrtc.localScreen},o.prototype.stopScreenShare=function(){this.connection.emit("unshareScreen");var t=document.getElementById("localScreen"),e=this.getRemoteVideoContainer(),o=this.getLocalScreen();this.config.autoRemoveVideos&&e&&t&&e.removeChild(t),t&&this.emit("videoRemoved",t),o&&o.stop(),this.webrtc.peers.forEach(function(t){t.broadcaster&&t.end()}),delete this.webrtc.localScreen},o.prototype.testReadiness=function(){var t=this;this.webrtc.localStream&&this.sessionReady&&setTimeout(function(){t.emit("readyToCall",t.connection.socket.sessionid)},1e3)},o.prototype.createRoom=function(t,e){2===arguments.length?this.connection.emit("create",t,e):this.connection.emit("create",t)},e.exports=o},{attachmediastream:5,getscreenmedia:6,mockconsole:7,webrtc:2,webrtcsupport:4,wildemitter:3}],3:[function(t,e){function o(){this.callbacks={}}e.exports=o,o.prototype.on=function(t){var e=3===arguments.length,o=e?arguments[1]:void 0,n=e?arguments[2]:arguments[1];return n._groupName=o,(this.callbacks[t]=this.callbacks[t]||[]).push(n),this},o.prototype.once=function(t){function e(){o.off(t,e),r.apply(this,arguments)}var o=this,n=3===arguments.length,i=n?arguments[1]:void 0,r=n?arguments[2]:arguments[1];return this.on(t,i,e),this},o.prototype.releaseGroup=function(t){var e,o,n,i;for(e in this.callbacks)for(i=this.callbacks[e],o=0,n=i.length;n>o;o++)i[o]._groupName===t&&(i.splice(o,1),o--,n--);return this},o.prototype.off=function(t,e){var o,n=this.callbacks[t];return n?1===arguments.length?(delete this.callbacks[t],this):(o=n.indexOf(e),n.splice(o,1),this):this},o.prototype.emit=function(t){var e,o,n=[].slice.call(arguments,1),i=this.callbacks[t],r=this.getWildcardCallbacks(t);if(i)for(e=0,o=i.length;o>e&&i[e];++e)i[e].apply(this,n);if(r)for(e=0,o=r.length;o>e&&r[e];++e)r[e].apply(this,[t].concat(n));return this},o.prototype.getWildcardCallbacks=function(t){var e,o,n=[];for(e in this.callbacks)o=e.split("*"),("*"===e||2===o.length&&t.slice(0,o[1].length)===o[1])&&(n=n.concat(this.callbacks[e]));return n}},{}],4:[function(t,e){var o=window.mozRTCPeerConnection||window.webkitRTCPeerConnection||window.RTCPeerConnection,n=window.mozRTCIceCandidate||window.RTCIceCandidate,i=window.mozRTCSessionDescription||window.RTCSessionDescription,r=function(){return window.mozRTCPeerConnection?"moz":window.webkitRTCPeerConnection?"webkit":void 0}(),s=window.webkitMediaStream||window.MediaStream,a=navigator.userAgent.match("Chrome")&&parseInt(navigator.userAgent.match(/Chrome\/(.*) /)[1],10)>=26,c=window.webkitAudioContext||window.AudioContext;e.exports={support:!!o,dataChannel:!!(o&&o.prototype&&o.prototype.createDataChannel),prefix:r,webAudio:!(!c||!c.prototype.createMediaStreamSource),mediaStream:!(!s||!s.prototype.removeTrack),screenSharing:a,AudioContext:c,PeerConnection:o,SessionDescription:i,IceCandidate:n}},{}],5:[function(t,e){e.exports=function(t,e,o){var n,i=window.URL,r={autoplay:!0,mirror:!1,muted:!1},s=e||document.createElement("video");if(o)for(n in o)r[n]=o[n];if(r.autoplay&&(s.autoplay="autoplay"),r.muted&&(s.muted=!0),r.mirror&&["","moz","webkit","o","ms"].forEach(function(t){var e=t?t+"Transform":"transform";s.style[e]="scaleX(-1)"}),i&&i.createObjectURL)s.src=i.createObjectURL(t);else if(s.srcObject)s.srcObject=t;else{if(!s.mozSrcObject)return!1;s.mozSrcObject=t}return s}},{}],7:[function(t,e){for(var o="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),n=o.length,i=function(){},r={};n--;)r[o[n]]=i;e.exports=r},{}],6:[function(t,e){var o=t("getusermedia");e.exports=function(t){var e,n={video:{mandatory:{chromeMediaSource:"screen"}}};return"http:"===window.location.protocol?(e=new Error("NavigatorUserMediaError"),e.name="HTTPS_REQUIRED",t(e)):(o(n,t),void 0)}},{getusermedia:8}],9:[function(t,e){var o=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;e.exports=function(t,e){var n,i=2===arguments.length,r={video:!0,audio:!0},s="PERMISSION_DENIED",a="CONSTRAINT_NOT_SATISFIED";return i||(e=t,t=r),o?(o.call(navigator,t,function(t){e(null,t)},function(t){var o;"string"==typeof t?(o=new Error("NavigatorUserMediaError"),o.name=t===s?s:a):(o=t,o.name||(t.name=o[s]?s:a)),e(o)}),void 0):(n=new Error("NavigatorUserMediaError"),n.name="NOT_SUPPORTED_ERROR",e(n))}},{}],8:[function(t,e){var o=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;e.exports=function(t,e){var n,i=2===arguments.length,r={video:!0,audio:!0},s="PERMISSION_DENIED",a="CONSTRAINT_NOT_SATISFIED";return i||(e=t,t=r),o?(o.call(navigator,t,function(t){e(null,t)},function(t){var o;"string"==typeof t?(o=new Error("NavigatorUserMediaError"),o.name=t===s?s:a):(o=t,o.name||(t.name=o[s]?s:a)),e(o)}),void 0):(n=new Error("NavigatorUserMediaError"),n.name="NOT_SUPPORTED_ERROR",e(n))}},{}],2:[function(t,e){function o(t){var e=this,o=t||{};this.config={debug:!1,localVideoEl:"",remoteVideosEl:"",autoRequestMedia:!1,peerConnectionConfig:{iceServers:[{url:"stun:stun.l.google.com:19302"}]},peerConnectionContraints:{optional:[{DtlsSrtpKeyAgreement:!0},{RtpDataChannels:!0}]},autoAdjustMic:!1,media:{audio:!0,video:!0},detectSpeakingEvents:!0};var n;this.screenSharingSupport=i.screenSharing,this.logger=function(){return t.debug?t.logger||console:t.logger||u}();for(n in o)this.config[n]=o[n];i.support||this.logger.error("Your browser doesn't seem to support WebRTC"),this.peers=[],a.call(this),this.config.debug&&this.on("*",function(t,o,n){var i;i=e.config.logger===u?console:e.logger,i.log("event:",t,o,n)})}function n(t){var e=this;this.id=t.id,this.parent=t.parent,this.type=t.type||"video",this.oneway=t.oneway||!1,this.sharemyscreen=t.sharemyscreen||!1,this.browserPrefix=t.prefix,this.stream=t.stream,this.pc=new s(this.parent.config.peerConnectionConfig,this.parent.config.peerConnectionContraints),this.pc.on("ice",this.onIceCandidate.bind(this)),this.pc.on("addStream",this.handleRemoteStreamAdded.bind(this)),this.pc.on("removeStream",this.handleStreamRemoved.bind(this)),this.logger=this.parent.logger,"screen"===t.type?this.parent.localScreen&&this.sharemyscreen&&(this.logger.log("adding local screen stream to peer connection"),this.pc.addStream(this.parent.localScreen),this.broadcaster=t.broadcaster):this.pc.addStream(this.parent.localStream),a.call(this),this.on("*",function(t,o){e.parent.emit(t,o,e)})}var i=t("webrtcsupport"),r=t("getusermedia"),s=t("rtcpeerconnection"),a=t("wildemitter"),c=t("hark"),p=t("mediastream-gain"),u=t("mockconsole");o.prototype=Object.create(a.prototype,{constructor:{value:o}}),o.prototype.createPeer=function(t){var e;return t.parent=this,e=new n(t),this.peers.push(e),e},o.prototype.startLocalMedia=function(t,e){var o=this,n=t||{video:!0,audio:!0};r(n,function(t,i){t||(n.audio&&o.config.detectSpeakingEvents&&o.setupAudioMonitor(i),o.localStream=i,o.config.autoAdjustMic&&(o.gainController=new p(i),o.setMicIfEnabled(.5)),o.emit("localStream",i)),e&&e(t,i)})},o.prototype.stopLocalMedia=function(){this.localStream&&(this.localStream.stop(),this.emit("localStreamStopped"))},o.prototype.mute=function(){this._audioEnabled(!1),this.hardMuted=!0,this.emit("audioOff")},o.prototype.unmute=function(){this._audioEnabled(!0),this.hardMuted=!1,this.emit("audioOn")},o.prototype.setupAudioMonitor=function(t){this.logger.log("Setup audio");var e,o=c(t),n=this;o.on("speaking",function(){n.hardMuted||(n.setMicIfEnabled(1),n.sendToAll("speaking",{}),n.emit("speaking"))}),o.on("stopped_speaking",function(){n.hardMuted||(e&&clearTimeout(e),e=setTimeout(function(){n.setMicIfEnabled(.5),n.sendToAll("stopped_speaking",{}),n.emit("stoppedSpeaking")},1e3))})},o.prototype.setMicIfEnabled=function(t){this.config.autoAdjustMic&&this.gainController.setGain(t)},o.prototype.pauseVideo=function(){this._videoEnabled(!1),this.emit("videoOff")},o.prototype.resumeVideo=function(){this._videoEnabled(!0),this.emit("videoOn")},o.prototype.pause=function(){this._audioEnabled(!1),this.pauseVideo()},o.prototype.resume=function(){this._audioEnabled(!0),this.resumeVideo()},o.prototype._audioEnabled=function(t){this.setMicIfEnabled(t?1:0),this.localStream.getAudioTracks().forEach(function(e){e.enabled=!!t})},o.prototype._videoEnabled=function(t){this.localStream.getVideoTracks().forEach(function(e){e.enabled=!!t})},o.prototype.removePeers=function(t,e){this.getPeers(t,e).forEach(function(t){t.end()})},o.prototype.getPeers=function(t,e){return this.peers.filter(function(o){return!(t&&o.id!==t||e&&o.type!==e)})},o.prototype.sendToAll=function(t,e){this.peers.forEach(function(o){o.send(t,e)})},n.prototype=Object.create(a.prototype,{constructor:{value:n}}),n.prototype.handleMessage=function(t){var e=this;this.logger.log("getting",t.type,t),t.prefix&&(this.browserPrefix=t.prefix),"offer"===t.type?this.pc.answer(t.payload,function(t,o){e.send("answer",o)}):"answer"===t.type?this.pc.handleAnswer(t.payload):"candidate"===t.type?this.pc.processIce(t.payload):"speaking"===t.type?this.parent.emit("speaking",{id:t.from}):"stopped_speaking"===t.type&&this.parent.emit("stopped_speaking",{id:t.from})},n.prototype.send=function(t,e){var o={to:this.id,broadcaster:this.broadcaster,roomType:this.type,type:t,payload:e,prefix:i.prefix};this.logger.log("sending",t,o),this.parent.emit("message",o)},n.prototype.onIceCandidate=function(t){this.closed||(t?this.send("candidate",t):this.logger.log("End of candidates."))},n.prototype.start=function(){var t=this;this.pc.offer(function(e,o){t.send("offer",o)})},n.prototype.end=function(){this.pc.close(),this.handleStreamRemoved()},n.prototype.handleRemoteStreamAdded=function(t){this.stream=t.stream,this.parent.emit("peerStreamAdded",this)},n.prototype.handleStreamRemoved=function(){this.parent.peers.splice(this.parent.peers.indexOf(this),1),this.closed=!0,this.parent.emit("peerStreamRemoved",this)},e.exports=o},{getusermedia:9,hark:12,"mediastream-gain":11,mockconsole:7,rtcpeerconnection:10,webrtcsupport:4,wildemitter:3}],13:[function(t,e){var o=window.mozRTCPeerConnection||window.webkitRTCPeerConnection||window.RTCPeerConnection,n=window.mozRTCIceCandidate||window.RTCIceCandidate,i=window.mozRTCSessionDescription||window.RTCSessionDescription,r=function(){return window.mozRTCPeerConnection?"moz":window.webkitRTCPeerConnection?"webkit":void 0}(),s=navigator.userAgent.match("Chrome")&&parseInt(navigator.userAgent.match(/Chrome\/(.*) /)[1],10)>=26,a=window.webkitAudioContext||window.AudioContext;e.exports={support:!!o,dataChannel:!!(o&&o.prototype&&o.prototype.createDataChannel),prefix:r,webAudio:!(!a||!a.prototype.createMediaStreamSource),screenSharing:s,AudioContext:a,PeerConnection:o,SessionDescription:i,IceCandidate:n}},{}],10:[function(t,e){function o(t,e){this.pc=new i.PeerConnection(t,e),n.call(this),this.pc.onicecandidate=this._onIce.bind(this),this.pc.onaddstream=this._onAddStream.bind(this),this.pc.onremovestream=this._onRemoveStream.bind(this),t.debug&&this.on("*",function(t,e){console.log("PeerConnection event:",t,e)})}var n=t("wildemitter"),i=t("webrtcsupport");o.prototype=Object.create(n.prototype,{constructor:{value:o}}),o.prototype.addStream=function(t){this.localStream=t,this.pc.addStream(t)},o.prototype._onIce=function(t){t.candidate?this.emit("ice",t.candidate):this.emit("endOfCandidates")},o.prototype._onAddStream=function(t){this.emit("addStream",t)},o.prototype._onRemoveStream=function(t){this.emit("removeStream",t)},o.prototype.processIce=function(t){this.pc.addIceCandidate(new i.IceCandidate(t))},o.prototype.offer=function(t,e){var o=this,n=2===arguments.length,i=n?t:{mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}},r=n?e:t;this.pc.createOffer(function(t){o.pc.setLocalDescription(t),o.emit("offer",t),r&&r(null,t)},function(t){o.emit("error",t),r&&r(t)},i)},o.prototype.answerAudioOnly=function(t,e){var o={mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!1}};this._answer(t,o,e)},o.prototype.answerBroadcastOnly=function(t,e){var o={mandatory:{OfferToReceiveAudio:!1,OfferToReceiveVideo:!1}};this._answer(t,o,e)},o.prototype._answer=function(t,e,o){var n=this;this.pc.setRemoteDescription(new i.SessionDescription(t)),this.pc.createAnswer(function(t){n.pc.setLocalDescription(t),n.emit("answer",t),o&&o(null,t)},function(t){n.emit("error",t),o&&o(t)},e)},o.prototype.answer=function(t,e,o){var n=3===arguments.length,i=n?o:e,r=n?e:{mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}};this._answer(t,r,i)},o.prototype.handleAnswer=function(t){this.pc.setRemoteDescription(new i.SessionDescription(t))},o.prototype.close=function(){this.pc.close(),this.emit("close")},e.exports=o},{webrtcsupport:13,wildemitter:3}],12:[function(t,e){function o(t,e){var o=-1/0;t.getFloatFrequencyData(e);for(var n=0,i=e.length;i>n;n++)e[n]>o&&e[n]<0&&(o=e[n]);return o}var n=t("wildemitter");e.exports=function(t,e){var i=new n;if(!window.webkitAudioContext)return i;var r,s,a,e=e||{},c=e.smoothing||.5,p=e.interval||100,u=e.threshold,h=e.play,d=new webkitAudioContext;a=d.createAnalyser(),a.fftSize=512,a.smoothingTimeConstant=c,s=new Float32Array(a.fftSize),t.jquery&&(t=t[0]),t instanceof HTMLAudioElement?(r=d.createMediaElementSource(t),"undefined"==typeof h&&(h=!0),u=u||-65):(r=d.createMediaStreamSource(t),u=u||-45),r.connect(a),h&&a.connect(d.destination),i.speaking=!1,i.setThreshold=function(t){u=t},i.setInterval=function(t){p=t};var l=function(){setTimeout(function(){var t=o(a,s);i.emit("volume_change",t,u),t>u?i.speaking||(i.speaking=!0,i.emit("speaking")):i.speaking&&(i.speaking=!1,i.emit("stopped_speaking")),l()},p)};return l(),i}},{wildemitter:3}],11:[function(t,e){function o(t){if(this.support=n.webAudio&&n.mediaStream,this.gain=1,this.support){var e=this.context=new n.AudioContext;this.microphone=e.createMediaStreamSource(t),this.gainFilter=e.createGain(),this.destination=e.createMediaStreamDestination(),this.outputStream=this.destination.stream,this.microphone.connect(this.gainFilter),this.gainFilter.connect(this.destination),t.removeTrack(t.getAudioTracks()[0]),t.addTrack(this.outputStream.getAudioTracks()[0])}this.stream=t}var n=t("webrtcsupport");o.prototype.setGain=function(t){this.support&&(this.gainFilter.gain.value=t,this.gain=t)},o.prototype.getGain=function(){return this.gain},o.prototype.off=function(){return this.setGain(0)},o.prototype.on=function(){this.setGain(1)},e.exports=o},{webrtcsupport:4}]},{},[1])(1)});var io="undefined"==typeof module?{}:module.exports;!function(){!function(t,e){var o=t;o.version="0.9.11",o.protocol=1,o.transports=[],o.j=[],o.sockets={},o.connect=function(t,n){var i,r,s=o.util.parseUri(t);e&&e.location&&(s.protocol=s.protocol||e.location.protocol.slice(0,-1),s.host=s.host||(e.document?e.document.domain:e.location.hostname),s.port=s.port||e.location.port),i=o.util.uniqueUri(s);var a={host:s.host,secure:"https"==s.protocol,port:s.port||("https"==s.protocol?443:80),query:s.query||""};return o.util.merge(a,n),(a["force new connection"]||!o.sockets[i])&&(r=new o.Socket(a)),!a["force new connection"]&&r&&(o.sockets[i]=r),r=r||o.sockets[i],r.of(s.path.length>1?s.path:"")}}("object"==typeof module?module.exports:this.io={},this),function(t,e){var o=t.util={},n=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,i=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];o.parseUri=function(t){for(var e=n.exec(t||""),o={},r=14;r--;)o[i[r]]=e[r]||"";return o},o.uniqueUri=function(t){var o=t.protocol,n=t.host,i=t.port;return"document"in e?(n=n||document.domain,i=i||("https"==o&&"https:"!==document.location.protocol?443:document.location.port)):(n=n||"localhost",i||"https"!=o||(i=443)),(o||"http")+"://"+n+":"+(i||80)},o.query=function(t,e){var n=o.chunkQuery(t||""),i=[];o.merge(n,o.chunkQuery(e||""));for(var r in n)n.hasOwnProperty(r)&&i.push(r+"="+n[r]);return i.length?"?"+i.join("&"):""},o.chunkQuery=function(t){for(var e,o={},n=t.split("&"),i=0,r=n.length;r>i;++i)e=n[i].split("="),e[0]&&(o[e[0]]=e[1]);return o};var r=!1;o.load=function(t){return"document"in e&&"complete"===document.readyState||r?t():(o.on(e,"load",t,!1),void 0)},o.on=function(t,e,o,n){t.attachEvent?t.attachEvent("on"+e,o):t.addEventListener&&t.addEventListener(e,o,n)},o.request=function(t){if(t&&"undefined"!=typeof XDomainRequest&&!o.ua.hasCORS)return new XDomainRequest;if("undefined"!=typeof XMLHttpRequest&&(!t||o.ua.hasCORS))return new XMLHttpRequest;if(!t)try{return new(window[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}return null},"undefined"!=typeof window&&o.load(function(){r=!0}),o.defer=function(t){return o.ua.webkit&&"undefined"==typeof importScripts?(o.load(function(){setTimeout(t,100)}),void 0):t()},o.merge=function(t,e,n,i){var r,s=i||[],a="undefined"==typeof n?2:n;for(r in e)e.hasOwnProperty(r)&&o.indexOf(s,r)<0&&("object"==typeof t[r]&&a?o.merge(t[r],e[r],a-1,s):(t[r]=e[r],s.push(e[r])));return t},o.mixin=function(t,e){o.merge(t.prototype,e.prototype)},o.inherit=function(t,e){function o(){}o.prototype=e.prototype,t.prototype=new o},o.isArray=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},o.intersect=function(t,e){for(var n=[],i=t.length>e.length?t:e,r=t.length>e.length?e:t,s=0,a=r.length;a>s;s++)~o.indexOf(i,r[s])&&n.push(r[s]);return n},o.indexOf=function(t,e,o){for(var n=t.length,o=0>o?0>o+n?0:o+n:o||0;n>o&&t[o]!==e;o++);return o>=n?-1:o},o.toArray=function(t){for(var e=[],o=0,n=t.length;n>o;o++)e.push(t[o]);return e},o.ua={},o.ua.hasCORS="undefined"!=typeof XMLHttpRequest&&function(){try{var t=new XMLHttpRequest}catch(e){return!1}return void 0!=t.withCredentials}(),o.ua.webkit="undefined"!=typeof navigator&&/webkit/i.test(navigator.userAgent),o.ua.iDevice="undefined"!=typeof navigator&&/iPad|iPhone|iPod/i.test(navigator.userAgent)}("undefined"!=typeof io?io:module.exports,this),function(t,e){function o(){}t.EventEmitter=o,o.prototype.on=function(t,o){return this.$events||(this.$events={}),this.$events[t]?e.util.isArray(this.$events[t])?this.$events[t].push(o):this.$events[t]=[this.$events[t],o]:this.$events[t]=o,this},o.prototype.addListener=o.prototype.on,o.prototype.once=function(t,e){function o(){n.removeListener(t,o),e.apply(this,arguments)}var n=this;return o.listener=e,this.on(t,o),this},o.prototype.removeListener=function(t,o){if(this.$events&&this.$events[t]){var n=this.$events[t];if(e.util.isArray(n)){for(var i=-1,r=0,s=n.length;s>r;r++)if(n[r]===o||n[r].listener&&n[r].listener===o){i=r;break}if(0>i)return this;n.splice(i,1),n.length||delete this.$events[t]}else(n===o||n.listener&&n.listener===o)&&delete this.$events[t]}return this},o.prototype.removeAllListeners=function(t){return void 0===t?(this.$events={},this):(this.$events&&this.$events[t]&&(this.$events[t]=null),this)},o.prototype.listeners=function(t){return this.$events||(this.$events={}),this.$events[t]||(this.$events[t]=[]),e.util.isArray(this.$events[t])||(this.$events[t]=[this.$events[t]]),this.$events[t]},o.prototype.emit=function(t){if(!this.$events)return!1;var o=this.$events[t];if(!o)return!1;var n=Array.prototype.slice.call(arguments,1);if("function"==typeof o)o.apply(this,n);else{if(!e.util.isArray(o))return!1;for(var i=o.slice(),r=0,s=i.length;s>r;r++)i[r].apply(this,n)}return!0}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports),function(exports,nativeJSON){"use strict";function f(t){return 10>t?"0"+t:t}function date(t){return isFinite(t.valueOf())?t.getUTCFullYear()+"-"+f(t.getUTCMonth()+1)+"-"+f(t.getUTCDate())+"T"+f(t.getUTCHours())+":"+f(t.getUTCMinutes())+":"+f(t.getUTCSeconds())+"Z":null}function quote(t){return escapable.lastIndex=0,escapable.test(t)?'"'+t.replace(escapable,function(t){var e=meta[t];return"string"==typeof e?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}function str(t,e){var o,n,i,r,s,a=gap,c=e[t];switch(c instanceof Date&&(c=date(t)),"function"==typeof rep&&(c=rep.call(e,t,c)),typeof c){case"string":return quote(c);case"number":return isFinite(c)?String(c):"null";case"boolean":case"null":return String(c);case"object":if(!c)return"null";if(gap+=indent,s=[],"[object Array]"===Object.prototype.toString.apply(c)){for(r=c.length,o=0;r>o;o+=1)s[o]=str(o,c)||"null";return i=0===s.length?"[]":gap?"[\n"+gap+s.join(",\n"+gap)+"\n"+a+"]":"["+s.join(",")+"]",gap=a,i}if(rep&&"object"==typeof rep)for(r=rep.length,o=0;r>o;o+=1)"string"==typeof rep[o]&&(n=rep[o],i=str(n,c),i&&s.push(quote(n)+(gap?": ":":")+i));else for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(i=str(n,c),i&&s.push(quote(n)+(gap?": ":":")+i));return i=0===s.length?"{}":gap?"{\n"+gap+s.join(",\n"+gap)+"\n"+a+"}":"{"+s.join(",")+"}",gap=a,i}}if(nativeJSON&&nativeJSON.parse)return exports.JSON={parse:nativeJSON.parse,stringify:nativeJSON.stringify};var JSON=exports.JSON={},cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;JSON.stringify=function(t,e,o){var n;if(gap="",indent="","number"==typeof o)for(n=0;o>n;n+=1)indent+=" ";else"string"==typeof o&&(indent=o);if(rep=e,e&&"function"!=typeof e&&("object"!=typeof e||"number"!=typeof e.length))throw new Error("JSON.stringify");return str("",{"":t})},JSON.parse=function(text,reviver){function walk(t,e){var o,n,i=t[e];if(i&&"object"==typeof i)for(o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n=walk(i,o),void 0!==n?i[o]=n:delete i[o]);return reviver.call(t,e,i)}var j;if(text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(t){return"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof JSON?JSON:void 0),function(t,e){var o=t.parser={},n=o.packets=["disconnect","connect","heartbeat","message","json","event","ack","error","noop"],i=o.reasons=["transport not supported","client not handshaken","unauthorized"],r=o.advice=["reconnect"],s=e.JSON,a=e.util.indexOf;o.encodePacket=function(t){var e=a(n,t.type),o=t.id||"",c=t.endpoint||"",p=t.ack,u=null;switch(t.type){case"error":var h=t.reason?a(i,t.reason):"",d=t.advice?a(r,t.advice):"";(""!==h||""!==d)&&(u=h+(""!==d?"+"+d:""));break;case"message":""!==t.data&&(u=t.data);break;case"event":var l={name:t.name};t.args&&t.args.length&&(l.args=t.args),u=s.stringify(l);break;case"json":u=s.stringify(t.data);break;case"connect":t.qs&&(u=t.qs);break;case"ack":u=t.ackId+(t.args&&t.args.length?"+"+s.stringify(t.args):"")}var f=[e,o+("data"==p?"+":""),c];return null!==u&&void 0!==u&&f.push(u),f.join(":")},o.encodePayload=function(t){var e="";if(1==t.length)return t[0];for(var o=0,n=t.length;n>o;o++){var i=t[o];e+="�"+i.length+"�"+t[o]}return e};var c=/([^:]+):([0-9]+)?(\+)?:([^:]+)?:?([\s\S]*)?/;o.decodePacket=function(t){var e=t.match(c);if(!e)return{};var o=e[2]||"",t=e[5]||"",a={type:n[e[1]],endpoint:e[4]||""};switch(o&&(a.id=o,a.ack=e[3]?"data":!0),a.type){case"error":var e=t.split("+");a.reason=i[e[0]]||"",a.advice=r[e[1]]||"";break;case"message":a.data=t||"";break;case"event":try{var p=s.parse(t);a.name=p.name,a.args=p.args}catch(u){}a.args=a.args||[];break;case"json":try{a.data=s.parse(t)}catch(u){}break;case"connect":a.qs=t||"";break;case"ack":var e=t.match(/^([0-9]+)(\+)?(.*)/);if(e&&(a.ackId=e[1],a.args=[],e[3]))try{a.args=e[3]?s.parse(e[3]):[]}catch(u){}break;case"disconnect":case"heartbeat":}return a},o.decodePayload=function(t){if("�"==t.charAt(0)){for(var e=[],n=1,i="";n<t.length;n++)"�"==t.charAt(n)?(e.push(o.decodePacket(t.substr(n+1).substr(0,i))),n+=Number(i)+1,i=""):i+=t.charAt(n);return e}return[o.decodePacket(t)]}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports),function(t,e){function o(t,e){this.socket=t,this.sessid=e}t.Transport=o,e.util.mixin(o,e.EventEmitter),o.prototype.heartbeats=function(){return!0},o.prototype.onData=function(t){if(this.clearCloseTimeout(),(this.socket.connected||this.socket.connecting||this.socket.reconnecting)&&this.setCloseTimeout(),""!==t){var o=e.parser.decodePayload(t);if(o&&o.length)for(var n=0,i=o.length;i>n;n++)this.onPacket(o[n])}return this},o.prototype.onPacket=function(t){return this.socket.setHeartbeatTimeout(),"heartbeat"==t.type?this.onHeartbeat():("connect"==t.type&&""==t.endpoint&&this.onConnect(),"error"==t.type&&"reconnect"==t.advice&&(this.isOpen=!1),this.socket.onPacket(t),this)},o.prototype.setCloseTimeout=function(){if(!this.closeTimeout){var t=this;this.closeTimeout=setTimeout(function(){t.onDisconnect()},this.socket.closeTimeout)}},o.prototype.onDisconnect=function(){return this.isOpen&&this.close(),this.clearTimeouts(),this.socket.onDisconnect(),this},o.prototype.onConnect=function(){return this.socket.onConnect(),this},o.prototype.clearCloseTimeout=function(){this.closeTimeout&&(clearTimeout(this.closeTimeout),this.closeTimeout=null)},o.prototype.clearTimeouts=function(){this.clearCloseTimeout(),this.reopenTimeout&&clearTimeout(this.reopenTimeout)},o.prototype.packet=function(t){this.send(e.parser.encodePacket(t))},o.prototype.onHeartbeat=function(){this.packet({type:"heartbeat"})},o.prototype.onOpen=function(){this.isOpen=!0,this.clearCloseTimeout(),this.socket.onOpen()},o.prototype.onClose=function(){this.isOpen=!1,this.socket.onClose(),this.onDisconnect()},o.prototype.prepareUrl=function(){var t=this.socket.options;return this.scheme()+"://"+t.host+":"+t.port+"/"+t.resource+"/"+e.protocol+"/"+this.name+"/"+this.sessid},o.prototype.ready=function(t,e){e.call(this)}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports),function(t,e,o){function n(t){if(this.options={port:80,secure:!1,document:"document"in o?document:!1,resource:"socket.io",transports:e.transports,"connect timeout":1e4,"try multiple transports":!0,reconnect:!0,"reconnection delay":500,"reconnection limit":1/0,"reopen delay":3e3,"max reconnection attempts":10,"sync disconnect on unload":!1,"auto connect":!0,"flash policy port":10843,manualFlush:!1},e.util.merge(this.options,t),this.connected=!1,this.open=!1,this.connecting=!1,this.reconnecting=!1,this.namespaces={},this.buffer=[],this.doBuffer=!1,this.options["sync disconnect on unload"]&&(!this.isXDomain()||e.util.ua.hasCORS)){var n=this;e.util.on(o,"beforeunload",function(){n.disconnectSync()},!1)}this.options["auto connect"]&&this.connect()}function i(){}t.Socket=n,e.util.mixin(n,e.EventEmitter),n.prototype.of=function(t){return this.namespaces[t]||(this.namespaces[t]=new e.SocketNamespace(this,t),""!==t&&this.namespaces[t].packet({type:"connect"})),this.namespaces[t]
},n.prototype.publish=function(){this.emit.apply(this,arguments);var t;for(var e in this.namespaces)this.namespaces.hasOwnProperty(e)&&(t=this.of(e),t.$emit.apply(t,arguments))},n.prototype.handshake=function(t){function o(e){e instanceof Error?(n.connecting=!1,n.onError(e.message)):t.apply(null,e.split(":"))}var n=this,r=this.options,s=["http"+(r.secure?"s":"")+":/",r.host+":"+r.port,r.resource,e.protocol,e.util.query(this.options.query,"t="+ +new Date)].join("/");if(this.isXDomain()&&!e.util.ua.hasCORS){var a=document.getElementsByTagName("script")[0],c=document.createElement("script");c.src=s+"&jsonp="+e.j.length,a.parentNode.insertBefore(c,a),e.j.push(function(t){o(t),c.parentNode.removeChild(c)})}else{var p=e.util.request();p.open("GET",s,!0),this.isXDomain()&&(p.withCredentials=!0),p.onreadystatechange=function(){4==p.readyState&&(p.onreadystatechange=i,200==p.status?o(p.responseText):403==p.status?n.onError(p.responseText):(n.connecting=!1,!n.reconnecting&&n.onError(p.responseText)))},p.send(null)}},n.prototype.getTransport=function(t){for(var o,n=t||this.transports,i=0;o=n[i];i++)if(e.Transport[o]&&e.Transport[o].check(this)&&(!this.isXDomain()||e.Transport[o].xdomainCheck(this)))return new e.Transport[o](this,this.sessionid);return null},n.prototype.connect=function(t){if(this.connecting)return this;var o=this;return o.connecting=!0,this.handshake(function(n,i,r,s){function a(t){return o.transport&&o.transport.clearTimeouts(),o.transport=o.getTransport(t),o.transport?(o.transport.ready(o,function(){o.connecting=!0,o.publish("connecting",o.transport.name),o.transport.open(),o.options["connect timeout"]&&(o.connectTimeoutTimer=setTimeout(function(){if(!o.connected&&(o.connecting=!1,o.options["try multiple transports"])){for(var t=o.transports;t.length>0&&t.splice(0,1)[0]!=o.transport.name;);t.length?a(t):o.publish("connect_failed")}},o.options["connect timeout"]))}),void 0):o.publish("connect_failed")}o.sessionid=n,o.closeTimeout=1e3*r,o.heartbeatTimeout=1e3*i,o.transports||(o.transports=o.origTransports=s?e.util.intersect(s.split(","),o.options.transports):o.options.transports),o.setHeartbeatTimeout(),a(o.transports),o.once("connect",function(){clearTimeout(o.connectTimeoutTimer),t&&"function"==typeof t&&t()})}),this},n.prototype.setHeartbeatTimeout=function(){if(clearTimeout(this.heartbeatTimeoutTimer),!this.transport||this.transport.heartbeats()){var t=this;this.heartbeatTimeoutTimer=setTimeout(function(){t.transport.onClose()},this.heartbeatTimeout)}},n.prototype.packet=function(t){return this.connected&&!this.doBuffer?this.transport.packet(t):this.buffer.push(t),this},n.prototype.setBuffer=function(t){this.doBuffer=t,!t&&this.connected&&this.buffer.length&&(this.options.manualFlush||this.flushBuffer())},n.prototype.flushBuffer=function(){this.transport.payload(this.buffer),this.buffer=[]},n.prototype.disconnect=function(){return(this.connected||this.connecting)&&(this.open&&this.of("").packet({type:"disconnect"}),this.onDisconnect("booted")),this},n.prototype.disconnectSync=function(){var t=e.util.request(),o=["http"+(this.options.secure?"s":"")+":/",this.options.host+":"+this.options.port,this.options.resource,e.protocol,"",this.sessionid].join("/")+"/?disconnect=1";t.open("GET",o,!1),t.send(null),this.onDisconnect("booted")},n.prototype.isXDomain=function(){var t=o.location.port||("https:"==o.location.protocol?443:80);return this.options.host!==o.location.hostname||this.options.port!=t},n.prototype.onConnect=function(){this.connected||(this.connected=!0,this.connecting=!1,this.doBuffer||this.setBuffer(!1),this.emit("connect"))},n.prototype.onOpen=function(){this.open=!0},n.prototype.onClose=function(){this.open=!1,clearTimeout(this.heartbeatTimeoutTimer)},n.prototype.onPacket=function(t){this.of(t.endpoint).onPacket(t)},n.prototype.onError=function(t){t&&t.advice&&"reconnect"===t.advice&&(this.connected||this.connecting)&&(this.disconnect(),this.options.reconnect&&this.reconnect()),this.publish("error",t&&t.reason?t.reason:t)},n.prototype.onDisconnect=function(t){var e=this.connected,o=this.connecting;this.connected=!1,this.connecting=!1,this.open=!1,(e||o)&&(this.transport.close(),this.transport.clearTimeouts(),e&&(this.publish("disconnect",t),"booted"!=t&&this.options.reconnect&&!this.reconnecting&&this.reconnect()))},n.prototype.reconnect=function(){function t(){if(o.connected){for(var t in o.namespaces)o.namespaces.hasOwnProperty(t)&&""!==t&&o.namespaces[t].packet({type:"connect"});o.publish("reconnect",o.transport.name,o.reconnectionAttempts)}clearTimeout(o.reconnectionTimer),o.removeListener("connect_failed",e),o.removeListener("connect",e),o.reconnecting=!1,delete o.reconnectionAttempts,delete o.reconnectionDelay,delete o.reconnectionTimer,delete o.redoTransports,o.options["try multiple transports"]=i}function e(){return o.reconnecting?o.connected?t():o.connecting&&o.reconnecting?o.reconnectionTimer=setTimeout(e,1e3):(o.reconnectionAttempts++>=n?o.redoTransports?(o.publish("reconnect_failed"),t()):(o.on("connect_failed",e),o.options["try multiple transports"]=!0,o.transports=o.origTransports,o.transport=o.getTransport(),o.redoTransports=!0,o.connect()):(o.reconnectionDelay<r&&(o.reconnectionDelay*=2),o.connect(),o.publish("reconnecting",o.reconnectionDelay,o.reconnectionAttempts),o.reconnectionTimer=setTimeout(e,o.reconnectionDelay)),void 0):void 0}this.reconnecting=!0,this.reconnectionAttempts=0,this.reconnectionDelay=this.options["reconnection delay"];var o=this,n=this.options["max reconnection attempts"],i=this.options["try multiple transports"],r=this.options["reconnection limit"];this.options["try multiple transports"]=!1,this.reconnectionTimer=setTimeout(e,this.reconnectionDelay),this.on("connect",e)}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports,this),function(t,e){function o(t,e){this.socket=t,this.name=e||"",this.flags={},this.json=new n(this,"json"),this.ackPackets=0,this.acks={}}function n(t,e){this.namespace=t,this.name=e}t.SocketNamespace=o,e.util.mixin(o,e.EventEmitter),o.prototype.$emit=e.EventEmitter.prototype.emit,o.prototype.of=function(){return this.socket.of.apply(this.socket,arguments)},o.prototype.packet=function(t){return t.endpoint=this.name,this.socket.packet(t),this.flags={},this},o.prototype.send=function(t,e){var o={type:this.flags.json?"json":"message",data:t};return"function"==typeof e&&(o.id=++this.ackPackets,o.ack=!0,this.acks[o.id]=e),this.packet(o)},o.prototype.emit=function(t){var e=Array.prototype.slice.call(arguments,1),o=e[e.length-1],n={type:"event",name:t};return"function"==typeof o&&(n.id=++this.ackPackets,n.ack="data",this.acks[n.id]=o,e=e.slice(0,e.length-1)),n.args=e,this.packet(n)},o.prototype.disconnect=function(){return""===this.name?this.socket.disconnect():(this.packet({type:"disconnect"}),this.$emit("disconnect")),this},o.prototype.onPacket=function(t){function o(){n.packet({type:"ack",args:e.util.toArray(arguments),ackId:t.id})}var n=this;switch(t.type){case"connect":this.$emit("connect");break;case"disconnect":""===this.name?this.socket.onDisconnect(t.reason||"booted"):this.$emit("disconnect",t.reason);break;case"message":case"json":var i=["message",t.data];"data"==t.ack?i.push(o):t.ack&&this.packet({type:"ack",ackId:t.id}),this.$emit.apply(this,i);break;case"event":var i=[t.name].concat(t.args);"data"==t.ack&&i.push(o),this.$emit.apply(this,i);break;case"ack":this.acks[t.ackId]&&(this.acks[t.ackId].apply(this,t.args),delete this.acks[t.ackId]);break;case"error":t.advice?this.socket.onError(t):"unauthorized"==t.reason?this.$emit("connect_failed",t.reason):this.$emit("error",t.reason)}},n.prototype.send=function(){this.namespace.flags[this.name]=!0,this.namespace.send.apply(this.namespace,arguments)},n.prototype.emit=function(){this.namespace.flags[this.name]=!0,this.namespace.emit.apply(this.namespace,arguments)}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports),function(t,e,o){function n(){e.Transport.apply(this,arguments)}t.websocket=n,e.util.inherit(n,e.Transport),n.prototype.name="websocket",n.prototype.open=function(){var t,n=e.util.query(this.socket.options.query),i=this;return t||(t=o.MozWebSocket||o.WebSocket),this.websocket=new t(this.prepareUrl()+n),this.websocket.onopen=function(){i.onOpen(),i.socket.setBuffer(!1)},this.websocket.onmessage=function(t){i.onData(t.data)},this.websocket.onclose=function(){i.onClose(),i.socket.setBuffer(!0)},this.websocket.onerror=function(t){i.onError(t)},this},n.prototype.send=e.util.ua.iDevice?function(t){var e=this;return setTimeout(function(){e.websocket.send(t)},0),this}:function(t){return this.websocket.send(t),this},n.prototype.payload=function(t){for(var e=0,o=t.length;o>e;e++)this.packet(t[e]);return this},n.prototype.close=function(){return this.websocket.close(),this},n.prototype.onError=function(t){this.socket.onError(t)},n.prototype.scheme=function(){return this.socket.options.secure?"wss":"ws"},n.check=function(){return"WebSocket"in o&&!("__addTask"in WebSocket)||"MozWebSocket"in o},n.xdomainCheck=function(){return!0},e.transports.push("websocket")}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports,this),function(t,e,o){function n(t){t&&(e.Transport.apply(this,arguments),this.sendBuffer=[])}function i(){}t.XHR=n,e.util.inherit(n,e.Transport),n.prototype.open=function(){return this.socket.setBuffer(!1),this.onOpen(),this.get(),this.setCloseTimeout(),this},n.prototype.payload=function(t){for(var o=[],n=0,i=t.length;i>n;n++)o.push(e.parser.encodePacket(t[n]));this.send(e.parser.encodePayload(o))},n.prototype.send=function(t){return this.post(t),this},n.prototype.post=function(t){function e(){4==this.readyState&&(this.onreadystatechange=i,r.posting=!1,200==this.status?r.socket.setBuffer(!1):r.onClose())}function n(){this.onload=i,r.socket.setBuffer(!1)}var r=this;this.socket.setBuffer(!0),this.sendXHR=this.request("POST"),o.XDomainRequest&&this.sendXHR instanceof XDomainRequest?this.sendXHR.onload=this.sendXHR.onerror=n:this.sendXHR.onreadystatechange=e,this.sendXHR.send(t)},n.prototype.close=function(){return this.onClose(),this},n.prototype.request=function(t){var o=e.util.request(this.socket.isXDomain()),n=e.util.query(this.socket.options.query,"t="+ +new Date);if(o.open(t||"GET",this.prepareUrl()+n,!0),"POST"==t)try{o.setRequestHeader?o.setRequestHeader("Content-type","text/plain;charset=UTF-8"):o.contentType="text/plain"}catch(i){}return o},n.prototype.scheme=function(){return this.socket.options.secure?"https":"http"},n.check=function(t,n){try{var i=e.util.request(n),r=o.XDomainRequest&&i instanceof XDomainRequest,s=t&&t.options&&t.options.secure?"https:":"http:",a=o.location&&s!=o.location.protocol;if(i&&(!r||!a))return!0}catch(c){}return!1},n.xdomainCheck=function(t){return n.check(t,!0)}}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports,this),function(t,e){function o(){e.Transport.XHR.apply(this,arguments)}t.htmlfile=o,e.util.inherit(o,e.Transport.XHR),o.prototype.name="htmlfile",o.prototype.get=function(){this.doc=new(window[["Active"].concat("Object").join("X")])("htmlfile"),this.doc.open(),this.doc.write("<html></html>"),this.doc.close(),this.doc.parentWindow.s=this;var t=this.doc.createElement("div");t.className="socketio",this.doc.body.appendChild(t),this.iframe=this.doc.createElement("iframe"),t.appendChild(this.iframe);var o=this,n=e.util.query(this.socket.options.query,"t="+ +new Date);this.iframe.src=this.prepareUrl()+n,e.util.on(window,"unload",function(){o.destroy()})},o.prototype._=function(t,e){this.onData(t);try{var o=e.getElementsByTagName("script")[0];o.parentNode.removeChild(o)}catch(n){}},o.prototype.destroy=function(){if(this.iframe){try{this.iframe.src="about:blank"}catch(t){}this.doc=null,this.iframe.parentNode.removeChild(this.iframe),this.iframe=null,CollectGarbage()}},o.prototype.close=function(){return this.destroy(),e.Transport.XHR.prototype.close.call(this)},o.check=function(t){if("undefined"!=typeof window&&["Active"].concat("Object").join("X")in window)try{var o=new(window[["Active"].concat("Object").join("X")])("htmlfile");return o&&e.Transport.XHR.check(t)}catch(n){}return!1},o.xdomainCheck=function(){return!1},e.transports.push("htmlfile")}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports),function(t,e,o){function n(){e.Transport.XHR.apply(this,arguments)}function i(){}t["xhr-polling"]=n,e.util.inherit(n,e.Transport.XHR),e.util.merge(n,e.Transport.XHR),n.prototype.name="xhr-polling",n.prototype.heartbeats=function(){return!1},n.prototype.open=function(){var t=this;return e.Transport.XHR.prototype.open.call(t),!1},n.prototype.get=function(){function t(){4==this.readyState&&(this.onreadystatechange=i,200==this.status?(r.onData(this.responseText),r.get()):r.onClose())}function e(){this.onload=i,this.onerror=i,r.retryCounter=1,r.onData(this.responseText),r.get()}function n(){r.retryCounter++,!r.retryCounter||r.retryCounter>3?r.onClose():r.get()}if(this.isOpen){var r=this;this.xhr=this.request(),o.XDomainRequest&&this.xhr instanceof XDomainRequest?(this.xhr.onload=e,this.xhr.onerror=n):this.xhr.onreadystatechange=t,this.xhr.send(null)}},n.prototype.onClose=function(){if(e.Transport.XHR.prototype.onClose.call(this),this.xhr){this.xhr.onreadystatechange=this.xhr.onload=this.xhr.onerror=i;try{this.xhr.abort()}catch(t){}this.xhr=null}},n.prototype.ready=function(t,o){var n=this;e.util.defer(function(){o.call(n)})},e.transports.push("xhr-polling")}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports,this),function(t,e,o){function n(){e.Transport["xhr-polling"].apply(this,arguments),this.index=e.j.length;var t=this;e.j.push(function(e){t._(e)})}var i=o.document&&"MozAppearance"in o.document.documentElement.style;t["jsonp-polling"]=n,e.util.inherit(n,e.Transport["xhr-polling"]),n.prototype.name="jsonp-polling",n.prototype.post=function(t){function o(){n(),i.socket.setBuffer(!1)}function n(){i.iframe&&i.form.removeChild(i.iframe);try{s=document.createElement('<iframe name="'+i.iframeId+'">')}catch(t){s=document.createElement("iframe"),s.name=i.iframeId}s.id=i.iframeId,i.form.appendChild(s),i.iframe=s}var i=this,r=e.util.query(this.socket.options.query,"t="+ +new Date+"&i="+this.index);if(!this.form){var s,a=document.createElement("form"),c=document.createElement("textarea"),p=this.iframeId="socketio_iframe_"+this.index;a.className="socketio",a.style.position="absolute",a.style.top="0px",a.style.left="0px",a.style.display="none",a.target=p,a.method="POST",a.setAttribute("accept-charset","utf-8"),c.name="d",a.appendChild(c),document.body.appendChild(a),this.form=a,this.area=c}this.form.action=this.prepareUrl()+r,n(),this.area.value=e.JSON.stringify(t);try{this.form.submit()}catch(u){}this.iframe.attachEvent?s.onreadystatechange=function(){"complete"==i.iframe.readyState&&o()}:this.iframe.onload=o,this.socket.setBuffer(!0)},n.prototype.get=function(){var t=this,o=document.createElement("script"),n=e.util.query(this.socket.options.query,"t="+ +new Date+"&i="+this.index);this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),o.async=!0,o.src=this.prepareUrl()+n,o.onerror=function(){t.onClose()};var r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(o,r),this.script=o,i&&setTimeout(function(){var t=document.createElement("iframe");document.body.appendChild(t),document.body.removeChild(t)},100)},n.prototype._=function(t){return this.onData(t),this.isOpen&&this.get(),this},n.prototype.ready=function(t,o){var n=this;return i?(e.util.load(function(){o.call(n)}),void 0):o.call(this)},n.check=function(){return"document"in o},n.xdomainCheck=function(){return!0},e.transports.push("jsonp-polling")}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports,this),"function"==typeof define&&define.amd&&define([],function(){return io})}();
{
"name": "simplewebrtc",
"version": "0.8.2",
"version": "0.8.3",
"repository": {

@@ -18,3 +18,3 @@ "type": "git",

"hark": "0.1.1",
"webrtc": "0.5.2",
"webrtc": "0.5.3",
"mockconsole": "0.0.1"

@@ -21,0 +21,0 @@ },

@@ -750,3 +750,4 @@ (function(e){if("function"==typeof bootstrap)bootstrap("simplewebrtc",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeSimpleWebRTC=e}else"undefined"!=typeof window?window.SimpleWebRTC=e():global.SimpleWebRTC=e()})(function(){var define,ses,bootstrap,module,exports;

video: true
}
},
detectSpeakingEvents: true
};

@@ -826,3 +827,3 @@ var item, connection;

if (!err) {
if (constraints.audio) {
if (constraints.audio && self.config.detectSpeakingEvents) {
self.setupAudioMonitor(stream);

@@ -832,7 +833,8 @@ }

self.gainController = new GainController(stream);
if (self.config.autoAdjustMic) {
self.gainController = new GainController(stream);
// start out somewhat muted if we can track audio
self.setMicIfEnabled(0.5);
}
// start out somewhat muted if we can track audio
self.setMicIfEnabled(0.5);
self.emit('localStream', stream);

@@ -1232,50 +1234,3 @@ }

},{"webrtcsupport":13,"wildemitter":3}],11:[function(require,module,exports){
var support = require('webrtcsupport');
function GainController(stream) {
this.support = support.webAudio && support.mediaStream;
// set our starting value
this.gain = 1;
if (this.support) {
var context = this.context = new support.AudioContext();
this.microphone = context.createMediaStreamSource(stream);
this.gainFilter = context.createGain();
this.destination = context.createMediaStreamDestination();
this.outputStream = this.destination.stream;
this.microphone.connect(this.gainFilter);
this.gainFilter.connect(this.destination);
stream.removeTrack(stream.getAudioTracks()[0]);
stream.addTrack(this.outputStream.getAudioTracks()[0]);
}
this.stream = stream;
}
// setting
GainController.prototype.setGain = function (val) {
// check for support
if (!this.support) return;
this.gainFilter.gain.value = val;
this.gain = val;
};
GainController.prototype.getGain = function () {
return this.gain;
};
GainController.prototype.off = function () {
return this.setGain(0);
};
GainController.prototype.on = function () {
this.setGain(1);
};
module.exports = GainController;
},{"webrtcsupport":4}],12:[function(require,module,exports){
},{"webrtcsupport":13,"wildemitter":3}],12:[function(require,module,exports){
var WildEmitter = require('wildemitter');

@@ -1373,4 +1328,51 @@

},{"wildemitter":3}]},{},[1])(1)
},{"wildemitter":3}],11:[function(require,module,exports){
var support = require('webrtcsupport');
function GainController(stream) {
this.support = support.webAudio && support.mediaStream;
// set our starting value
this.gain = 1;
if (this.support) {
var context = this.context = new support.AudioContext();
this.microphone = context.createMediaStreamSource(stream);
this.gainFilter = context.createGain();
this.destination = context.createMediaStreamDestination();
this.outputStream = this.destination.stream;
this.microphone.connect(this.gainFilter);
this.gainFilter.connect(this.destination);
stream.removeTrack(stream.getAudioTracks()[0]);
stream.addTrack(this.outputStream.getAudioTracks()[0]);
}
this.stream = stream;
}
// setting
GainController.prototype.setGain = function (val) {
// check for support
if (!this.support) return;
this.gainFilter.gain.value = val;
this.gain = val;
};
GainController.prototype.getGain = function () {
return this.gain;
};
GainController.prototype.off = function () {
return this.setGain(0);
};
GainController.prototype.on = function () {
this.setGain(1);
};
module.exports = GainController;
},{"webrtcsupport":4}]},{},[1])(1)
});
;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc