CloudflareCallDoc / CloudflareCalls.html
manhteky123's picture
Upload 58 files
a8c4cef verified
<!DOCTYPE html>
<html lang="en">
<!-- Mirrored from cloudflarecalls.jamesfuthey.com/docs/CloudflareCalls.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 19 Feb 2025 14:59:44 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8" /><!-- /Added by HTTrack -->
<head>
<meta charset="utf-8">
<title>CloudflareCalls - 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.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
<script src="scripts/nav.js" defer></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav >
<h2><a href="index-2.html">Home</a></h2><h3>Classes</h3><ul><li><a href="CloudflareCalls.html">CloudflareCalls</a><ul class='methods'><li data-type='method'><a href="CloudflareCalls.html#createRoom">createRoom</a></li><li data-type='method'><a href="CloudflareCalls.html#getAvailableDevices">getAvailableDevices</a></li><li data-type='method'><a href="CloudflareCalls.html#getConnectionStats">getConnectionStats</a></li><li data-type='method'><a href="CloudflareCalls.html#getSessionState">getSessionState</a></li><li data-type='method'><a href="CloudflareCalls.html#getTrackStatus">getTrackStatus</a></li><li data-type='method'><a href="CloudflareCalls.html#getUserInfo">getUserInfo</a></li><li data-type='method'><a href="CloudflareCalls.html#getUserMetadata">getUserMetadata</a></li><li data-type='method'><a href="CloudflareCalls.html#joinRoom">joinRoom</a></li><li data-type='method'><a href="CloudflareCalls.html#leaveRoom">leaveRoom</a></li><li data-type='method'><a href="CloudflareCalls.html#listParticipants">listParticipants</a></li><li data-type='method'><a href="CloudflareCalls.html#listRooms">listRooms</a></li><li data-type='method'><a href="CloudflareCalls.html#onConnectionStats">onConnectionStats</a></li><li data-type='method'><a href="CloudflareCalls.html#onDataMessage">onDataMessage</a></li><li data-type='method'><a href="CloudflareCalls.html#onParticipantJoined">onParticipantJoined</a></li><li data-type='method'><a href="CloudflareCalls.html#onParticipantLeft">onParticipantLeft</a></li><li data-type='method'><a href="CloudflareCalls.html#onRemoteTrack">onRemoteTrack</a></li><li data-type='method'><a href="CloudflareCalls.html#onRemoteTrackUnpublished">onRemoteTrackUnpublished</a></li><li data-type='method'><a href="CloudflareCalls.html#onRoomMetadataUpdated">onRoomMetadataUpdated</a></li><li data-type='method'><a href="CloudflareCalls.html#onTrackStatusChanged">onTrackStatusChanged</a></li><li data-type='method'><a href="CloudflareCalls.html#onWebSocketMessage">onWebSocketMessage</a></li><li data-type='method'><a href="CloudflareCalls.html#previewMedia">previewMedia</a></li><li data-type='method'><a href="CloudflareCalls.html#publishTracks">publishTracks</a></li><li data-type='method'><a href="CloudflareCalls.html#selectAudioInputDevice">selectAudioInputDevice</a></li><li data-type='method'><a href="CloudflareCalls.html#selectAudioOutputDevice">selectAudioOutputDevice</a></li><li data-type='method'><a href="CloudflareCalls.html#selectVideoInputDevice">selectVideoInputDevice</a></li><li data-type='method'><a href="CloudflareCalls.html#sendDataToAll">sendDataToAll</a></li><li data-type='method'><a href="CloudflareCalls.html#setDebugMode">setDebugMode</a></li><li data-type='method'><a href="CloudflareCalls.html#setMediaQuality">setMediaQuality</a></li><li data-type='method'><a href="CloudflareCalls.html#setToken">setToken</a></li><li data-type='method'><a href="CloudflareCalls.html#setUserMetadata">setUserMetadata</a></li><li data-type='method'><a href="CloudflareCalls.html#shareScreen">shareScreen</a></li><li data-type='method'><a href="CloudflareCalls.html#startStatsMonitoring">startStatsMonitoring</a></li><li data-type='method'><a href="CloudflareCalls.html#stopStatsMonitoring">stopStatsMonitoring</a></li><li data-type='method'><a href="CloudflareCalls.html#toggleMedia">toggleMedia</a></li><li data-type='method'><a href="CloudflareCalls.html#unpublishAllTracks">unpublishAllTracks</a></li><li data-type='method'><a href="CloudflareCalls.html#updatePublishedTracks">updatePublishedTracks</a></li><li data-type='method'><a href="CloudflareCalls.html#updateRoomMetadata">updateRoomMetadata</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#broadcastToRoom">broadcastToRoom</a></li><li><a href="global.html#getRoomIdByUserId">getRoomIdByUserId</a></li><li><a href="global.html#getWebSocketByUserId">getWebSocketByUserId</a></li><li><a href="global.html#handleDataMessage">handleDataMessage</a></li><li><a href="global.html#handleWSDisconnect">handleWSDisconnect</a></li><li><a href="global.html#handleWSJoin">handleWSJoin</a></li><li><a href="global.html#rooms">rooms</a></li><li><a href="global.html#server">server</a></li></ul>
</nav>
<div id="main">
<h1 class="page-title">CloudflareCalls</h1>
<section>
<header>
<h2>
CloudflareCalls
</h2>
<div class="class-description usertext">Represents the CloudflareCalls library for managing real-time communications.</div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="CloudflareCalls"><span class="type-signature"></span>new CloudflareCalls<span class="signature">(config)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Creates an instance of CloudflareCalls.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line11">line 11</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">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>config</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Configuration object.
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>backendUrl</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The backend server URL.</td>
</tr>
<tr>
<td class="name"><code>websocketUrl</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The WebSocket server URL.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="QUALITY_PRESETS"><span class="type-signature"></span>QUALITY_PRESETS<span class="type-signature"> :Object.&lt;string, <a href="global.html#QualityPreset">QualityPreset</a>></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line118">line 118</a>
</li></ul></dd>
</dl>
<h5 class="h5-types">Type:</h5>
<ul>
<li>
<span class="param-type">Object.&lt;string, <a href="global.html#QualityPreset">QualityPreset</a>></span>
</li>
</ul>
<h4 class="name" id="pendingQualitySettings"><span class="type-signature"></span>pendingQualitySettings<span class="type-signature"> :<a href="global.html#QualityPreset">QualityPreset</a></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line113">line 113</a>
</li></ul></dd>
</dl>
<h5 class="h5-types">Type:</h5>
<ul>
<li>
<span class="param-type"><a href="global.html#QualityPreset">QualityPreset</a></span>
</li>
</ul>
<h4 class="name" id="statsMonitoringState"><span class="type-signature"></span>statsMonitoringState<span class="type-signature"> :'stopped'|'monitoring'</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line125">line 125</a>
</li></ul></dd>
</dl>
<h5 class="h5-types">Type:</h5>
<ul>
<li>
<span class="param-type">'stopped'</span>
|
<span class="param-type">'monitoring'</span>
</li>
</ul>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="createRoom"><span class="type-signature type-signature-async">(async) </span>createRoom<span class="signature">(options)</span><span class="type-signature"> &rarr; {Promise.&lt;Object>}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Creates a new room with optional metadata.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line342">line 342</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">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>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Room creation options
<h6>Properties</h6>
<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>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">Room name</td>
</tr>
<tr>
<td class="name"><code>metadata</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">Room metadata</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<h5 class="h5-returns">Returns:</h5>
<div class="param-desc">
Created room information including roomId, name, metadata, etc.
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Object></span>
</dd>
</dl>
<h4 class="name" id="getAvailableDevices"><span class="type-signature type-signature-async">(async) </span>getAvailableDevices<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;Object>}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Retrieves the list of available media devices.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line1044">line 1044</a>
</li></ul></dd>
</dl>
<h5 class="h5-returns">Returns:</h5>
<div class="param-desc">
An object containing arrays of audio input, video input, and audio output devices.
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Object></span>
</dd>
</dl>
<h4 class="name" id="getConnectionStats"><span class="type-signature type-signature-async">(async) </span>getConnectionStats<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;<a href="global.html#ConnectionStats">ConnectionStats</a>>}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Get a snapshot of current connection statistics</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line1849">line 1849</a>
</li></ul></dd>
</dl>
<h5 class="h5-returns">Returns:</h5>
<div class="param-desc">
Current connection statistics
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;<a href="global.html#ConnectionStats">ConnectionStats</a>></span>
</dd>
</dl>
<h4 class="name" id="getSessionState"><span class="type-signature type-signature-async">(async) </span>getSessionState<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;Object>}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Gets the session state</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line1393">line 1393</a>
</li></ul></dd>
</dl>
<h5 class="h5-returns">Returns:</h5>
<div class="param-desc">
The session state
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Object></span>
</dd>
</dl>
<h4 class="name" id="getTrackStatus"><span class="type-signature type-signature-async">(async) </span>getTrackStatus<span class="signature">(trackName)</span><span class="type-signature"> &rarr; {Promise.&lt;string>}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Gets the track status</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line1422">line 1422</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">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>trackName</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The track name</td>
</tr>
</tbody>
</table>
<h5 class="h5-returns">Returns:</h5>
<div class="param-desc">
The track status
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;string></span>
</dd>
</dl>
<h4 class="name" id="getUserInfo"><span class="type-signature type-signature-async">(async) </span>getUserInfo<span class="signature">(userId<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;Object>}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Gets information about a user</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line1492">line 1492</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>userId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
<code>null</code>
</td>
<td class="description last">Optional user ID. If omitted, returns current user's info</td>
</tr>
</tbody>
</table>
<h5 class="h5-returns">Returns:</h5>
<div class="param-desc">
User information including moderator status
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Object></span>
</dd>
</dl>
<h4 class="name" id="getUserMetadata"><span class="type-signature"></span>getUserMetadata<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Retrieves the current user metadata.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line295">line 295</a>
</li></ul></dd>
</dl>
<h5 class="h5-returns">Returns:</h5>
<div class="param-desc">
The user metadata.
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
<h4 class="name" id="joinRoom"><span class="type-signature type-signature-async">(async) </span>joinRoom<span class="signature">(roomId, metadata<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;void>}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Joins an existing room.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line363">line 363</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>roomId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">The ID of the room to join.</td>
</tr>
<tr>
<td class="name"><code>metadata</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
<code>{}</code>
</td>
<td class="description last">Optional metadata for the user.</td>
</tr>
</tbody>
</table>
<h5 class="h5-returns">Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;void></span>
</dd>
</dl>
<h4 class="name" id="leaveRoom"><span class="type-signature type-signature-async">(async) </span>leaveRoom<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;void>}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Leaves the current room and cleans up connections.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line437">line 437</a>
</li></ul></dd>
</dl>
<h5 class="h5-returns">Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;void></span>
</dd>
</dl>
<h4 class="name" id="listParticipants"><span class="type-signature type-signature-async">(async) </span>listParticipants<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;Array.&lt;Object>>}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Lists all participants currently in the room.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line1289">line 1289</a>
</li></ul></dd>
</dl>
<h5 class="h5-throws">Throws:</h5>
<dl>
<dt>
<div class="param-desc usertext">
If not connected to any room.
</div>
</dt>
<dd></dd>
<dt>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Error</span>
</dd>
</dl>
</dt>
<dd></dd>
</dl>
<h5 class="h5-returns">Returns:</h5>
<div class="param-desc">
An array of participant objects.
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Array.&lt;Object>></span>
</dd>
</dl>
<h4 class="name" id="listRooms"><span class="type-signature type-signature-async">(async) </span>listRooms<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;Array>}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Lists all available rooms.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line1598">line 1598</a>
</li></ul></dd>
</dl>
<h5 class="h5-returns">Returns:</h5>
<div class="param-desc">
List of rooms
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Array></span>
</dd>
</dl>
<h4 class="name" id="onConnectionStats"><span class="type-signature"></span>onConnectionStats<span class="signature">(callback)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Register a callback to receive connection statistics</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line1754">line 1754</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">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">Function to receive stats updates</td>
</tr>
</tbody>
</table>
<h4 class="name" id="onDataMessage"><span class="type-signature"></span>onDataMessage<span class="signature">(callback)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Registers a callback for incoming data messages.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line224">line 224</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">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">The callback function to handle data messages.</td>
</tr>
</tbody>
</table>
<h4 class="name" id="onParticipantJoined"><span class="type-signature"></span>onParticipantJoined<span class="signature">(callback)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Registers a callback for participant joined events.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line232">line 232</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">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">The callback function to handle participant joins.</td>
</tr>
</tbody>
</table>
<h4 class="name" id="onParticipantLeft"><span class="type-signature"></span>onParticipantLeft<span class="signature">(callback)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Registers a callback for participant left events.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line240">line 240</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">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">The callback function to handle participant departures.</td>
</tr>
</tbody>
</table>
<h4 class="name" id="onRemoteTrack"><span class="type-signature"></span>onRemoteTrack<span class="signature">(callback)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Registers a callback for remote track events.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line208">line 208</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">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">The callback function to handle remote tracks.</td>
</tr>
</tbody>
</table>
<h4 class="name" id="onRemoteTrackUnpublished"><span class="type-signature"></span>onRemoteTrackUnpublished<span class="signature">(callback)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Registers a callback for remote track unpublished events.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line216">line 216</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">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">The callback function to handle track unpublished events.</td>
</tr>
</tbody>
</table>
<h4 class="name" id="onRoomMetadataUpdated"><span class="type-signature"></span>onRoomMetadataUpdated<span class="signature">(callback)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Register callback for room metadata updates</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line278">line 278</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">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 function</td>
</tr>
</tbody>
</table>
<h4 class="name" id="onTrackStatusChanged"><span class="type-signature"></span>onTrackStatusChanged<span class="signature">(callback)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Registers a callback for track status changed events.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line248">line 248</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">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">The callback function to handle track status changes.</td>
</tr>
</tbody>
</table>
<h4 class="name" id="onWebSocketMessage"><span class="type-signature"></span>onWebSocketMessage<span class="signature">(callback)</span><span class="type-signature"> &rarr; {function}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Registers a callback for WebSocket messages</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line257">line 257</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">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">Function to call when WebSocket messages are received</td>
</tr>
</tbody>
</table>
<h5 class="h5-returns">Returns:</h5>
<div class="param-desc">
Function to unregister the callback
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">function</span>
</dd>
</dl>
<h4 class="name" id="previewMedia"><span class="type-signature type-signature-async">(async) </span>previewMedia<span class="signature">(params, previewElement<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;MediaStream>}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Previews media streams with specified device IDs.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line1163">line 1163</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>params</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">Parameters for media preview.
<h6>Properties</h6>
<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>audioDeviceId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">The ID of the audio input device to use.</td>
</tr>
<tr>
<td class="name"><code>videoDeviceId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">The ID of the video input device to use.</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="name"><code>previewElement</code></td>
<td class="type">
<span class="param-type">HTMLMediaElement</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
<code>null</code>
</td>
<td class="description last">The media element to display the preview.</td>
</tr>
</tbody>
</table>
<h5 class="h5-throws">Throws:</h5>
<dl>
<dt>
<div class="param-desc usertext">
If there is an issue accessing the media devices.
</div>
</dt>
<dd></dd>
<dt>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Error</span>
</dd>
</dl>
</dt>
<dd></dd>
</dl>
<h5 class="h5-returns">Returns:</h5>
<div class="param-desc">
The media stream being previewed.
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;MediaStream></span>
</dd>
</dl>
<h4 class="name" id="publishTracks"><span class="type-signature type-signature-async">(async) </span>publishTracks<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;void>}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Publishes the local media tracks to the room.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line491">line 491</a>
</li></ul></dd>
</dl>
<h5 class="h5-throws">Throws:</h5>
<dl>
<dt>
<div class="param-desc usertext">
If there is no local media stream to publish.
</div>
</dt>
<dd></dd>
<dt>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Error</span>
</dd>
</dl>
</dt>
<dd></dd>
</dl>
<h5 class="h5-returns">Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;void></span>
</dd>
</dl>
<h4 class="name" id="selectAudioInputDevice"><span class="type-signature type-signature-async">(async) </span>selectAudioInputDevice<span class="signature">(deviceId)</span><span class="type-signature"> &rarr; {Promise.&lt;void>}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Selects a specific audio input device.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line1063">line 1063</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">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>deviceId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The ID of the audio input device to select.</td>
</tr>
</tbody>
</table>
<h5 class="h5-returns">Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;void></span>
</dd>
</dl>
<h4 class="name" id="selectAudioOutputDevice"><span class="type-signature type-signature-async">(async) </span>selectAudioOutputDevice<span class="signature">(deviceId)</span><span class="type-signature"> &rarr; {Promise.&lt;void>}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Selects a specific audio output device.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line1135">line 1135</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">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>deviceId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The ID of the audio output device to select.</td>
</tr>
</tbody>
</table>
<h5 class="h5-returns">Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;void></span>
</dd>
</dl>
<h4 class="name" id="selectVideoInputDevice"><span class="type-signature type-signature-async">(async) </span>selectVideoInputDevice<span class="signature">(deviceId)</span><span class="type-signature"> &rarr; {Promise.&lt;void>}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Selects a specific video input device.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line1099">line 1099</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">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>deviceId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The ID of the video input device to select.</td>
</tr>
</tbody>
</table>
<h5 class="h5-returns">Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;void></span>
</dd>
</dl>
<h4 class="name" id="sendDataToAll"><span class="type-signature type-signature-async">(async) </span>sendDataToAll<span class="signature">(data)</span><span class="type-signature"> &rarr; {void}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Send a data message to all participants in the room via WebSocket.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line1629">line 1629</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">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>data</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The JSON object to send.</td>
</tr>
</tbody>
</table>
<h5 class="h5-returns">Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">void</span>
</dd>
</dl>
<h4 class="name" id="setDebugMode"><span class="type-signature"></span>setDebugMode<span class="signature">(enabled)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Enable or disable debug logging</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line163">line 163</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">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">Whether to enable debug logging</td>
</tr>
</tbody>
</table>
<h4 class="name" id="setMediaQuality"><span class="type-signature"></span>setMediaQuality<span class="signature">(quality)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Sets the media quality for audio and video tracks</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line1655">line 1655</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">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>quality</code></td>
<td class="type">
<span class="param-type">string</span>
|
<span class="param-type"><a href="global.html#QualityPreset">QualityPreset</a></span>
</td>
<td class="description last">Either a preset name ('high', 'medium', 'low') or a custom quality object
<h6>Properties</h6>
<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>video</code></td>
<td class="type">
<span class="param-type"><a href="global.html#VideoQualitySettings">VideoQualitySettings</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">Video quality settings</td>
</tr>
<tr>
<td class="name"><code>audio</code></td>
<td class="type">
<span class="param-type"><a href="global.html#AudioQualitySettings">AudioQualitySettings</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">Audio quality settings</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<h5 class="h5-throws">Throws:</h5>
<dl>
<dt>
<div class="param-desc usertext">
If preset name is invalid
</div>
</dt>
<dd></dd>
<dt>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Error</span>
</dd>
</dl>
</dt>
<dd></dd>
</dl>
<h4 class="name" id="setToken"><span class="type-signature"></span>setToken<span class="signature">(token)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Sets the user token for server requests. This should be a JWT token, and will be delivered in Authorization headers (HTTP) and to authenticate websocket join requests.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line270">line 270</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">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>token</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The metadata to associate with the user.</td>
</tr>
</tbody>
</table>
<h4 class="name" id="setUserMetadata"><span class="type-signature"></span>setUserMetadata<span class="signature">(metadata)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Sets the user metadata and updates it on the server.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line286">line 286</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">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>metadata</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The metadata to associate with the user.</td>
</tr>
</tbody>
</table>
<h4 class="name" id="shareScreen"><span class="type-signature type-signature-async">(async) </span>shareScreen<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;void>}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Starts screen sharing.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line1227">line 1227</a>
</li></ul></dd>
</dl>
<h5 class="h5-returns">Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;void></span>
</dd>
</dl>
<h4 class="name" id="startStatsMonitoring"><span class="type-signature"></span>startStatsMonitoring<span class="signature">(interval<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Start monitoring connection statistics</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line1722">line 1722</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>interval</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
<code>1000</code>
</td>
<td class="description last">How often to gather stats in milliseconds</td>
</tr>
</tbody>
</table>
<h4 class="name" id="stopStatsMonitoring"><span class="type-signature"></span>stopStatsMonitoring<span class="signature">()</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Stop monitoring connection statistics</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line1741">line 1741</a>
</li></ul></dd>
</dl>
<h4 class="name" id="toggleMedia"><span class="type-signature"></span>toggleMedia<span class="signature">(options)</span><span class="type-signature"> &rarr; {void}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Toggles the enabled state of video and/or audio tracks.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line1192">line 1192</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">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>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Options to toggle media tracks.
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>video</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
<code>null</code>
</td>
<td class="description last">Whether to toggle video tracks.</td>
</tr>
<tr>
<td class="name"><code>audio</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
<code>null</code>
</td>
<td class="description last">Whether to toggle audio tracks.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<h5 class="h5-returns">Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">void</span>
</dd>
</dl>
<h4 class="name" id="unpublishAllTracks"><span class="type-signature type-signature-async">(async) </span>unpublishAllTracks<span class="signature">(trackKind, force<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;void>}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Unpublishes all currently published tracks (with filters for type)</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line1323">line 1323</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>trackKind</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">The kind of track to unpublish ('audio' or 'video').</td>
</tr>
<tr>
<td class="name"><code>force</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
<code>false</code>
</td>
<td class="description last">If true, forces track closure without renegotiation.</td>
</tr>
</tbody>
</table>
<h5 class="h5-returns">Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;void></span>
</dd>
</dl>
<h4 class="name" id="updatePublishedTracks"><span class="type-signature type-signature-async">(async) </span>updatePublishedTracks<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;void>}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Updates the published media tracks.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line612">line 612</a>
</li></ul></dd>
</dl>
<h5 class="h5-throws">Throws:</h5>
<dl>
<dt>
<div class="param-desc usertext">
If the PeerConnection is not established.
</div>
</dt>
<dd></dd>
<dt>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Error</span>
</dd>
</dl>
</dt>
<dd></dd>
</dl>
<h5 class="h5-returns">Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;void></span>
</dd>
</dl>
<h4 class="name" id="updateRoomMetadata"><span class="type-signature type-signature-async">(async) </span>updateRoomMetadata<span class="signature">(updates)</span><span class="type-signature"> &rarr; {Promise.&lt;Object>}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li>Updates room metadata.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="public_CloudflareCalls.js.html">public/CloudflareCalls.js</a>, <a href="public_CloudflareCalls.js.html#line1612">line 1612</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">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>updates</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Metadata updates
<h6>Properties</h6>
<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>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">New room name</td>
</tr>
<tr>
<td class="name"><code>metadata</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">New room metadata</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<h5 class="h5-returns">Returns:</h5>
<div class="param-desc">
Updated room information
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Object></span>
</dd>
</dl>
</article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a> on Tue Dec 31 2024 08:15:00 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/polyfill.js"></script>
<script src="scripts/linenumber.js"></script>
</body>
<!-- Mirrored from cloudflarecalls.jamesfuthey.com/docs/CloudflareCalls.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 19 Feb 2025 14:59:44 GMT -->
</html>