UNPKG

zdpjs_webrtc

Version:
2,492 lines (647 loc) 34.8 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: roomObj</h1> <section> <header> <h2> <span class="ancestors"><a href="pub.appObj.html">.appObj</a>.</span>roomObj</h2> </header> <article> <div class="container-overview"> <h4 class="name" id="roomObj"><span class="type-signature"></span>new roomObj<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> EasyRTC Room Object. Contains methods for handling a specific room including determining which connections have joined. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line2787">line 2787</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Members</h3> <h4 class="name" id=".roomObj.events"><span class="type-signature">(static) </span>roomObj.events<span class="type-signature"></span></h4> <div class="description"> Expose all event functions </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line2801">line 2801</a> </li></ul></dd> </dl> <h4 class="name" id=".roomObj.util"><span class="type-signature">(static) </span>roomObj.util<span class="type-signature"></span></h4> <div class="description"> Expose all utility functions </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line2809">line 2809</a> </li></ul></dd> </dl> <h3 class="subsection-title">Methods</h3> <h4 class="name" id=".roomObj.getApp"><span class="type-signature">(static) </span>roomObj.getApp<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4> <div class="description"> Returns the application object to which the room belongs. Note that unlike most EasyRTC functions, this returns a value and does not use a callback. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line2818">line 2818</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> The application object </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> <h4 class="name" id=".roomObj.getAppName"><span class="type-signature">(static) </span>roomObj.getAppName<span class="signature">()</span><span class="type-signature"> &rarr; {string}</span></h4> <div class="description"> Returns the application name for the application to which the room belongs. Note that unlike most EasyRTC functions, this returns a value and does not use a callback. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line2829">line 2829</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> The application name </div> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id=".roomObj.getConnectionCount"><span class="type-signature">(static) </span>roomObj.getConnectionCount<span class="signature">(callback)</span><span class="type-signature"></span></h4> <div class="description"> Sends the count of the number of connections in a room to a provided callback. </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>callback</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">Callback with error and array containing all easyrtcids.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line3090">line 3090</a> </li></ul></dd> </dl> <h4 class="name" id=".roomObj.getConnectionCountSync"><span class="type-signature">(static) </span>roomObj.getConnectionCountSync<span class="signature">()</span><span class="type-signature"> &rarr; {Number}</span></h4> <div class="description"> Sends the count of the number of connections in a room to a provided callback. Returns 0 if room doesn't exist. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line3106">line 3106</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> The current number of connections in a room. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Number</span> </dd> </dl> <h4 class="name" id=".roomObj.getConnectionObjects"><span class="type-signature">(static) </span>roomObj.getConnectionObjects<span class="signature">(callback)</span><span class="type-signature"></span></h4> <div class="description"> Returns an array containing the connectionObjs of all connected clients within the room. </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>callback</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">Callback with error and array containing connectionObjs.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line3170">line 3170</a> </li></ul></dd> </dl> <h4 class="name" id=".roomObj.getConnections"><span class="type-signature">(static) </span>roomObj.getConnections<span class="signature">(callback)</span><span class="type-signature"></span></h4> <div class="description"> Returns an array containing the easyrtcids of all connected clients within the room. </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>callback</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">Callback with error and array containing all easyrtcids.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line3121">line 3121</a> </li></ul></dd> </dl> <h4 class="name" id=".roomObj.getConnectionWithEasyrtcid"><span class="type-signature">(static) </span>roomObj.getConnectionWithEasyrtcid<span class="signature">(easyrtcid, callback)</span><span class="type-signature"></span></h4> <div class="description"> Returns the connectionObj for a given easyrtcid, but only if it is currently a client in the room </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">EasyRTC unique identifier for a socket connection.</td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">Callback with error and connectionObj.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line3142">line 3142</a> </li></ul></dd> </dl> <h4 class="name" id=".roomObj.getField"><span class="type-signature">(static) </span>roomObj.getField<span class="signature">(fieldName, callback)</span><span class="type-signature"></span></h4> <div class="description"> Returns room level field object for a given field name to a provided callback. </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>fieldName</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">Field name</td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">Callback with error and field object (any type)</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line2907">line 2907</a> </li></ul></dd> </dl> <h4 class="name" id=".roomObj.getFields"><span class="type-signature">(static) </span>roomObj.getFields<span class="signature">(limitToIsShared, callback)</span><span class="type-signature"></span></h4> <div class="description"> Returns an object containing all field names and values within the room. Can be limited to fields with isShared option set to 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>limitToIsShared</code></td> <td class="type"> <span class="param-type">boolean</span> </td> <td class="description last">Limits returned fields to those which have the isShared option set to true.</td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">Callback with error and object containing field names and values.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line2965">line 2965</a> </li></ul></dd> </dl> <h4 class="name" id=".roomObj.getFieldSync"><span class="type-signature">(static) </span>roomObj.getFieldSync<span class="signature">(fieldName)</span><span class="type-signature"> &rarr; {Object}</span></h4> <div class="description"> Returns room level field object for a given field name. If the field is not set, it will return a field value will a null field value. This is a synchronous function, thus may not be available in custom cases where state is not kept in memory. </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>fieldName</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">Field 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_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line2929">line 2929</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Field object </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> <h4 class="name" id=".roomObj.getFieldValueSync"><span class="type-signature">(static) </span>roomObj.getFieldValueSync<span class="signature">(fieldName)</span><span class="type-signature"> &rarr; (nullable) {*}</span></h4> <div class="description"> Returns room level field value for a given field name. If the field is not set, it will return a null field value. This is a synchronous function, thus may not be available in custom cases where state is not kept in memory. </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>fieldName</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">Field 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_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line2947">line 2947</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Field value </div> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id=".roomObj.getOption"><span class="type-signature">(static) </span>roomObj.getOption<span class="signature">(optionName)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> Gets individual option value. Will first check if option is defined for the room, else it will revert to the application level option (which will in turn fall back to the global level). </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>optionName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Option 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_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line2991">line 2991</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Option value (can be any type) </div> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id=".roomObj.getRoomName"><span class="type-signature">(static) </span>roomObj.getRoomName<span class="signature">()</span><span class="type-signature"> &rarr; {string}</span></h4> <div class="description"> Returns the room name for the current room. Note that unlike most EasyRTC functions, this returns a value and does not use a callback. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line2840">line 2840</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> The room name </div> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id=".roomObj.setField"><span class="type-signature">(static) </span>roomObj.setField<span class="signature">(fieldName, fieldValue, fieldOption<span class="signature-attributes">nullable</span>, next<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> <div class="description"> Sets room field value for a given field name. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fieldName</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> </td> <td class="description last">Must be formatted according to "fieldNameRegExp" option.</td> </tr> <tr> <td class="name"><code>fieldValue</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>fieldOption</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;nullable><br> </td> <td class="description last">Field options (such as isShared which defaults to false)</td> </tr> <tr> <td class="name"><code>next</code></td> <td class="type"> <span class="param-type">nextCallback</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">A success callback of form next(err). Possible err will be instanceof (ApplicationWarning).</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line3057">line 3057</a> </li></ul></dd> </dl> <h4 class="name" id=".roomObj.setOption"><span class="type-signature">(static) </span>roomObj.setOption<span class="signature">(optionName, optionValue)</span><span class="type-signature"> &rarr; {Boolean}</span></h4> <div class="description"> Sets individual option which applies only to this room. Set value to NULL to delete the option (thus reverting to global option) </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>optionName</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Option name</td> </tr> <tr> <td class="name"><code>optionValue</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Option value</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line3004">line 3004</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> true on success, false on failure </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> </article> </section> </div> <nav class="hide"><h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-easyrtc_default_event_listeners.html">easyrtc_default_event_listeners</a></li><li><a href="module-easyrtc_default_options.html">easyrtc_default_options</a></li><li><a href="module-easyrtc_private_obj.html">easyrtc_private_obj</a></li><li><a href="module-easyrtc_public_obj.html">easyrtc_public_obj</a></li><li><a href="module-easyrtc_util.html">easyrtc_util</a></li><li><a href="module-general_util.html">general_util</a></li></ul><h3>Classes</h3><ul><li><a href="module-easyrtc_default_event_listeners-eventListener.html">eventListener</a></li><li><a href="module-easyrtc_public_obj-pub.html">pub</a></li><li><a href="module-easyrtc_public_obj-pub.events.html">events</a></li><li><a href="module-easyrtc_public_obj-pub.util.html">util</a></li><li><a href="module-easyrtc_util-eu.html">eu</a></li><li><a href="module-general_util-g.html">g</a></li><li><a href="pub.appObj.html">appObj</a></li><li><a href="pub.appObj.connectionObj.html">connectionObj</a></li><li><a href="pub.appObj.connectionObj.connectionRoomObj.html">connectionRoomObj</a></li><li><a href="pub.appObj.roomObj.html">roomObj</a></li><li><a href="pub.appObj.sessionObj.html">sessionObj</a></li></ul></nav> </div> </div> <footer class="template"> <div class="wrapper-content"> <p>Copyright &copy;2016 EasyRTC</p> </div> </footer> <!-- <script>prettyPrint();</script> --> <!-- <script src="scripts/linenumber.js"></script> --> </body> </html>