Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: e2ee added to create session #300

Merged
merged 6 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 27 additions & 14 deletions lib/opentok.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function decodeSessionId(sessionId) {
}

/**
* Contains methods for creating OpenTok sessions, generating tokens, and working with archives.
* Contains methods for creating OpenTok sessions, generating tokens, working with archives, and more.
* <p>
* To create a new OpenTok object, call the OpenTok constructor with your OpenTok API key
* and the API secret for your <a href="https://tokbox.com/account">TokBox account</a>.
Expand Down Expand Up @@ -540,7 +540,7 @@ OpenTok = function (apiKey, apiSecret, env) {
this.listRenders = render.listRenders.bind(null, apiConfig);

/**
* Gets an {@link Render} object for the given render ID.
* Gets a {@link Render} object for the given render ID.
*
* @param renderId {String} The render ID.
*
Expand All @@ -551,7 +551,7 @@ OpenTok = function (apiKey, apiSecret, env) {
* <li><code>render</code> &mdash; The {@link Render} object.</li>
* </ul>
*
* @method #getArchive
* @method #getRender
* @memberof OpenTok
*/
this.getRender = render.getRender.bind(null, apiConfig);
Expand Down Expand Up @@ -648,8 +648,9 @@ OpenTok = function (apiKey, apiSecret, env) {
this.stopRender = render.stopRender.bind(null, apiConfig);

/**
* Starts a <a href="https://tokbox.com/developer/guides/broadcast/live-streaming/">live
* streaming broadcast</a>.
* Starts a live streaming broadcast. See the
* <a href="https://tokbox.com/developer/guides/broadcast/live-streaming/">live
* streaming broadcast</a> developer guide.
*
* @param {String} sessionId The ID of the session to broadcast.
*
Expand Down Expand Up @@ -1125,16 +1126,18 @@ OpenTok = function (apiKey, apiSecret, env) {
};

/**
* send audio from a Vonage Video API session to a WebSocket.
* Sends audio from a Vonage Video API session to a WebSocket.
* See the <a href="https://tokbox.com/developer/guides/audio-connector/">Audio Connector</a>
* developer guide.
*
* @param sessionId(required) The OpenTok session ID that includes the OpenTok streams you want to
* @param sessionId {String} (required) The OpenTok session ID that includes the OpenTok streams you want to
* include in the WebSocket stream
*
* @param token(required) The OpenTok token to be used for the Audio Streamer connection to the.
* @param token {String} (required) The OpenTok token to be used for the Audio Streamer connection to the.
* OpenTok session. You can add token data to identify that the connection is the Audio Streamer
* endpoint or for other identifying data
*
* @param websocketUri(required) A publicly reachable WebSocket URI to be used for the destination
* @param websocketUri {String} (required) A publicly reachable WebSocket URI to be used for the destination
* of the audio stream (such as "wss://service.com/ws-endpoint").
*
* @param options {Object} An optional options object with the following properties
Expand All @@ -1153,10 +1156,10 @@ OpenTok = function (apiKey, apiSecret, env) {
* </ul>
*
* @param callback {Function} The function to call upon completing the operation. Upon error,
* an <code>error</code> object is passed into the function. Upon success, the function is called
* with no error object passed in
*
* @return An object with the following properties:
* an <code>error</code> object is passed in as the first parameter of the function.
* Upon success, the function is called with no error object passed in (as the first parameter)
* and the second parameter is an object with the following properties:
*
* <ul>
* <li>
* <code>id</code> -- A unique ID identifying the Audio Streamer WebSocket connection.
Expand All @@ -1166,6 +1169,9 @@ OpenTok = function (apiKey, apiSecret, env) {
* WebSocket connection in the OpenTok session.
* </li>
* </ul>
*
* @method #websocketConnect
* @memberof OpenTok
*/
this.websocketConnect = function websocketConnect(
sessionId,
Expand Down Expand Up @@ -1815,11 +1821,16 @@ OpenTok.prototype.dial = function (sessionId, token, sipUri, options, callback)
* are optional):
*
* <ul>
*
* <li><code>location</code> (String) &mdash;
* An IP address that the OpenTok servers will use to situate the session in the global
* OpenTok network. If you do not set a location hint, the OpenTok servers will be based on
* the first client connecting to the session.
* </li>
*
* <li><code>e2ee</code> (Boolean) &mdash;
* Determines whether to enable <a href="https://tokbox.com/developer/guides/end-to-end-encryption/">
`end-to-end encryption</a>
for the OpenTok session. Set to <code>"true"</code> or <code>"false"</code>.
* </li>
*
* <li><code>mediaMode</code> (String) &mdash;
Expand Down Expand Up @@ -1857,6 +1868,8 @@ OpenTok.prototype.dial = function (sessionId, token, sipUri, options, callback)
* <a href="https://tokbox.com/opentok/tutorials/archiving" target="_top">archiving</a>
* feature, which lets you record, save, and retrieve OpenTok sessions.</li>
* </ul>
* </li>
* </ul>
*
* @param {Function} callback
* The function that is called when the operation completes. This function is passed two arguments:
Expand Down
28 changes: 19 additions & 9 deletions lib/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ const generateJwt = require('./generateJwt.js');
* @property {Number} createdAt
* The time at which the render was created, in milliseconds since the UNIX epoch.
*
* @property {Number} updatedAt
**
* @property {Number} upddatedAt
* The time at which the render was created, in milliseconds since the UNIX epoch.
*
Expand Down Expand Up @@ -150,11 +148,14 @@ const handleResponse = (callback, err, response) => {
};

/**
* Return a list of {@link Render} objects, representing Experience composer in any status
* Return a list of {@link Render} objects, representing Experience Composer in any status
*
* @param {Object} config - API configuration settings {@see OpenTok.listRenders}
* @param {Object} options - Optional parameters for the API call {@see OpenTok.listRenders}
* @param {Function} callback - Call back function
* @param {Function} callback - Callback function
*
* @method #listRenders
* @memberof Render
*/
exports.listRenders = (config, options, callback) => {
const [cb, opts] = guardParams('listRenders', options, callback);
Expand Down Expand Up @@ -185,11 +186,14 @@ exports.listRenders = (config, options, callback) => {
};

/**
* Gets an {@link Render} object for the given render ID.
* Gets a {@link Render} object for the given render ID.
*
* @param {Object} config - API config {@see OpenTok}
* @param {String} renderId - The Render ID to fetch
* @param {Function} callback - Call back function
* @param {Function} callback - Callback function
*
* @method #getRender
* @memberof Render
*/
exports.getRender = (config, renderId, callback) => {
const [cb] = guardParams('getRender', {}, callback);
Expand All @@ -204,12 +208,15 @@ exports.getRender = (config, renderId, callback) => {
};

/**
* Starts an Experience composer for an OpenTok session.
* Starts an Experience Composer for an OpenTok session.
*
*
* @param {Object} config - API configuration settings {@see OpenTok.startRender}
* @param {Object} options - Optional parameters for the API call {@see OpenTok.startRender}
* @param {Function} callback - Call back function
* @param {Function} callback - Callback function
*
* @method #startRender
* @memberof Render
*/
exports.startRender = (config, options, callback) => {
const [cb, opts] = guardParams('startRender', options, callback);
Expand Down Expand Up @@ -237,7 +244,10 @@ exports.startRender = (config, options, callback) => {
*
* @param {Object} config - API configuration settings {@see OpenTok.stopRender}
* @param {String} renderId - The Render ID to fetch
* @param {Function} callback - Call back function
* @param {Function} callback - Callback function
*
* @method #stopRender
* @memberof Render
*/
exports.stopRender = (config, renderId, callback) => {
const [cb] = guardParams('getRender', {}, callback);
Expand Down