Library – for building WebRTC movie apps on the web

OpenTok.js

The OpenTok.js library lets you use OpenTok-powered movie sessions on the web.

Overview

All OpenTok applications are composed of two parts:

  • The client side, which uses the OpenTok client SDKs and runs in a user’s browser or mobile app
  • The server side, which uses the OpenTok server SDKs and runs on your server to pass authentication information to the client

The client SDK for building web-based OpenTok applications is OpenTok.js. This JavaScript library provides most of the core functionality for your app, including:

  • Connecting to a session
  • Publishing flows to a session
  • Subscribing to flows in a session

Client SDKs are also available for iOS and Android. All OpenTok client SDKs can interact with one another. You can learn more about the basics of OpenTok clients, servers, sessions and more on our OpenTok Basics page.

Building with OpenTok.js

The best way to learn how to use the OpenTok.js library is to go after our Basic Movie Talk tutorial for web:

Once you understand the basics of building with OpenTok.js, you can get more detailed information and learn how to customize your application with our Developer Guides. To investigate specific API classes and methods, you can review the OpenTok.js Reference.

Loading OpenTok.js

To flow OpenTok.js in your web page, add the following script tag:

You can also install OpenTok.js using the @opentok/client npm package.

The current version of the OpenTok.js library interacts with the following OpenTok client libraries:

  • OpenTok Android SDK Two.8+
  • OpenTok iOS SDK Two.8+
  • OpenTok.js Two.8+

Browser support

The OpenTok.js library is presently supported in:

  • Google Chrome (latest release version) — HTTPS only
  • Google Chrome for Android (latest release version) — HTTPS only
  • Firefox (latest release version)
  • Firefox for Android (latest release version)
  • Internet Explorer ten and eleven with the OpenTok Plugin for Internet Explorer — see Developing with the OpenTok Plugin.
  • Microsoft Edge 15+ — beta support. Edge version 15+ was released with the latest Windows ten Creators Update. Presently, Edge is only supported in relayed sessions; it is not supported in routed sessions (sessions that use the OpenTok Media Router). Edge support is presently in beta. We are working on adding support for extra OpenTok features in Edge.
  • Opera (latest release version)

Safari Browser Support (beta): The upcoming Safari eleven browser for Mac and iOS will be compatible with WebRTC. You can now test this fresh functionality with the latest beta version of OpenTok.js. See the Safari Support Guide for more.

OpenTok version numbers

You can include the OpenTok.js library in your web page using a <script> tag:

The OpenTok.js version number consists of three parts:

  • The major version number — This number (the very first number) is incremented when there is a fresh version that includes an API switch that is not backward compatible.
  • The minor version number — This number (the 2nd number) is incremented when there is a fresh version that adds fresh functionality.
  • The patch number — This number (the third) is incremented when there is a fresh version that fixes bugs or improves spectacle without adding fresh functionality.

For example, v2.Four.0 is major version Two, minor version four (of major version Two), and revision zero (of v2.Four). As revision versions are released, switches are included in the root minor revision. For example, when v2.Two.Three is released, its switches are included in v2.Two.

To reference a specific revision, you can include the finish version number (such as "v2.Four.0") in the src attribute. However, we recommend that you specify only the major version number. TokBox officially supports the current version of the library. If you are loading an older version, we ask that you upgrade to take advantage of the latest bug fixes and features in the OpenTok platform.

Significant: Always use the libraries we provide unmodified. This ensures that you use the latest up-to-date, tested code. TokBox does not support the use of modified libraries.

Related video:

Leave a Reply