diff --git a/README.md b/README.md index 3019965d..edb77308 100644 --- a/README.md +++ b/README.md @@ -420,10 +420,10 @@ opentok.forceDisconnect(sessionId, connectionId, function (error) { This is the server-side equivalent to the forceDisconnect() method in OpenTok.js: . -### Force Mute a participant +### Forcing a publisher to mute audio -You can force mute participants from an OpenTok Session using the -`openTok.forceMute(sessionId, streamId, callback)` method. +You can force the publisher of a specified stream to mute its audio using the +`OpenTok.forceMute(sessionId, streamId, callback)` method. ```javascript opentok.forceMute(sessionId, streamId, function (error) { @@ -431,22 +431,26 @@ opentok.forceMute(sessionId, streamId, function (error) { }); ``` -### Force Mute All participants +### Forcing all participants in a session to mute audio -You can force mute all participants from an OpenTok Session using the +You can force all publishers in the session (except for those publishing +excluded streams) to mute audio using the `openTok.forceMuteAll(sessionId, excludedStreamIds, callback)` method. -To mute all participants call forceMuteAll with out excludedStreamIds. -To exclude streams from being muted use the excludedStreamIds. + +To mute audio in all streams in the session, call the method without adding an +`excludedStreamIds` parameter: ```javascript -const excludedStreamIds = ['stream1','stream2']; -opentok.forceMuteAll(sessionId, excludedStreamIds, function (error) { +opentok.forceMuteAll(sessionId, null, function (error) { if (error) return console.log("error:", error); }); ``` +To exclude streams from being muted, use the `excludedStreamIds` parameter: + ```javascript -opentok.forceMuteAll(sessionId, null, function (error) { +const excludedStreamIds = ['stream1','stream2']; +opentok.forceMuteAll(sessionId, excludedStreamIds, function (error) { if (error) return console.log("error:", error); }); ``` diff --git a/lib/muteModeration.js b/lib/muteModeration.js index d30346c6..b5ac16a3 100644 --- a/lib/muteModeration.js +++ b/lib/muteModeration.js @@ -27,10 +27,10 @@ var api = function (config, method, session, stream, body, callback) { handleForceMute = function (config, sessionId, streamId, excludedStreamIds = null, callback) { if (typeof callback !== 'function') { - throw (new errors.ArgumentError('No callback given to signal')); + throw (new errors.ArgumentError('No callback given')); } if (sessionId == null) { - return callback(new errors.ArgumentError('No sessionId or connectionId given to signal')); + return callback(new errors.ArgumentError('No sessionId or streamId given')); } let body=null; if(excludedStreamIds){ diff --git a/lib/opentok.js b/lib/opentok.js index fbb7a71c..7ae34a85 100644 --- a/lib/opentok.js +++ b/lib/opentok.js @@ -800,7 +800,7 @@ OpenTok = function (apiKey, apiSecret, env) { this.forceDisconnect = moderation.forceDisconnect.bind(null, apiConfig); /** - * Mutes a participant from an OpenTok session. + * Forces the publisher of a specified stream to mute its audio. * * @param sessionId The session ID for the OpenTok session that the client you want * to mute is connected to. @@ -824,12 +824,12 @@ OpenTok = function (apiKey, apiSecret, env) { this.forceMute = muteModeration.forceMute.bind(null, apiConfig); /** - * Mutes a participant from an OpenTok session. + * Forces all publishers in the session (except for those publishing excluded streams) + * to mute audio. * - * @param sessionId The session ID for the OpenTok session that the client you want - * to mute is connected to. + * @param sessionId The session ID for the OpenTok session in which you want to mute clients. * - * @param excludedSteamIds (optional) A list of stream Ids to exclude from mute. + * @param excludedSteamIds (optional) A list of stream IDs to exclude from being muted. * * @param callback {Function} The function to call upon completing the operation. Two arguments * are passed to the function: