OpenTok.js reference

The OpenTok.js includes the following classes:

Class Description
ArchiveEvent Defines event objects for the archiveStarted and archiveStopped events. The Session object dispatches these events when an archive recording of the session starts and stops.
AudioInputDeviceChangedEvent Dispatched when the audio input device is changed. For more information, see this documentation.
AudioLevelUpdatedEvent Dispatched periodically by a Subscriber or Publisher object to indicate the audio level. This event is dispatched up to 60 times per second, depending on the browser.
Capabilities A class defining properties of the capabilities property of a Session object. See Session.capabilities. All Capabilities properties are undefined until you have connected to a session and the Session object has dispatched the sessionConnected event. For more information on token roles, see the Token
CaptionReceivedEvent Defines an event object for the captionReceived event dispatched by the Subscriber object. The Subscriber object dispatches a captionReceived event when the subscriber receives a caption from the transcription service.
Connection The Connection object represents a connection to a Vonage Video API session. Each client that connects to a session has a unique connection, with a unique connection ID (represented by the id property of the Connection object for the client). The Session object has a connection property that is a Co
ConnectionEvent Defines connectionCreated and connectionDestroyed events dispatched by the {@link Session} object. The Session object dispatches a connectionCreated event when a client (including your own) connects to a Session. It also dispatches a connectionCreated event for every client in the session when you f
CpuPerformanceChangedEvent The Session object dispatches a cpuPerformanceChanged event when the CPU performance state changes. The event is only dispatched on Chromium browsers (Chrome 125+, Edge 125+, and Opera 111+). Events are not dispatched after disconnecting from a session, but they resume after reconnecting.
EncryptionNotEnabledEvent Defines the encryptionNotEnabled event dispatched by a Publisher or a Subscriber object. This event is dispatched when an encryption secret is set on a session that does not have end-to-end encryption enabled at the server level. When this event is dispatched the Publisher or Subscriber is automatic
Error The Error class is used to define the error object passed into completion handlers. Each of the following methods, which execute asynchronously, includes a completionHandler parameter: OT.initPublisher() OT.reportIssue() OT.setProxyUrl() Publisher.setVideoSource() Session.connect() Session.forceDisc
Event The Event object defines the basic Vonage Video API event object that is passed to event listeners. Other Vonage Video API event classes implement the properties and methods of the Event object. For example, the Stream object dispatches a streamPropertyChanged event when the stream's properties are
EventDispatcher This base class defines the on, once, and off methods of objects that can dispatch events.
ExceptionEvent The {@link OT} class dispatches exception events when the Vonage Video API encounters an exception (error). The ExceptionEvent object defines the properties of the event object that is dispatched. Note that you set up a callback for the exception event by calling the OT.on() method.
MediaStoppedEvent Dispatched by a Publisher when the user has stopped sharing one or all media types (video, audio, or screen).
MediaStreamAvailableEvent Defines an event object for the mediaStreamAvailable event dispatched by both the Publisher and Subscriber objects. The Publisher and Subscriber objects both dispatch a mediaStreamAvailable event when the MediaStream is available to be used in custom video elements. The Publisher and Subscriber obje
MuteForcedEvent Defines the muteForced event dispatched by a Session object. The Session object dispatches this event when a moderator forces clients publishing streams to the session to mute audio (the active property of the MuteForcedEvent object is set to true), or when a moderator disables the mute audio state
OT The first step in using the Vonage Video API is to call the OT.initSession() method. Other methods of the OT object check for system requirements and set up error logging.
Publisher The Publisher object provides the mechanism through which control of the published stream is accomplished. Calling the OT.initPublisher() method creates a Publisher object. The following code instantiates a session, and publishes an audio-video stream upon connection to the session: var apiKey = '';
QualityScoreChangedEvent The Subscriber object dispatches a qualityScoreChanged event when either the audio or video quality score changes for the subscriber. The scores are a heuristic value representing the expected subscriber experience. The values are integers ranging from 1 to 5, with the values corresponding to bad, p
Session The Session object returned by the OT.initSession() method provides access to much of the Vonage Video API functionality.
SessionConnectEvent The Session object dispatches SessionConnectEvent object when a session has successfully connected in response to a call to the connect() method of the Session object. In version 2.2, the completionHandler of the Session.connect() method indicates success or failure in connecting to the session.
SessionDisconnectEvent The Session object dispatches SessionDisconnectEvent object when a session has disconnected. This event may be dispatched asynchronously in response to a successful call to the disconnect() method of the session object. Example The following code initializes a session and sets up an event listener f
SignalEvent The Session object dispatches a signal event when the client receives a signal from the session.
Stream Specifies a stream. A stream is a representation of a published stream in a session. When a client calls the Session.publish() method, a new stream is created. Properties of the Stream object provide information about the stream. When a stream is added to a session, the Session object dispatches a s
StreamEvent StreamEvent is an event that can have the type "streamCreated" or "streamDestroyed". These events are dispatched by the Session object when another client starts or stops publishing a stream to a {@link Session}. For a local client's stream, the Publisher object dispatches the event. Example — strea
StreamPropertyChangedEvent The Session object dispatches a streamPropertyChanged event in the following circumstances: A stream has started or stopped publishing audio or video (see Publisher.publishAudio() and Publisher.publishVideo()). This change results from a call to the publishAudio() or publishVideo() methods of the Pu
Subscriber The Subscriber object is a representation of the local video element that is playing back a remote stream. The Subscriber object includes methods that let you disable and enable local audio playback for the subscribed stream. The subscribe() method of the {@link Session} object returns a Subscriber
UnsupportedBrowserEvent Defines the unsupportedBrowser event dispatched by a Publisher or a Subscriber object. This event is dispatched when an encryption secret is set but the browser does not support end-to-end encryption. When this event is dispatched the Publisher or Subscriber is automatically dropped by the SDK (ther
VideoDimensionsChangedEvent Dispatched when the video dimensions of a published stream change. On the Publisher, this event fires when the publisher's local element detects a dimension change. When the publisher is actively publishing, this also updates the stream.videoDimensions property. Examples of what can cause the local
VideoElementCreatedEvent Dispatched by a Subscriber or Publisher object to indicate the video element (or object element in Internet Explorer) was created. Add a listener for this event when you set the insertDefaultUI option to false in the call to the OT.initPublisher() method or the Session.subscribe() method. The elemen
VideoEnabledChangedEvent Defines the event object for the videoDisabled and videoEnabled events dispatched by the Subscriber.