Getting up and running using OpenTok can be as simple as cutting and pasting a few lines of code into a web page. This walkthrough 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. When you are finished and before you start coding, we need to collect a few key pieces of information necessary to create an OpenTok application. They are:
Get these from your OpenTok dashboard by following these instructions:
After you login to the dashboard, and click through the Quick Start guide, retrieve your API key from Project A on the Project page.
Cut and paste this somewhere safe because you will need it soon.
Click on the "View Details" button associated with your project. Then click "Create New" to create a session ID, then click "Generate new" under Generate Token. Cut and paste your session and token IDs somewhere safe, because you will need them again.
Note: Make sure to copy/paste the whole of the session ID and token.
<script src="http://static.opentok.com/webrtc/v2.0/js/TB.min.js" ></script>
Copy and paste the code below into your HTML document.
Remember those values you saved in step 1? Cut and paste them 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.
Note: You may have to grant permissions to the browser to access your webcam and microphone.
Your favorite teacher in grade school just shed a tear. But we forgive you. Here, check out a demo of the app discussed above.
Congratulations, you made your first OpenTok app, or at least we assume you did. So what's next from here?