<p>Local connection to the Session. This object is defined only after <ahref="session.html#connect">Session.connect</a> has been successfully executed, and can be retrieved subscribing to <code>connectionCreated</code> event</p>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/Session.ts#L105">OpenVidu/Session.ts:105</a></li>
<p>Connects to the session using <code>token</code>. Parameter <code>metadata</code> allows you to pass extra data to share with other users when
they receive <code>streamCreated</code> event. The structure of <code>metadata</code> string is up to you (maybe some standarized format
as JSON or XML is a good idea), the only restriction is a maximum length of 10000 chars.</p>
</div>
<p>This metadata is not considered secure, as it is generated in the client side. To pass securized data, add it as a parameter in the
token generation operation (through the API REST, openvidu-java-client or openvidu-node-client).</p>
<p>Only after the returned Promise is successfully resolved <ahref="session.html#connection">Session.connection</a> object will be available and properly defined.</p>
<h4id="events-dispatched">Events dispatched</h4>
<p>The <ahref="session.html">Session</a> object of the local participant will first dispatch one or more <code>connectionCreated</code> events upon successful termination of this method:</p>
<ul>
<li>First one for your own local Connection object, so you can retrieve <ahref="session.html#connection">Session.connection</a> property.</li>
<li>Then one for each remote Connection previously connected to the Session, if any. Any other remote user connecting to the Session after you have
successfully connected will also dispatch a <code>connectionCreated</code> event when they do so.</li>
<p>The <ahref="session.html">Session</a> object of the local participant will also dispatch a <code>streamCreated</code> event for each remote active <ahref="publisher.html">Publisher</a> that was already streaming
when connecting, just after dispatching all remote <code>connectionCreated</code> events.</p>
<p>The <ahref="session.html">Session</a> object of every other participant connected to the session will dispatch a <code>connectionCreated</code> event.</p>
<p>See <ahref="connectionevent.html">ConnectionEvent</a> and <ahref="streamevent.html">StreamEvent</a> to learn more.</p>
<p>A Promise to which you must subscribe that is resolved if the the connection to the Session was successful and rejected with an Error object if not</p>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/Session.ts#L106">OpenVidu/Session.ts:106</a></li>
<p>Connects to the session using <code>token</code>. Parameter <code>metadata</code> allows you to pass extra data to share with other users when
they receive <code>streamCreated</code> event. The structure of <code>metadata</code> string is up to you (maybe some standarized format
as JSON or XML is a good idea), the only restriction is a maximum length of 10000 chars.</p>
</div>
<p>This metadata is not considered secure, as it is generated in the client side. To pass securized data, add it as a parameter in the
token generation operation (through the API REST, openvidu-java-client or openvidu-node-client).</p>
<p>Only after the returned Promise is successfully resolved <ahref="session.html#connection">Session.connection</a> object will be available and properly defined.</p>
<h4id="events-dispatched">Events dispatched</h4>
<p>The <ahref="session.html">Session</a> object of the local participant will first dispatch one or more <code>connectionCreated</code> events upon successful termination of this method:</p>
<ul>
<li>First one for your own local Connection object, so you can retrieve <ahref="session.html#connection">Session.connection</a> property.</li>
<li>Then one for each remote Connection previously connected to the Session, if any. Any other remote user connecting to the Session after you have
successfully connected will also dispatch a <code>connectionCreated</code> event when they do so.</li>
<p>The <ahref="session.html">Session</a> object of the local participant will also dispatch a <code>streamCreated</code> event for each remote active <ahref="publisher.html">Publisher</a> that was already streaming
when connecting, just after dispatching all remote <code>connectionCreated</code> events.</p>
<p>The <ahref="session.html">Session</a> object of every other participant connected to the session will dispatch a <code>connectionCreated</code> event.</p>
<p>See <ahref="connectionevent.html">ConnectionEvent</a> and <ahref="streamevent.html">StreamEvent</a> to learn more.</p>
<p>A Promise to which you must subscribe that is resolved if the the connection to the Session was successful and rejected with an Error object if not</p>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/Session.ts#L185">OpenVidu/Session.ts:185</a></li>
<p>Leaves the session, destroying all streams and deleting the user as a participant.</p>
</div>
<h4id="events-dispatched">Events dispatched</h4>
<p>The <ahref="session.html">Session</a> object of the local participant will dispatch a <code>sessionDisconnected</code> event.
This event will automatically unsubscribe the leaving participant from every Subscriber object of the session (this includes closing the WebRTCPeer connection and disposing all MediaStreamTracks)
and also deletes any HTML video element associated to each Subscriber (only those <ahref="/docs/how-do-i/manage-videos/#let-openvidu-take-care-of-the-video-players">created by OpenVidu Browser</a>).
For every video removed, each Subscriber object will dispatch a <code>videoElementDestroyed</code> event.
Call <code>event.preventDefault()</code> upon event <code>sessionDisconnected</code> to avoid this behavior and take care of disposing and cleaning all the Subscriber objects yourself.
See <ahref="sessiondisconnectedevent.html">SessionDisconnectedEvent</a> and <ahref="videoelementevent.html">VideoElementEvent</a> to learn more to learn more.</p>
<p>The <ahref="publisher.html">Publisher</a> object of the local participant will dispatch a <code>streamDestroyed</code> event if there is a <ahref="publisher.html">Publisher</a> object publishing to the session.
This event will automatically stop all media tracks and delete any HTML video element associated to it (only those <ahref="/docs/how-do-i/manage-videos/#let-openvidu-take-care-of-the-video-players">created by OpenVidu Browser</a>).
For every video removed, the Publisher object will dispatch a <code>videoElementDestroyed</code> event.
Call <code>event.preventDefault()</code> upon event <code>streamDestroyed</code> if you want to clean the Publisher object on your own or re-publish it in a different Session (to do so it is a mandatory requirement to call <code>Session.unpublish()</code>
or/and <code>Session.disconnect()</code> in the previous session). See <ahref="streamevent.html">StreamEvent</a> and <ahref="videoelementevent.html">VideoElementEvent</a> to learn more.</p>
<p>The <ahref="session.html">Session</a> object of every other participant connected to the session will dispatch a <code>streamDestroyed</code> event if the disconnected participant was publishing.
This event will automatically unsubscribe the Subscriber object from the session (this includes closing the WebRTCPeer connection and disposing all MediaStreamTracks)
and also deletes any HTML video element associated to that Subscriber (only those <ahref="/docs/how-do-i/manage-videos/#let-openvidu-take-care-of-the-video-players">created by OpenVidu Browser</a>).
For every video removed, the Subscriber object will dispatch a <code>videoElementDestroyed</code> event.
Call <code>event.preventDefault()</code> upon event <code>streamDestroyed</code> to avoid this default behavior and take care of disposing and cleaning the Subscriber object yourself.
<p>The <ahref="session.html">Session</a> object of every other participant connected to the session will dispatch a <code>connectionDestroyed</code> event in any case. See <ahref="connectionevent.html">ConnectionEvent</a> to learn more.</p>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/Session.ts#L433">OpenVidu/Session.ts:433</a></li>
</ul>
</aside>
<divclass="tsd-comment tsd-typography">
<divclass="lead">
<p>Forces some user to leave the session</p>
</div>
<h4id="events-dispatched">Events dispatched</h4>
<p>The behavior is the same as when some user calls <ahref="session.html#disconnect">Session.disconnect</a>, but <code>reason</code> property in all events will be <code>"forceDisconnectByUser"</code>.</p>
<p>The <ahref="session.html">Session</a> object of every participant will dispatch a <code>streamDestroyed</code> event if the evicted user was publishing a stream, with property <code>reason</code> set to <code>"forceDisconnectByUser"</code>.
The <ahref="session.html">Session</a> object of every participant except the evicted one will dispatch a <code>connectionDestroyed</code> event for the evicted user, with property <code>reason</code> set to <code>"forceDisconnectByUser"</code>.</p>
<p>If any, the <ahref="publisher.html">Publisher</a> object of the evicted participant will also dispatch a <code>streamDestroyed</code> event with property <code>reason</code> set to <code>"forceDisconnectByUser"</code>.
The <ahref="session.html">Session</a> object of the evicted participant will dispatch a <code>sessionDisconnected</code> event with property <code>reason</code> set to <code>"forceDisconnectByUser"</code>.</p>
<p>See <ahref="streamevent.html">StreamEvent</a>, <ahref="connectionevent.html">ConnectionEvent</a> and <ahref="sessiondisconnectedevent.html">SessionDisconnectedEvent</a> to learn more.</p>
<p>A Promise (to which you can optionally subscribe to) that is resolved only after the participant has been successfully evicted from the session and rejected with an Error object if not</p>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/Session.ts#L472">OpenVidu/Session.ts:472</a></li>
</ul>
</aside>
<divclass="tsd-comment tsd-typography">
<divclass="lead">
<p>Forces some user to unpublish a Stream</p>
</div>
<h4id="events-dispatched">Events dispatched</h4>
<p>The behavior is the same as when some user calls <ahref="session.html#unpublish">Session.unpublish</a>, but <code>reason</code> property in all events will be <code>"forceUnpublishByUser"</code></p>
<p>The <ahref="session.html">Session</a> object of every participant will dispatch a <code>streamDestroyed</code> event with property <code>reason</code> set to <code>"forceDisconnectByUser"</code></p>
<p>The <ahref="publisher.html">Publisher</a> object of the affected participant will also dispatch a <code>streamDestroyed</code> event with property <code>reason</code> set to <code>"forceDisconnectByUser"</code></p>
<p>See <ahref="streamevent.html">StreamEvent</a> to learn more.</p>
<p>A Promise (to which you can optionally subscribe to) that is resolved only after the remote Stream has been successfully unpublished from the session and rejected with an Error object if not</p>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/Session.ts#L602">OpenVidu/Session.ts:602</a></li>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/Session.ts#L544">OpenVidu/Session.ts:544</a></li>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/Session.ts#L573">OpenVidu/Session.ts:573</a></li>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/Session.ts#L328">OpenVidu/Session.ts:328</a></li>
<p>The local <ahref="publisher.html">Publisher</a> object will dispatch a <code>streamCreated</code> event upon successful termination of this method. See <ahref="streamevent.html">StreamEvent</a> to learn more.</p>
<p>The local <ahref="publisher.html">Publisher</a> object will dispatch a <code>streamPlaying</code> once the media stream starts playing. See <ahref="streammanagerevent.html">StreamManagerEvent</a> to learn more.</p>
<p>The <ahref="session.html">Session</a> object of every other participant connected to the session will dispatch a <code>streamCreated</code> event so they can subscribe to it. See <ahref="streamevent.html">StreamEvent</a> to learn more.</p>
<p>A Promise (to which you can optionally subscribe to) that is resolved only after the publisher was successfully published and rejected with an Error object if not</p>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/Session.ts#L508">OpenVidu/Session.ts:508</a></li>
<p>All users subscribed to that signal (<code>session.on('signal:type', ...)</code> or <code>session.on('signal', ...)</code> for all signals) and whose Connection objects are in <code>to</code> array will receive it. Their local
Session objects will dispatch a <code>signal</code> or <code>signal:type</code> event. See <ahref="signalevent.html">SignalEvent</a> to learn more.</p>
<p>A Promise (to which you can optionally subscribe to) that is resolved if the message successfully reached openvidu-server and rejected with an Error object if not. <em>This doesn't
mean that openvidu-server could resend the message to all the listed receivers.</em></p>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/Session.ts#L189">OpenVidu/Session.ts:189</a></li>
<p>Subscribes to a <code>stream</code>, adding a new HTML video element to DOM with <code>subscriberProperties</code> settings. This method is usually called in the callback of <code>streamCreated</code> event.</p>
<p>The <ahref="subscriber.html">Subscriber</a> object will dispatch a <code>videoElementCreated</code> event once the 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="subscriber.html">Subscriber</a> object will dispatch a <code>streamPlaying</code> event once the remote stream 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 Subscriber will be inserted (see <ahref="../interfaces/subscriberproperties.html#insertmode">SubscriberProperties.insertMode</a>). If <em>null</em> or <em>undefined</em> no default video will be created for this Subscriber.
You can always call method <ahref="subscriber.html#addvideoelement">Subscriber.addVideoElement</a> or <ahref="subscriber.html#createvideoelement">Subscriber.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/Session.ts#L190">OpenVidu/Session.ts:190</a></li>
<p>Subscribes to a <code>stream</code>, adding a new HTML video element to DOM with <code>subscriberProperties</code> settings. This method is usually called in the callback of <code>streamCreated</code> event.</p>
<p>The <ahref="subscriber.html">Subscriber</a> object will dispatch a <code>videoElementCreated</code> event once the 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="subscriber.html">Subscriber</a> object will dispatch a <code>streamPlaying</code> event once the remote stream 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 Subscriber will be inserted (see <ahref="../interfaces/subscriberproperties.html#insertmode">SubscriberProperties.insertMode</a>). If <em>null</em> or <em>undefined</em> no default video will be created for this Subscriber.
You can always call method <ahref="subscriber.html#addvideoelement">Subscriber.addVideoElement</a> or <ahref="subscriber.html#createvideoelement">Subscriber.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/Session.ts#L191">OpenVidu/Session.ts:191</a></li>
<p>Subscribes to a <code>stream</code>, adding a new HTML video element to DOM with <code>subscriberProperties</code> settings. This method is usually called in the callback of <code>streamCreated</code> event.</p>
<p>The <ahref="subscriber.html">Subscriber</a> object will dispatch a <code>videoElementCreated</code> event once the 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="subscriber.html">Subscriber</a> object will dispatch a <code>streamPlaying</code> event once the remote stream 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 Subscriber will be inserted (see <ahref="../interfaces/subscriberproperties.html#insertmode">SubscriberProperties.insertMode</a>). If <em>null</em> or <em>undefined</em> no default video will be created for this Subscriber.
You can always call method <ahref="subscriber.html#addvideoelement">Subscriber.addVideoElement</a> or <ahref="subscriber.html#createvideoelement">Subscriber.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/Session.ts#L192">OpenVidu/Session.ts:192</a></li>
<p>Subscribes to a <code>stream</code>, adding a new HTML video element to DOM with <code>subscriberProperties</code> settings. This method is usually called in the callback of <code>streamCreated</code> event.</p>
<p>The <ahref="subscriber.html">Subscriber</a> object will dispatch a <code>videoElementCreated</code> event once the 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="subscriber.html">Subscriber</a> object will dispatch a <code>streamPlaying</code> event once the remote stream 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 Subscriber will be inserted (see <ahref="../interfaces/subscriberproperties.html#insertmode">SubscriberProperties.insertMode</a>). If <em>null</em> or <em>undefined</em> no default video will be created for this Subscriber.
You can always call method <ahref="subscriber.html#addvideoelement">Subscriber.addVideoElement</a> or <ahref="subscriber.html#createvideoelement">Subscriber.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/Session.ts#L257">OpenVidu/Session.ts:257</a></li>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/Session.ts#L258">OpenVidu/Session.ts:258</a></li>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/Session.ts#L383">OpenVidu/Session.ts:383</a></li>
Call <code>event.preventDefault()</code> upon event <code>streamDestroyed</code> if you want to clean the Publisher object on your own or re-publish it in a different Session.</p>
<p>The <ahref="session.html">Session</a> object of every other participant connected to the session will dispatch a <code>streamDestroyed</code> event.
This event will automatically unsubscribe the Subscriber object from the session (this includes closing the WebRTCPeer connection and disposing all MediaStreamTracks) and
delete any HTML video element associated to it (only those <ahref="/docs/how-do-i/manage-videos/#let-openvidu-take-care-of-the-video-players">created by OpenVidu Browser</a>).
For every video removed, the Subscriber object will dispatch a <code>videoElementDestroyed</code> event.
Call <code>event.preventDefault()</code> upon event <code>streamDestroyed</code> to avoid this default behavior and take care of disposing and cleaning the Subscriber object on your own.</p>
<li>Defined in <ahref="https://github.com/OpenVidu/openvidu/tree/master/openvidu-browser/src/OpenVidu/Session.ts#L293">OpenVidu/Session.ts:293</a></li>
<p>The <ahref="subscriber.html">Subscriber</a> object will dispatch a <code>videoElementDestroyed</code> event for each video associated to it that was removed from DOM.
Only videos <ahref="/docs/how-do-i/manage-videos/#let-openvidu-take-care-of-the-video-players">created by OpenVidu Browser</a>) will be automatically removed</p>
<p>See <ahref="videoelementevent.html">VideoElementEvent</a> to learn more</p>