<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#L57">OpenVidu/OpenVidu.ts:57</a></li>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/OpenVidu.ts#L217">OpenVidu/OpenVidu.ts:217</a></li>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/OpenVidu.ts#L334">OpenVidu/OpenVidu.ts:334</a></li>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/OpenVidu.ts#L235">OpenVidu/OpenVidu.ts:235</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#L304">OpenVidu/OpenVidu.ts:304</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#L208">OpenVidu/OpenVidu.ts:208</a></li>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/OpenVidu.ts#L88">OpenVidu/OpenVidu.ts:88</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 the HTML video element has been added to DOM (if <em>targetElement</em> not null or undefined)</p>
<p>The <ahref="publisher.html">Publisher</a> object will dispatch a <code>videoPlaying</code> event once the local video starts playing (only if <code>videoElementCreated</code> event has been previously dispatched)</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 null or undefined no default video will be created for this Publisher
(you can always access the native MediaStream object by calling <em>Publisher.stream.getMediaStream()</em> and use it as <em>srcObject</em> of any HTML video element)</p>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/OpenVidu.ts#L89">OpenVidu/OpenVidu.ts:89</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 the HTML video element has been added to DOM (if <em>targetElement</em> not null or undefined)</p>
<p>The <ahref="publisher.html">Publisher</a> object will dispatch a <code>videoPlaying</code> event once the local video starts playing (only if <code>videoElementCreated</code> event has been previously dispatched)</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 null or undefined no default video will be created for this Publisher
(you can always access the native MediaStream object by calling <em>Publisher.stream.getMediaStream()</em> and use it as <em>srcObject</em> of any HTML video element)</p>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/OpenVidu.ts#L90">OpenVidu/OpenVidu.ts:90</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 the HTML video element has been added to DOM (if <em>targetElement</em> not null or undefined)</p>
<p>The <ahref="publisher.html">Publisher</a> object will dispatch a <code>videoPlaying</code> event once the local video starts playing (only if <code>videoElementCreated</code> event has been previously dispatched)</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 null or undefined no default video will be created for this Publisher
(you can always access the native MediaStream object by calling <em>Publisher.stream.getMediaStream()</em> and use it as <em>srcObject</em> of any HTML video element)</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#L91">OpenVidu/OpenVidu.ts:91</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 the HTML video element has been added to DOM (if <em>targetElement</em> not null or undefined)</p>
<p>The <ahref="publisher.html">Publisher</a> object will dispatch a <code>videoPlaying</code> event once the local video starts playing (only if <code>videoElementCreated</code> event has been previously dispatched)</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 null or undefined no default video will be created for this Publisher
(you can always access the native MediaStream object by calling <em>Publisher.stream.getMediaStream()</em> and use it as <em>srcObject</em> of any HTML video element)</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#L179">OpenVidu/OpenVidu.ts:179</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#L180">OpenVidu/OpenVidu.ts:180</a></li>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/OpenVidu.ts#L64">OpenVidu/OpenVidu.ts:64</a></li>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/OpenVidu.ts#L73">OpenVidu/OpenVidu.ts:73</a></li>
</ul>
</aside>
<divclass="tsd-comment tsd-typography">
<divclass="lead">
<hr>
<h2id="deprecated">DEPRECATED</h2>
</div>
<p><em>No <code>sessionId</code> is required. Now every necessary information is received in <ahref="session.html#connect">Session.connect</a></em></p>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/OpenVidu.ts#L349">OpenVidu/OpenVidu.ts:349</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>