A simple Webinar application based on OpenTok.
Tokinar treats a webinar as a uni-directional broadcast from 1 presenter to multiple viewers. The presenter can share screen and/or their camera, along with their audio. Presenters are given URLs that they can share with their viewers to join the webinar. Viewers' screens adjust depending on whether the presenter is sharing both screen and camera, only camera or only screen.
Presenter tokens are created with the
publisher and viewer tokens are created with the
subscriber. Presenters are shown number of viewers by listening to OpenTok events and this is done entirely client-side. There is no OpenTok callback integration.
A few notes:
app.js- This is the main server script that loads the APIs and starts the NodeJS server.
assets/- Client-side assets (styles, scripts, images) that are served as static files by the server.
assets/js/tokinar.js- Common client-side utilities.
extensions/- Screen-sharing extensions.
config.sample.js- Contains the project configuration. (See Install instructions).
libs/- Reusable utilities and libraries used by the application.
routes/- Contains the routes used by Express to serve pages.
routes/webinar.js- Contains routes for webinar pages, including creating OpenTok sessions and tokens.
views/- Server-side views that are rendered on requests.
views/webinar-presenter.ejs- The view rendered for a presenter.
views/webinar-viewer.ejs- The view rendered for a presenter.
config.jsand edit configuration.
Alternatively, you can quickly deploy this project to Heroku by clicking the button below. You will need OpenTok API key and secret and Heroku will manage the rest.
You will need SSL to use this demo on latest browsers. You can either set up a proxy through nginx or apache and run this application without SSL, or you can let
node serve it directly on SSL when you run
If you want
node to serve this application using SSL, you will need to edit
config.js and change
true. Change the values in the
ssl section to point to your key and certificate pair.
Self-signed certificate: If you have
openssl installed and on
PATH, you can run
npm run certs to generate a self-signed certificate. This command will create
cert.pem in the project root, which are also the default value for the
If you are deploying to Heroku, you do not need to worry about the SSL config.