Using OpenTok can be as simple as adding a few lines of code into a web page. This walk-through will show you how to create a simple OpenTok web application to chat with friends.
Before you can begin using OpenTok, you must sign up using the developer dashboard. For testing purposes, you can use the developer dashboard to obtain the following:
In the Projects page of the developer dashboard, click on the "View Details" button for Project A.
In the "Create Session" section, click the "Create New" button create a session ID.
Then, in the "Generate Token" section, select "Publisher" as the role, and then click the "Generate new" button. Leave this web page open, because you will use the session ID and token soon.
To create an OpenTok-powered web application, you first need to add the OpenTok.js library in your HTML document.
<script src="//static.opentok.com/v2/js/opentok.min.js" ></script>
Copy and paste the following code into an HTML document.
Copy and paste your API key, the session ID, and the token into the obvious places at the top of the code you just put into your HTML document.
Load the HTML document onto a web server, and view the application you just created. (You must load the page from a web server, not simply from the file system. Browsers will not allow you to connect to a WebRTC session on a page loaded from a file:// URL.)
Note: The browser will ask you to grant the page access to your webcam and microphone.
Here, check out a demo of the app.
Congratulations, you made your first OpenTok app. So what's next from here?