Local connection to the Session. This object is defined only after connect has been successfully executed, and can be retrieved subscribing to connectionCreated
event
Unique identifier of the Session
Collection of all StreamManagers of this Session (Publisher and Subscriber)
Connects to the session using token
. Parameter metadata
allows you to pass extra data to share with other users when
they receive streamCreated
event. The structure of metadata
string is up to you (maybe some standardized format
as JSON or XML is a good idea).
This metadata is not considered secure, as it is generated in the client side. To pass secure data, add it as a parameter in the token generation operation (through the API REST, openvidu-java-client or openvidu-node-client).
Only after the returned Promise is successfully resolved connection object will be available and properly defined.
The Session object of the local participant will first dispatch one or more connectionCreated
events upon successful termination of this method:
connectionCreated
event when they do so.The Session object of the local participant will also dispatch a streamCreated
event for each remote active Publisher that was already streaming
when connecting, just after dispatching all remote connectionCreated
events.
The Session object of every other participant connected to the session will dispatch a connectionCreated
event.
See ConnectionEvent and StreamEvent to learn more.
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
Connects to the session using token
. Parameter metadata
allows you to pass extra data to share with other users when
they receive streamCreated
event. The structure of metadata
string is up to you (maybe some standardized format
as JSON or XML is a good idea).
This metadata is not considered secure, as it is generated in the client side. To pass secure data, add it as a parameter in the token generation operation (through the API REST, openvidu-java-client or openvidu-node-client).
Only after the returned Promise is successfully resolved connection object will be available and properly defined.
The Session object of the local participant will first dispatch one or more connectionCreated
events upon successful termination of this method:
connectionCreated
event when they do so.The Session object of the local participant will also dispatch a streamCreated
event for each remote active Publisher that was already streaming
when connecting, just after dispatching all remote connectionCreated
events.
The Session object of every other participant connected to the session will dispatch a connectionCreated
event.
See ConnectionEvent and StreamEvent to learn more.
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
Leaves the session, destroying all streams and deleting the user as a participant.
The Session object of the local participant will dispatch a sessionDisconnected
event.
This event will automatically unsubscribe the leaving participant from every Subscriber object of the session (this includes closing the RTCPeerConnection and disposing all MediaStreamTracks)
and also deletes any HTML video element associated to each Subscriber (only those created by OpenVidu Browser).
For every video removed, each Subscriber object will dispatch a videoElementDestroyed
event.
Call event.preventDefault()
upon event sessionDisconnected
to avoid this behavior and take care of disposing and cleaning all the Subscriber objects yourself.
See SessionDisconnectedEvent and VideoElementEvent to learn more.
The Publisher object of the local participant will dispatch a streamDestroyed
event if there is a Publisher object publishing to the session.
This event will automatically stop all media tracks and delete any HTML video element associated to it (only those created by OpenVidu Browser).
For every video removed, the Publisher object will dispatch a videoElementDestroyed
event.
Call event.preventDefault()
upon event streamDestroyed
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 Session.unpublish()
or/and Session.disconnect()
in the previous session). See StreamEvent and VideoElementEvent to learn more.
The Session object of every other participant connected to the session will dispatch a streamDestroyed
event if the disconnected participant was publishing.
This event will automatically unsubscribe the Subscriber object from the session (this includes closing the RTCPeerConnection and disposing all MediaStreamTracks)
and also deletes any HTML video element associated to that Subscriber (only those created by OpenVidu Browser).
For every video removed, the Subscriber object will dispatch a videoElementDestroyed
event.
Call event.preventDefault()
upon event streamDestroyed
to avoid this default behavior and take care of disposing and cleaning the Subscriber object yourself.
See StreamEvent and VideoElementEvent to learn more.
The Session object of every other participant connected to the session will dispatch a connectionDestroyed
event in any case. See ConnectionEvent to learn more.
Forces some user to leave the session
The behavior is the same as when some user calls disconnect, but reason
property in all events will be "forceDisconnectByUser"
.
The Session object of every participant will dispatch a streamDestroyed
event if the evicted user was publishing a stream, with property reason
set to "forceDisconnectByUser"
.
The Session object of every participant except the evicted one will dispatch a connectionDestroyed
event for the evicted user, with property reason
set to "forceDisconnectByUser"
.
If any, the Publisher object of the evicted participant will also dispatch a streamDestroyed
event with property reason
set to "forceDisconnectByUser"
.
The Session object of the evicted participant will dispatch a sessionDisconnected
event with property reason
set to "forceDisconnectByUser"
.
See StreamEvent, ConnectionEvent and SessionDisconnectedEvent to learn more.
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
Forces some user to unpublish a Stream
The behavior is the same as when some user calls unpublish, but reason
property in all events will be "forceUnpublishByUser"
The Session object of every participant will dispatch a streamDestroyed
event with property reason
set to "forceDisconnectByUser"
The Publisher object of the affected participant will also dispatch a streamDestroyed
event with property reason
set to "forceDisconnectByUser"
See StreamEvent to learn more.
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
See off
Optional
handler: ((event: SessionEventMap[K]) => void)See on
See once
Publishes to the Session the Publisher object
The local Publisher object will dispatch a streamCreated
event upon successful termination of this method. See StreamEvent to learn more.
The local Publisher object will dispatch a streamPlaying
once the media stream starts playing. See StreamManagerEvent to learn more.
The Session object of every other participant connected to the session will dispatch a streamCreated
event so they can subscribe to it. See StreamEvent to learn more.
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
Sends one signal. signal
object has the following optional properties:
{data:string, to:Connection[], type:string}
All users subscribed to that signal (session.on('signal:type', ...)
or session.on('signal', ...)
for all signals) and whose Connection objects are in to
array will receive it. Their local
Session objects will dispatch a signal
or signal:type
event. See SignalEvent to learn more.
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. This doesn't mean that openvidu-server could resend the message to all the listed receivers.
Subscribes to a stream
, adding a new HTML video element to DOM with subscriberProperties
settings. This method is usually called in the callback of streamCreated
event.
The Subscriber object will dispatch a videoElementCreated
event once the HTML video element has been added to DOM (only if you
let OpenVidu take care of the video players). See VideoElementEvent to learn more.
The Subscriber object will dispatch a streamPlaying
event once the remote stream starts playing. See StreamManagerEvent to learn more.
Stream object to subscribe to
HTML DOM element (or its id
attribute) in which the video element of the Subscriber will be inserted (see insertMode). If null or undefined no default video will be created for this Subscriber.
You can always call method addVideoElement or createVideoElement to manage the video elements on your own (see Manage video players section)
Subscribes to a stream
, adding a new HTML video element to DOM with subscriberProperties
settings. This method is usually called in the callback of streamCreated
event.
The Subscriber object will dispatch a videoElementCreated
event once the HTML video element has been added to DOM (only if you
let OpenVidu take care of the video players). See VideoElementEvent to learn more.
The Subscriber object will dispatch a streamPlaying
event once the remote stream starts playing. See StreamManagerEvent to learn more.
Stream object to subscribe to
HTML DOM element (or its id
attribute) in which the video element of the Subscriber will be inserted (see insertMode). If null or undefined no default video will be created for this Subscriber.
You can always call method addVideoElement or createVideoElement to manage the video elements on your own (see Manage video players section)
Subscribes to a stream
, adding a new HTML video element to DOM with subscriberProperties
settings. This method is usually called in the callback of streamCreated
event.
The Subscriber object will dispatch a videoElementCreated
event once the HTML video element has been added to DOM (only if you
let OpenVidu take care of the video players). See VideoElementEvent to learn more.
The Subscriber object will dispatch a streamPlaying
event once the remote stream starts playing. See StreamManagerEvent to learn more.
Stream object to subscribe to
HTML DOM element (or its id
attribute) in which the video element of the Subscriber will be inserted (see insertMode). If null or undefined no default video will be created for this Subscriber.
You can always call method addVideoElement or createVideoElement to manage the video elements on your own (see Manage video players section)
error
parameter is null if subscribe
succeeds, and is defined if it fails.
Subscribes to a stream
, adding a new HTML video element to DOM with subscriberProperties
settings. This method is usually called in the callback of streamCreated
event.
The Subscriber object will dispatch a videoElementCreated
event once the HTML video element has been added to DOM (only if you
let OpenVidu take care of the video players). See VideoElementEvent to learn more.
The Subscriber object will dispatch a streamPlaying
event once the remote stream starts playing. See StreamManagerEvent to learn more.
Stream object to subscribe to
HTML DOM element (or its id
attribute) in which the video element of the Subscriber will be inserted (see insertMode). If null or undefined no default video will be created for this Subscriber.
You can always call method addVideoElement or createVideoElement to manage the video elements on your own (see Manage video players section)
error
parameter is null if subscribe
succeeds, and is defined if it fails.
Promisified version of subscribe
Subscribe to the Speech-To-Text events for this Stream. The Session object will emit SpeechToTextEvent for the Stream when speech is detected in its audio track.
A Promise (to which you can optionally subscribe to) that is resolved if the speech-to-text subscription was successful and rejected with an Error object if not.
The Stream for which you want to start receiving SpeechToTextEvent.
The language of the Stream's audio track. It must be a valid BCP-47 language tag like "en-US" or "es-ES".
Unpublishes from the Session the Publisher object.
The Publisher object of the local participant will dispatch a streamDestroyed
event.
This event will automatically stop all media tracks and delete any HTML video element associated to this Publisher
(only those videos created by OpenVidu Browser).
For every video removed, the Publisher object will dispatch a videoElementDestroyed
event.
Call event.preventDefault()
upon event streamDestroyed
if you want to clean the Publisher object on your own or re-publish it in a different Session.
The Session object of every other participant connected to the session will dispatch a streamDestroyed
event.
This event will automatically unsubscribe the Subscriber object from the session (this includes closing the RTCPeerConnection and disposing all MediaStreamTracks) and
delete any HTML video element associated to it (only those created by OpenVidu Browser).
For every video removed, the Subscriber object will dispatch a videoElementDestroyed
event.
Call event.preventDefault()
upon event streamDestroyed
to avoid this default behavior and take care of disposing and cleaning the Subscriber object on your own.
See StreamEvent and VideoElementEvent to learn more.
Unsubscribes from subscriber
, automatically removing its associated HTML video elements.
The Subscriber object will dispatch a videoElementDestroyed
event for each video associated to it that was removed from DOM.
Only videos created by OpenVidu Browser) will be automatically removed
See VideoElementEvent to learn more
Unsubscribe from the Speech-To-Text events for this Stream.
A Promise (to which you can optionally subscribe to) that is resolved if the speech-to-text subscription was successful and rejected with an Error object if not.
Generated using TypeDoc
Represents a video call. It can also be seen as a videoconference room where multiple users can connect. Participants who publish their videos to a session can be seen by the rest of users connected to that specific session. Initialized with initSession method.
See available event listeners at SessionEventMap.