• Stars
    star
    196
  • Rank 198,553 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 7 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Sample applications for using OpenTok.js

OpenTok Web Samples

Sample applications for using the OpenTok.js library with vanilla JavaScript.

For framework examples (Angular, React, Vue etc.) please see the Web Component example applications. For the electron app samples, these have been moved to Vonage Community

The code for this sample is found the following subdirectories:

  • Archiving (source) -- This sample shows you how to record an OpenTok session.

  • Basic-Audio-Transformer (source) -- This sample application shows how to use a basic audio transformer with the Vonage Video APIs. It is very similar to the Basic Video Chat example but it adds a low-pass filter to the published audio.

  • Basic-Captions (source) -- This sample application shows how to use captions transcribing with the Vonage Video APIs.

  • Basic-Background-Blur (source) -- This sample application shows how to add background blur with the Vonage Video APIs and Vonage ML Transformers library.

  • Basic-Video-Transformer (source) -- This sample application shows how to use a basic video transformer with the Vonage Video APIs. It is very similar to the Basic Video Chat example but it adds a threshold processor to the published video.

  • Basic Video Chat (source) -- This sample shows you how to connect to an OpenTok session, publish a stream, and subscribe to a stream.

  • Basic-Video-Zoom (source) -- This sample shows you how to use a video transformer to zoom and center a publisher.

  • Moderate-Background-Blur (source) -- This sample application shows how to add background blur with the Vonage Video APIs and Vonage ML Transformers library.

  • Publish-Canvas (source) -- In this sample application we show you how to publish a custom stream from a Canvas tag.

  • Publish-Video (source) -- In this sample application we show you how to publish a video file to an OpenTok Session.

  • Publish-Devices (source) -- In this sample application we show you how to choose different Cameras and Microphones when publishing.

  • Stereo-Audio (source) -- In this sample application we show you how to publish a stereo music file to an OpenTok Session.

  • Signaling (source) -- This sample shows you how to use the OpenTok signaling API to implement text chat.

  • Stream-Filter (source) -- This sample shows you how to apply custom grayscale, sepia and invert filters.

See the README file in each of these subdirectories for application-specific notes.

Each of these sample applications are described in the Web tutorials section of the OpenTok developer center.

Not seeing a sample application for what you are trying to do? File a new issue or upvote an existing one.

Configuring the application

  1. Clone this repository.

  2. Edit the config.js file and set the values for API_KEY, and TOKEN:

    To do this, log into your TokBox Account, and either create a new project or use an existing project. Then go to your project page and scroll down to the Project Tools section. From there, you can generate a session ID and token manually. Use the project’s API key along with the session ID and token you generated.

Important notes:

  • You can continue to get the session ID and token values from your Account during testing and development, but before you go into production you must set up a server. We will discuss this in the Setting up the test web service section.

  • The Archiving sample app requires you to set up the test web service.

Testing the application

  1. The web app is in the index.html (in each sample directory). Open the index.html in a supported browser.

    For information about which browsers are supported by the OpenTok.js library see the browser support section of the documentation.

  2. When prompted, grant the page access to your camera and microphone.

  3. Mute the speaker on your computer, and then load the page again in another browser tab.

    You will see a person-to-person video chat session using OpenTok.

See the README file in each of these subdirectories for application-specific notes.

Setting up the test web service

The Learning OpenTok PHP repo includes code for setting up a web service.

  1. Clone or download the repo and run its code on a PHP-enabled web server. If you do not have a PHP server set up, you can use Heroku to run a remote test server -- see Automatic deployment to Heroku.

  2. After getting this web service running, edit the config.js file and set the value for SAMPLE_SERVER_BASE_URL to the URL for the web service:

    • If you deployed the test web service to a local PHP server, set this to the following:

      var SAMPLE_SERVER_BASE_URL = 'http://localhost:8080';

    • If you deployed this online, set this to the following:

      var SAMPLE_SERVER_BASE_URL = 'https://YOUR-SERVER-URL';

    Do not add the trailing slash of the URL.

The sample will load the OpenTok session ID, token, and API key from the web service. Also, the archiving sample will use the web service to start, stop, and view archives.

Other resources

See the following:

  • API reference -- Provides details on the OpenTok.js API

  • Developer guides -- Includes conceptual information and code samples for all OpenTok features

More Repositories

1

opentok-android-sdk-samples

Sample applications illustrating best practices using OpenTok Android SDK.
Java
211
star
2

opentok-react-native

OpenTok React Native - a library for OpenTok iOS and Android SDKs
Swift
211
star
3

opentok-ios-sdk-samples

Example applications that use the OpenTok iOS SDK
Objective-C
200
star
4

opentok-node

OpenTok Server SDK for node.js
JavaScript
165
star
5

OpenTok-PHP-SDK

OpenTok PHP Server SDK
PHP
140
star
6

opentok-ios-sdk-samples-swift

Sample applications using the OpenTok iOS SDK in Swift
Swift
136
star
7

opentok-network-test

Sample app to test network connectivity and statistics (bps, packet-lost)
Objective-C
111
star
8

CallKit

A sample app to demonstrate how to integrate Apple CallKit into OpenTok iOS SDK
Objective-C
110
star
9

OpenTok-Ruby-SDK

OpenTok Server SDK for Ruby
Ruby
110
star
10

opentok-react

React components for OpenTok.js
JavaScript
107
star
11

opentok-rtc

OpenTok demo application
JavaScript
106
star
12

one-to-one-sample-apps

DEPRECATED: OpenTok One-to-One Communication Sample App
JavaScript
99
star
13

screensharing-extensions

Sample code for developing an OpenTok screen-sharing extension for Google Chrome and Firefox
HTML
80
star
14

Opentok-Python-SDK

OpenTok Python SDK
Python
73
star
15

Opentok-.NET-SDK

Official .NET Server SDK for OpenTok
C#
57
star
16

opentok-network-test-js

A node module that lets you check network connectivity to resources and services required to use OpenTok
TypeScript
57
star
17

broadcast-sample-app

OpenTok Broadcast Sample Application
JavaScript
54
star
18

opentok-react-native-samples

Sample applications using OpenTok and React Native
Java
52
star
19

accelerator-sample-apps-js

CSS
35
star
20

archiving-composer

Sample apps for using OpenTok archiving building blocks API and ffmpeg to generate composed files from individual archives
JavaScript
31
star
21

accelerator-core-ios

Syntax sugar of OpenTok iOS SDK with Audio/Video communication including screen sharing
Objective-C
31
star
22

learning-opentok-web

JavaScript
27
star
23

Opentok-Java-SDK

OpenTok Server SDK for Java
Java
26
star
24

learning-opentok-ios

Sample code for learning how to use the OpenTok iOS SDK
Objective-C
26
star
25

accelerator-core-js

Accelerator Core provides a simple way to integrate real-time audio/video into your web application using the OpenTok Platform
JavaScript
25
star
26

learning-opentok-php

PHP
25
star
27

learning-opentok-android

Java
25
star
28

opentok-video-call-center

Sample code for building a basic agent queuing system
Vue
20
star
29

opentok-elearning-samples

Sample applications highlighting integrations between OpenTok and Learning Management Systems (LMS)
JavaScript
19
star
30

opentok-linux-sdk-samples

OpenTok Linux SDK Samples
C++
16
star
31

web-components

Web Components to be used with OpenTok video
JavaScript
16
star
32

ARKitSample

Sample App using ARKit Apple framework
Swift
16
star
33

accelerator-screen-sharing-js

Accelerator Screen Sharing JS provides an easy way to get started in implementing interoperable screen sharing using the OpenTok platform.
JavaScript
16
star
34

opentok-hardware-setup.js

JavaScript
14
star
35

interactive-broadcast-js

JavaScript
13
star
36

accelerator-textchat-ios

OpenTok Text Chat Accelerator Pack enables text messages between mobile or browser-based devices.
Objective-C
13
star
37

learning-opentok-node

A sample app of OpenTok Node Server SDK
JavaScript
13
star
38

opentok-flutter-basic-video-chat

Kotlin
11
star
39

ARFrameMetadata

Sample application using the Frame Meta Data API on iOS with ARKit
Swift
10
star
40

opentok-webinar

Simple Webinar (1 to many broadcast) application powered by OpenTok WebRTC SDKs https://tokinar.herokuapp.com/
JavaScript
10
star
41

accelerator-sample-apps-ios

A comprehensive sample app built by OpenTok Accelerator Packs
Objective-C
10
star
42

json2code

Code generator for JSON serialization and deserialization on iOS and Android based on json schema
Java
9
star
43

opentok-windows-sdk-samples

Sample applications illustrating best practices using OpenTok Windows SDK
C#
9
star
44

accelerator-core-android

An easy way to integrate OpenTok SDK to any Android applications
Java
8
star
45

opentok-reconnection

Sample app to illustrate how reconnection feature works.
Java
7
star
46

insights-dashboard-sample

Sample React app utilizing the OpenTok Insights GraphQL API
JavaScript
6
star
47

accelerator-textchat-js

Accelerator Text Chat JS provides functionality you can add to your OpenTok applications that enables users to exchange text messages between mobile or browser-based devices.
JavaScript
6
star
48

opentok-archive-transcription-demo

Sample code for transcribing OpenTok video archives to text
JavaScript
5
star
49

interactive-broadcast-api

JavaScript
5
star
50

ux-components

Reusable React Components for TokBox
TypeScript
5
star
51

opentok-nexmo-sip

OpenTok SIP Interconnect samples with Nexmo Voice API
JavaScript
5
star
52

accelerator-sample-apps-android

A sample app built by OpenTok Accelerator Packs
Kotlin
4
star
53

accelerator-annotation-android

Java
4
star
54

interactive-broadcast-android

Java
3
star
55

accelerator-annotation-js

JavaScript
2
star
56

misc-opentok-accelerators

DEPRECATED: Old versions of the OpenTok Accelerator packs
JavaScript
2
star
57

accelerator-textchat-android

Accelerator Text Chat Android provides functionality you can add to your OpenTok applications that enables users to exchange text messages between mobile or browser-based devices.
Java
2
star
58

opentok-macos-sdk-samples

Objective-C
2
star
59

token-encoder

Generates tokens for `X-TB-TOKEN-AUTH` header when using OpenTok REST API.
JavaScript
2
star
60

opentok-swiftui-basic-video-chat

Swift
1
star
61

opentok-jwt

Node module to generate a JWT token given an apiKey and secret.
JavaScript
1
star
62

opentok-embed-appointment

A simple demo for setting up appointments with the OpenTok Embed
JavaScript
1
star