Unofficial OpenTok REST API for Node. Not all features are available in the official Node client (most BETA features), this is why we made this module.
npm install opentok-rest
// or
yarn install opentok-rest
const OpenTokRest = require('opentok-rest')
const opentok = new OpenTokRest('opentok-key', 'opentok-secret')
opentok.broadcast.start(sessionId, outputs)
.then(broadcast => {
// resolves an opentok broadcast object.
})
See doc for an example object: https://tokbox.com/developer/rest/#start_broadcast
opentok.broadcast.stop(broadcastId)
.then(broadcast => {
// resolves an opentok broadcast object.
// example response: https://tokbox.com/developer/rest/#stop_broadcast
})
.catch(...)
See https://tokbox.com/developer/rest/#change_live_streaming_layout for layout options
opentok.broadcast.setLayout(broadcastId, layout)
.then(...)
.catch(...)
See https://tokbox.com/developer/beta/archive-custom-layout/#dynamically-changing-the-layout-type-while-the-session-is-being-archived for layout options
opentok.archive.setLayout(archiveId, layout)
.then(...)
.catch(...)