UNPKG

zdpjs_webrtc

Version:
3,688 lines (927 loc) 219 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>EasyRTC Documentation</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> <link href="../assets/easyrtc-docs-jsdoc-styles-1.css" media="all" rel="stylesheet" /> </head> <body> <header class="template"> <div class="wrapper-content"> <a href="../index.html"><img src="../assets/easyrtc-logo.png" alt="EasyRTC Documentation"></a> <h1 title="EasyRTC Documentation">Documentation</h1> </div> </header> <div class="wrapper-docs"> <nav> <h2><a href="../index.html">Docs Home</a></h2> <h3>EasyRTC Guides</h3> <ul> <li><a href="../easyrtc_faq.html">FAQ</a></li> <li><a href="../easyrtc_gettingStarted.html">Getting Started</a></li> <li><a href="../easyrtc_server_install.html">EasyRTC Server: Installation</a></li> <li><a href="../easyrtc_client_tutorial.html">EasyRTC Framework Tutorial</a></li> <li><a href="../easyrtc_rooms.html">Rooms</a></li> <li><a href="../easyrtc_server_configuration.html">EasyRTC Server: Configuration</a></li> <li><a href="../easyrtc_server_events.html">EasyRTC Server: Events</a></li> <li><a href="../easyrtc_server_ice.html">EasyRTC Server: ICE Configuration</a></li> <li><a href="../easyrtc_with_other_servers.html">Using Alongside Other Servers</a></li> <li><a href="../easyrtc_server_ssl.html">EasyRTC Server: Using SSL</a></li> <li><a href="../easyrtc_webrtc_problems.html">WebRTC Problems and Possible Fixes</a></li> <li><a href="../easyrtc_upcoming_features.html">Upcoming Features</a></li> <li><a href="../easyrtc_changelog.html">Change Log</a></li> </ul> <h3>EasyRTC Client Classes</h3> <ul> <li><a href="../client-api/Easyrtc.html">Easyrtc</a></li> <li><a href="../client-api/Easyrtc_App.html">Easyrtc_App</a></li> <li><a href="../client-api/Easyrtc_ft.html">Easyrtc_ft</a></li> <li><a href="../client-api/Easyrtc_IframeCapture.html">Easyrtc_IframeCapture</a></li> <li><a href="../client-api/Easyrtc_No_IframeCapture.html">Easyrtc_No_IframeCapture</a></li> <li><a href="../client-api/Easyrtc_Rates.html">Easyrtc_Rates</a></li> <li><a href="../client-api/Easyrtc_Recorder.html">Easyrtc_Recorder</a></li> </ul> <h3>EasyRTC Server Modules</h3> <ul> <li><a href="../server-api/module-easyrtc_default_event_listeners.html">easyrtc_default_event_listeners</a></li> <li><a href="../server-api/module-easyrtc_default_options.html">easyrtc_default_options</a></li> <li><a href="../server-api/module-easyrtc_private_obj.html">easyrtc_private_obj</a></li> <li><a href="../server-api/module-easyrtc_public_obj.html">easyrtc_public_obj</a></li> <li><a href="../server-api/module-easyrtc_util.html">easyrtc_util</a></li> <li><a href="../server-api/module-general_util.html">general_util</a></li> </ul> <h3>EasyRTC Server Classes</h3> <ul> <li><a href="../server-api/module-easyrtc_default_event_listeners-eventListener.html">eventListener</a></li> <li><a href="../server-api/module-easyrtc_public_obj-pub.html">pub</a></li> <li><a href="../server-api/module-easyrtc_public_obj-pub.events.html">events</a></li> <li><a href="../server-api/module-easyrtc_public_obj-pub.util.html">util</a></li> <li><a href="../server-api/module-easyrtc_util-eu.html">eu</a></li> <li><a href="../server-api/module-general_util-g.html">g</a></li> <li><a href="../server-api/pub.appObj.html">appObj</a></li> <li><a href="../server-api/pub.appObj.connectionObj.html">connectionObj</a></li> <li><a href="../server-api/pub.appObj.connectionObj.connectionRoomObj.html">connectionRoomObj</a></li> <li><a href="../server-api/pub.appObj.roomObj.html">roomObj</a></li> <li><a href="../server-api/pub.appObj.sessionObj.html">sessionObj</a></li> </ul> </nav> <div class="easyrtc-docs-content"> <div id="main"> <h1 class="page-title">Class: Easyrtc</h1> <section> <header> <h2>Easyrtc</h2> <div class="class-description">Easyrtc.</div> </header> <article> <div class="container-overview"> <h2>Constructor</h2> <h4 class="name" id="Easyrtc"><span class="type-signature"></span>new Easyrtc<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="Easyrtc.html">Easyrtc</a>}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line60">line 60</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> the new easyrtc instance. </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Easyrtc.html">Easyrtc</a></span> </dd> </dl> </div> <h3 class="subsection-title">Members</h3> <h4 class="name" id="ackMessage"><span class="type-signature"></span>ackMessage<span class="type-signature"></span></h4> <div class="description"> Most basic message acknowledgment object </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line394">line 394</a> </li></ul></dd> </dl> <h4 class="name" id="BECOMING_CONNECTED"><span class="type-signature"></span>BECOMING_CONNECTED<span class="type-signature"></span></h4> <div class="description"> Value returned by easyrtc.getConnectStatus if the other user is in the process of getting connected </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line3174">line 3174</a> </li></ul></dd> </dl> <h4 class="name" id="closeLocalStream"><span class="type-signature"></span>closeLocalStream<span class="type-signature"></span></h4> <div class="description"> Alias for closeLocalMediaStream </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line1815">line 1815</a> </li></ul></dd> </dl> <h4 class="name" id="cookieId"><span class="type-signature"></span>cookieId<span class="type-signature"></span></h4> <div class="description"> Default cookieId name </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line400">line 400</a> </li></ul></dd> </dl> <h4 class="name" id="errCodes"><span class="type-signature"></span>errCodes<span class="type-signature"> :Object</span></h4> <div class="description"> Error codes that the EasyRTC will use in the errorCode field of error object passed to error handler set by easyrtc.setOnError. The error codes are short printable strings. </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Object</span> </li> </ul> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line374">line 374</a> </li></ul></dd> </dl> <h4 class="name" id="IS_CONNECTED"><span class="type-signature"></span>IS_CONNECTED<span class="type-signature"></span></h4> <div class="description"> Value returned by easyrtc.getConnectStatus if the other user is connected to us. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line3177">line 3177</a> </li></ul></dd> </dl> <h4 class="name" id="loggingOut"><span class="type-signature"></span>loggingOut<span class="type-signature"></span></h4> <div class="description"> Flag to indicate that user is currently logging out </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line406">line 406</a> </li></ul></dd> </dl> <h4 class="name" id="maxP2PMessageLength"><span class="type-signature"></span>maxP2PMessageLength<span class="type-signature"></span></h4> <div class="description"> This constant determines how long (in bytes) a message can be before being split in chunks of that size. This is because there is a limitation of the length of the message you can send on the data channel between browsers. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line583">line 583</a> </li></ul></dd> </dl> <h4 class="name" id="myEasyrtcid"><span class="type-signature"></span>myEasyrtcid<span class="type-signature"></span></h4> <div class="description"> Your easyrtcid </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line570">line 570</a> </li></ul></dd> </dl> <h4 class="name" id="nativeVideoHeight"><span class="type-signature"></span>nativeVideoHeight<span class="type-signature"></span></h4> <div class="description"> The height of the local media stream video in pixels. This field is set an indeterminate period of time after easyrtc.initMediaSource succeeds. Note: in actuality, the dimensions of a video stream change dynamically in response to external factors, you should check the videoWidth and videoHeight attributes of your video objects before you use them for pixel specific operations. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line577">line 577</a> </li></ul></dd> </dl> <h4 class="name" id="nativeVideoWidth"><span class="type-signature"></span>nativeVideoWidth<span class="type-signature"></span></h4> <div class="description"> The width of the local media stream video in pixels. This field is set an indeterminate period of time after easyrtc.initMediaSource succeeds. Note: in actuality, the dimensions of a video stream change dynamically in response to external factors, you should check the videoWidth and videoHeight attributes of your video objects before you use them for pixel specific operations. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line590">line 590</a> </li></ul></dd> </dl> <h4 class="name" id="NOT_CONNECTED"><span class="type-signature"></span>NOT_CONNECTED<span class="type-signature"></span></h4> <div class="description"> Value returned by easyrtc.getConnectStatus if the other user isn't connected to us. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line3171">line 3171</a> </li></ul></dd> </dl> <h4 class="name" id="roomJoin"><span class="type-signature"></span>roomJoin<span class="type-signature"></span></h4> <div class="description"> The rooms the user is in. This only applies to room oriented applications and is set at the same time a token is received. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line595">line 595</a> </li></ul></dd> </dl> <h4 class="name" id="usernameRegExp"><span class="type-signature"></span>usernameRegExp<span class="type-signature"></span></h4> <div class="description"> Regular expression pattern for user ids. This will need modification to support non US character sets </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line397">line 397</a> </li></ul></dd> </dl> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="addEventListener"><span class="type-signature"></span>addEventListener<span class="signature">(eventName, eventListener)</span><span class="type-signature"> &rarr; {void}</span></h4> <div class="description"> Adds an event listener for a particular type of event. Currently the only eventName supported is "roomOccupant". </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>eventName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">the type of the event</td> </tr> <tr> <td class="name"><code>eventListener</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">the function that expects the event. The eventListener gets called with the eventName as it's first argument, and the event data as it's second argument.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line315">line 315</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">void</span> </dd> </dl> <h4 class="name" id="addStreamToCall"><span class="type-signature"></span>addStreamToCall<span class="signature">(easyrtcId, streamName, receiptHandler)</span><span class="type-signature"></span></h4> <div class="description"> Add a named local stream to a call. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>easyrtcId</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The id of client receiving the stream.</td> </tr> <tr> <td class="name"><code>streamName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The name of the stream.</td> </tr> <tr> <td class="name"><code>receiptHandler</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">is a function that gets called when the other side sends a message that the stream has been received. The receiptHandler gets called with an easyrtcid and a stream name. This argument is optional.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line4375">line 4375</a> </li></ul></dd> </dl> <h4 class="name" id="buildLocalMediaStream"><span class="type-signature"></span>buildLocalMediaStream<span class="signature">(streamName, audioTracks, videoTracks)</span><span class="type-signature"> &rarr; (nullable) {MediaStream}</span></h4> <div class="description"> This function builds a new named local media stream from a set of existing audio and video tracks from other media streams. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>streamName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">is the name of the new media stream.</td> </tr> <tr> <td class="name"><code>audioTracks</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="description last">is an array of MediaStreamTracks</td> </tr> <tr> <td class="name"><code>videoTracks</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="description last">is an array of MediaStreamTracks</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line1959">line 1959</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> the track created. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">MediaStream</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>easyrtc.buildLocalMediaStream("myComposedStream", easyrtc.getLocalStream("camera1").getVideoTracks(), easyrtc.getLocalStream("camera2").getAudioTracks());</code></pre> <h4 class="name" id="call"><span class="type-signature"></span>call<span class="signature">(otherUser, callSuccessCB, callFailureCB, wasAcceptedCB, streamNames)</span><span class="type-signature"></span></h4> <div class="description"> Initiates a call to another user. If it succeeds, the streamAcceptor callback will be called. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>otherUser</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">the easyrtcid of the peer being called.</td> </tr> <tr> <td class="name"><code>callSuccessCB</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">(otherCaller, mediaType) - is called when the datachannel is established or the MediaStream is established. mediaType will have a value of "audiovideo" or "datachannel"</td> </tr> <tr> <td class="name"><code>callFailureCB</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">(errorCode, errMessage) - is called if there was a system error interfering with the call.</td> </tr> <tr> <td class="name"><code>wasAcceptedCB</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">(wasAccepted:boolean,otherUser:string) - is called when a call is accepted or rejected by another party. It can be left null.</td> </tr> <tr> <td class="name"><code>streamNames</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="description last">optional array of streamNames.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line4104">line 4104</a> </li></ul></dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>easyrtc.call( otherEasyrtcid, function(easyrtcid, mediaType){ console.log("Got mediaType " + mediaType + " from " + easyrtc.idToName(easyrtcid)); }, function(errorCode, errMessage){ console.log("call to " + easyrtc.idToName(otherEasyrtcid) + " failed:" + errMessage); }, function(wasAccepted, easyrtcid){ if( wasAccepted ){ console.log("call accepted by " + easyrtc.idToName(easyrtcid)); } else{ console.log("call rejected" + easyrtc.idToName(easyrtcid)); } });</code></pre> <h4 class="name" id="cleanId"><span class="type-signature"></span>cleanId<span class="signature">(idString)</span><span class="type-signature"> &rarr; {String}</span></h4> <div class="description"> A convenience function to ensure that a string doesn't have symbols that will be interpreted by HTML. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>idString</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line1488">line 1488</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> The cleaned string. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>console.log( easyrtc.cleanId('&amp;hello'));</code></pre> <h4 class="name" id="clearMediaStream"><span class="type-signature"></span>clearMediaStream<span class="signature">(element)</span><span class="type-signature"></span></h4> <div class="description"> Clears the media stream on a video object. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>element</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">the video object.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line1904">line 1904</a> </li></ul></dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>easyrtc.clearMediaStream( document.getElementById('selfVideo'));</code></pre> <h4 class="name" id="closeLocalMediaStream"><span class="type-signature"></span>closeLocalMediaStream<span class="signature">(streamName)</span><span class="type-signature"></span></h4> <div class="description"> Close the local media stream. You usually need to close the existing media stream of a camera before reacquiring it at a different resolution. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>streamName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">an option stream name.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line1808">line 1808</a> </li></ul></dd> </dl> <h4 class="name" id="connect"><span class="type-signature"></span>connect<span class="signature">(applicationName, successCallback, errorCallback)</span><span class="type-signature"></span></h4> <div class="description"> Connects to the EasyRTC signaling server. You must connect before trying to call other users. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>applicationName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">is a string that identifies the application so that different applications can have different lists of users. Note that the server configuration specifies a regular expression that is used to check application names for validity. The default pattern is that of an identifier, spaces are not allowed.</td> </tr> <tr> <td class="name"><code>successCallback</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">(easyrtcId, roomOwner) - is called on successful connect. easyrtcId is the unique name that the client is known to the server by. A client usually only needs it's own easyrtcId for debugging purposes. roomOwner is true if the user is the owner of a room. It's value is random if the user is in multiple rooms.</td> </tr> <tr> <td class="name"><code>errorCallback</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">(errorCode, errorText) - is called on unsuccessful connect. if null, an alert is called instead. The errorCode takes it's value from easyrtc.errCodes.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line5612">line 5612</a> </li></ul></dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>easyrtc.connect("my_chat_app", function(easyrtcid, roomOwner){ if( roomOwner){ console.log("I'm the room owner"); } console.log("my id is " + easyrtcid); }, function(errorText){ console.log("failed to connect ", erFrText); });</code></pre> <h4 class="name" id="disconnect"><span class="type-signature"></span>disconnect<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Disconnect from the EasyRTC server. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line2819">line 2819</a> </li></ul></dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>easyrtc.disconnect();</code></pre> <h4 class="name" id="doesDataChannelWork"><span class="type-signature"></span>doesDataChannelWork<span class="signature">(otherUser)</span><span class="type-signature"> &rarr; {Boolean}</span></h4> <div class="description"> Checks to see if data channels work between two peers. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>otherUser</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">the other peer.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line4318">line 4318</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> true if data channels work and are ready to be used between the two peers. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> <h4 class="name" id="emitEvent"><span class="type-signature"></span>emitEvent<span class="signature">(eventName, eventData)</span><span class="type-signature"></span></h4> <div class="description"> Emits an event, or in other words, calls all the eventListeners for a particular event. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>eventName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>eventData</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line358">line 358</a> </li></ul></dd> </dl> <h4 class="name" id="enableAudio"><span class="type-signature"></span>enableAudio<span class="signature">(enabled)</span><span class="type-signature"></span></h4> <div class="description"> Sets whether audio is transmitted by the local user in any subsequent calls. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>enabled</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last">true to include audio, false to exclude audio. The default is true.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line1592">line 1592</a> </li></ul></dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>easyrtc.enableAudio(false);</code></pre> <h4 class="name" id="enableAudioReceive"><span class="type-signature"></span>enableAudioReceive<span class="signature">(value)</span><span class="type-signature"></span></h4> <div class="description"> Control whether the client requests audio from a peer during a call. Must be called before the call to have an effect. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>value</code></td> <td class="type"> </td> <td class="description last">true to receive audio, false otherwise. The default is true.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line428">line 428</a> </li></ul></dd> </dl> <h4 class="name" id="enableCamera"><span class="type-signature"></span>enableCamera<span class="signature">(enable, streamName)</span><span class="type-signature"></span></h4> <div class="description"> This function is used to enable and disable the local camera. If you disable the camera, video objects display it will "freeze" until the camera is re-enabled. * By default, a camera is enabled. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>enable</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last">true to enable the camera, false to disable it.</td> </tr> <tr> <td class="name"><code>streamName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">the name of the stream, optional.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line1824">line 1824</a> </li></ul></dd> </dl> <h4 class="name" id="enableDataChannels"><span class="type-signature"></span>enableDataChannels<span class="signature">(enabled)</span><span class="type-signature"></span></h4> <div class="description"> Sets whether WebRTC data channels are used to send inter-client messages. This is only the messages that applications explicitly send to other applications, not the WebRTC signaling messages. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>enabled</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last">true to use data channels, false otherwise. The default is false.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line1613">line 1613</a> </li></ul></dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>easyrtc.enableDataChannels(true);</code></pre> <h4 class="name" id="enableDebug"><span class="type-signature"></span>enableDebug<span class="signature">(enable)</span><span class="type-signature"></span></h4> <div class="description"> Enable or disable logging to the console. Note: if you want to control the printing of debug messages, override the easyrtc.debugPrinter variable with a function that takes a message string as it's argument. This is exactly what easyrtc.enableDebug does when it's enable argument is true. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>enable</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last">true to turn on debugging, false to turn off debugging. Default is false.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_int.js.html">easyrtc_int.js</a>, <a href="easyrtc_int.js.html#line810">line 810</a> </li></ul></dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>easyrtc.enableDebug(true);</code></pre> <h4 class="name" id="enableMicrophone"><span class="type-signature"></span>enableMicrophone<span class="signature">(enable, streamName)</span><span class="type-signature"></span></h4> <div class="description"> This function is used to enable and disable the local microphone. If you disable the microphone, sounds stops being transmitted to your peers. By default, the microphone is enabled. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>enable</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td clas