<ahref="#"class="tsd-widget menu no-caption"data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<divclass="tsd-page-title">
<divclass="container">
<ulclass="tsd-breadcrumb">
<li>
<ahref="../index.html">Globals</a>
</li>
<li>
<ahref="openvidu.html">OpenVidu</a>
</li>
</ul>
<h1>Class OpenVidu</h1>
</div>
</div>
</header>
<divclass="container container-main">
<divclass="row">
<divclass="col-8 col-content">
<sectionclass="tsd-panel tsd-comment">
<divclass="tsd-comment tsd-typography">
<divclass="lead">
<p>Entrypoint of OpenVidu Browser library.
Use it to initialize objects of type <ahref="session.html">Session</a>, <ahref="publisher.html">Publisher</a> and <ahref="localrecorder.html">LocalRecorder</a></p>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/OpenVidu.ts#L75">OpenVidu/OpenVidu.ts:75</a></li>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/OpenVidu.ts#L276">OpenVidu/OpenVidu.ts:276</a></li>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/OpenVidu.ts#L393">OpenVidu/OpenVidu.ts:393</a></li>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/OpenVidu.ts#L294">OpenVidu/OpenVidu.ts:294</a></li>
<p>Collects information about the media input devices available on the system. You can pass property <code>deviceId</code> of a <ahref="../interfaces/device.html">Device</a> object as value of <code>audioSource</code> or <code>videoSource</code> properties in <ahref="openvidu.html#initpublisher">initPublisher</a> method</p>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/OpenVidu.ts#L363">OpenVidu/OpenVidu.ts:363</a></li>
<p>Get a MediaStream object that you can customize before calling <ahref="openvidu.html#initpublisher">initPublisher</a> (pass <em>MediaStreamTrack</em> property of the <em>MediaStream</em> value resolved by the Promise as <code>audioSource</code> or <code>videoSource</code> properties in <ahref="openvidu.html#initpublisher">initPublisher</a>)</p>
</div>
<p>Parameter <code>options</code> is the same as in <ahref="openvidu.html#initpublisher">initPublisher</a> second parameter (of type <ahref="../interfaces/publisherproperties.html">PublisherProperties</a>), but only the following properties will be applied: <code>audioSource</code>, <code>videoSource</code>, <code>frameRate</code>, <code>resolution</code></p>
<p>To customize the Publisher's video, the API for HTMLCanvasElement is very useful. For example, to get a black-and-white video at 10 fps and HD resolution with no sound:</p>
<pre><code><spanclass="hljs-keyword">var</span> OV = <spanclass="hljs-keyword">new</span> OpenVidu();
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/OpenVidu.ts#L267">OpenVidu/OpenVidu.ts:267</a></li>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/OpenVidu.ts#L148">OpenVidu/OpenVidu.ts:148</a></li>
<p>The <ahref="publisher.html">Publisher</a> object will dispatch an <code>accessDialogOpened</code> event, only if the pop-up shown by the browser to request permissions for the camera is opened. You can use this event to alert the user about granting permissions
for your website. An <code>accessDialogClosed</code> event will also be dispatched after user clicks on "Allow" or "Block" in the pop-up.</p>
<p>The <ahref="publisher.html">Publisher</a> object will dispatch an <code>accessAllowed</code> or <code>accessDenied</code> event once it has been granted access to the requested input devices or not.</p>
<p>The <ahref="publisher.html">Publisher</a> object will dispatch a <code>videoElementCreated</code> event once a HTML video element has been added to DOM (only if you
<ahref="/docs/how-do-i/manage-videos/#let-openvidu-take-care-of-the-video-players">let OpenVidu take care of the video players</a>). See <ahref="videoelementevent.html">VideoElementEvent</a> to learn more.</p>
<p>The <ahref="publisher.html">Publisher</a> object will dispatch a <code>streamPlaying</code> event once the local streams starts playing. See <ahref="streammanagerevent.html">StreamManagerEvent</a> to learn more.</p>
<p>HTML DOM element (or its <code>id</code> attribute) in which the video element of the Publisher will be inserted (see <ahref="../interfaces/publisherproperties.html#insertmode">PublisherProperties.insertMode</a>). If <em>null</em> or <em>undefined</em> no default video will be created for this Publisher.
You can always call method <ahref="publisher.html#addvideoelement">Publisher.addVideoElement</a> or <ahref="publisher.html#createvideoelement">Publisher.createVideoElement</a> to manage the video elements on your own (see <ahref="/docs/how-do-i/manage-videos">Manage video players</a> section)</p>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/OpenVidu.ts#L149">OpenVidu/OpenVidu.ts:149</a></li>
<p>The <ahref="publisher.html">Publisher</a> object will dispatch an <code>accessDialogOpened</code> event, only if the pop-up shown by the browser to request permissions for the camera is opened. You can use this event to alert the user about granting permissions
for your website. An <code>accessDialogClosed</code> event will also be dispatched after user clicks on "Allow" or "Block" in the pop-up.</p>
<p>The <ahref="publisher.html">Publisher</a> object will dispatch an <code>accessAllowed</code> or <code>accessDenied</code> event once it has been granted access to the requested input devices or not.</p>
<p>The <ahref="publisher.html">Publisher</a> object will dispatch a <code>videoElementCreated</code> event once a HTML video element has been added to DOM (only if you
<ahref="/docs/how-do-i/manage-videos/#let-openvidu-take-care-of-the-video-players">let OpenVidu take care of the video players</a>). See <ahref="videoelementevent.html">VideoElementEvent</a> to learn more.</p>
<p>The <ahref="publisher.html">Publisher</a> object will dispatch a <code>streamPlaying</code> event once the local streams starts playing. See <ahref="streammanagerevent.html">StreamManagerEvent</a> to learn more.</p>
<p>HTML DOM element (or its <code>id</code> attribute) in which the video element of the Publisher will be inserted (see <ahref="../interfaces/publisherproperties.html#insertmode">PublisherProperties.insertMode</a>). If <em>null</em> or <em>undefined</em> no default video will be created for this Publisher.
You can always call method <ahref="publisher.html#addvideoelement">Publisher.addVideoElement</a> or <ahref="publisher.html#createvideoelement">Publisher.createVideoElement</a> to manage the video elements on your own (see <ahref="/docs/how-do-i/manage-videos">Manage video players</a> section)</p>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/OpenVidu.ts#L150">OpenVidu/OpenVidu.ts:150</a></li>
<p>The <ahref="publisher.html">Publisher</a> object will dispatch an <code>accessDialogOpened</code> event, only if the pop-up shown by the browser to request permissions for the camera is opened. You can use this event to alert the user about granting permissions
for your website. An <code>accessDialogClosed</code> event will also be dispatched after user clicks on "Allow" or "Block" in the pop-up.</p>
<p>The <ahref="publisher.html">Publisher</a> object will dispatch an <code>accessAllowed</code> or <code>accessDenied</code> event once it has been granted access to the requested input devices or not.</p>
<p>The <ahref="publisher.html">Publisher</a> object will dispatch a <code>videoElementCreated</code> event once a HTML video element has been added to DOM (only if you
<ahref="/docs/how-do-i/manage-videos/#let-openvidu-take-care-of-the-video-players">let OpenVidu take care of the video players</a>). See <ahref="videoelementevent.html">VideoElementEvent</a> to learn more.</p>
<p>The <ahref="publisher.html">Publisher</a> object will dispatch a <code>streamPlaying</code> event once the local streams starts playing. See <ahref="streammanagerevent.html">StreamManagerEvent</a> to learn more.</p>
<p>HTML DOM element (or its <code>id</code> attribute) in which the video element of the Publisher will be inserted (see <ahref="../interfaces/publisherproperties.html#insertmode">PublisherProperties.insertMode</a>). If <em>null</em> or <em>undefined</em> no default video will be created for this Publisher.
You can always call method <ahref="publisher.html#addvideoelement">Publisher.addVideoElement</a> or <ahref="publisher.html#createvideoelement">Publisher.createVideoElement</a> to manage the video elements on your own (see <ahref="/docs/how-do-i/manage-videos">Manage video players</a> section)</p>
<p><code>error</code> parameter is null if <code>initPublisher</code> succeeds, and is defined if it fails.
<code>completionHandler</code> function is called before the Publisher dispatches an <code>accessAllowed</code> or an <code>accessDenied</code> event</p>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/OpenVidu.ts#L151">OpenVidu/OpenVidu.ts:151</a></li>
<p>The <ahref="publisher.html">Publisher</a> object will dispatch an <code>accessDialogOpened</code> event, only if the pop-up shown by the browser to request permissions for the camera is opened. You can use this event to alert the user about granting permissions
for your website. An <code>accessDialogClosed</code> event will also be dispatched after user clicks on "Allow" or "Block" in the pop-up.</p>
<p>The <ahref="publisher.html">Publisher</a> object will dispatch an <code>accessAllowed</code> or <code>accessDenied</code> event once it has been granted access to the requested input devices or not.</p>
<p>The <ahref="publisher.html">Publisher</a> object will dispatch a <code>videoElementCreated</code> event once a HTML video element has been added to DOM (only if you
<ahref="/docs/how-do-i/manage-videos/#let-openvidu-take-care-of-the-video-players">let OpenVidu take care of the video players</a>). See <ahref="videoelementevent.html">VideoElementEvent</a> to learn more.</p>
<p>The <ahref="publisher.html">Publisher</a> object will dispatch a <code>streamPlaying</code> event once the local streams starts playing. See <ahref="streammanagerevent.html">StreamManagerEvent</a> to learn more.</p>
<p>HTML DOM element (or its <code>id</code> attribute) in which the video element of the Publisher will be inserted (see <ahref="../interfaces/publisherproperties.html#insertmode">PublisherProperties.insertMode</a>). If <em>null</em> or <em>undefined</em> no default video will be created for this Publisher.
You can always call method <ahref="publisher.html#addvideoelement">Publisher.addVideoElement</a> or <ahref="publisher.html#createvideoelement">Publisher.createVideoElement</a> to manage the video elements on your own (see <ahref="/docs/how-do-i/manage-videos">Manage video players</a> section)</p>
<p><code>error</code> parameter is null if <code>initPublisher</code> succeeds, and is defined if it fails.
<code>completionHandler</code> function is called before the Publisher dispatches an <code>accessAllowed</code> or an <code>accessDenied</code> event</p>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/OpenVidu.ts#L238">OpenVidu/OpenVidu.ts:238</a></li>
<p>Promisified version of <ahref="openvidu.html#initpublisher">OpenVidu.initPublisher</a></p>
</div>
<blockquote>
<p>WARNING: events <code>accessDialogOpened</code> and <code>accessDialogClosed</code> will not be dispatched if using this method instead of <ahref="openvidu.html#initpublisher">OpenVidu.initPublisher</a></p>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/OpenVidu.ts#L239">OpenVidu/OpenVidu.ts:239</a></li>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/OpenVidu.ts#L142">OpenVidu/OpenVidu.ts:142</a></li>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/OpenVidu.ts#L408">OpenVidu/OpenVidu.ts:408</a></li>
<p>Set OpenVidu advanced configuration options. Currently <code>configuration</code> is an object with the following optional properties (see <ahref="../interfaces/openviduadvancedconfiguration.html">OpenViduAdvancedConfiguration</a> for more details):</p>
<ul>
<li><code>iceServers</code>: set custom STUN/TURN servers to be used by OpenVidu Browser</li>
<li><code>screenShareChromeExtension</code>: url to a custom screen share extension for Chrome to be used instead of the default one, based on ours <ahref="https://github.com/OpenVidu/openvidu-screen-sharing-chrome-extension">https://github.com/OpenVidu/openvidu-screen-sharing-chrome-extension</a></li>
<li><code>publisherSpeakingEventsOptions</code>: custom configuration for the <ahref="publisherspeakingevent.html">PublisherSpeakingEvent</a> feature</li>