@@ -478,6 +478,112 @@ public function forceDisconnect($sessionId, $connectionId)
478478 return $ this ->client ->forceDisconnect ($ sessionId , $ connectionId );
479479 }
480480
481+ /**
482+ * Force the publisher of a specific stream to mute its published audio.
483+ *
484+ * <p>
485+ * Also see the <a href="#method_forceMuteAll">OpenTok->forceMuteAll()</a> method.
486+ *
487+ * @param string $sessionId The OpenTok session ID containing the stream.
488+ *
489+ * @param string $streamId The stream ID.
490+ *
491+ * @return bool Whether the call succeeded or failed.
492+ */
493+ public function forceMuteStream (string $ sessionId , string $ streamId ): bool
494+ {
495+ Validators::validateSessionId ($ sessionId );
496+ Validators::validateStreamId ($ streamId );
497+
498+ try {
499+ $ this ->client ->forceMuteStream ($ sessionId , $ streamId );
500+ } catch (\Exception $ e ) {
501+ return false ;
502+ }
503+
504+ return true ;
505+ }
506+
507+ /**
508+ * Force all streams (except for an optional list of streams) in an OpenTok session
509+ * to mute published audio.
510+ *
511+ * <p>
512+ * In addition to existing streams, any streams that are published after the call to
513+ * this method are published with audio muted. You can remove the mute state of a session
514+ * by calling the <a href="#method_disableForceMute">OpenTok->disableForceMute()</a> method.
515+ *
516+ * <p>
517+ * Also see the <a href="#method_forceMuteStream">OpenTok->forceMuteStream()</a> method.
518+ *
519+ * @param string $sessionId The OpenTok session ID.
520+ *
521+ * @param array<string> $options This array defines options and includes the following keys:
522+ *
523+ * <ul>
524+ * <li><code>'excludedStreams'</code> (array, optional) — An array of stream IDs
525+ * corresponding to streams that should not be muted. This is an optional property.
526+ * If you omit this property, all streams in the session will be muted.</li>
527+ * </ul>
528+ *
529+ * @return bool Whether the call succeeded or failed.
530+ */
531+ public function forceMuteAll (string $ sessionId , array $ options ): bool
532+ {
533+ // Active is always true when forcing mute all
534+ $ options ['active ' ] = true ;
535+
536+ Validators::validateSessionId ($ sessionId );
537+ Validators::validateForceMuteAllOptions ($ options );
538+
539+ try {
540+ $ this ->client ->forceMuteAll ($ sessionId , $ options );
541+ } catch (\Exception $ e ) {
542+ return false ;
543+ }
544+
545+ return true ;
546+ }
547+
548+ /**
549+ * Disables the active mute state of the session. After you call this method, new streams
550+ * published to the session will no longer have audio muted.
551+ *
552+ * <p>
553+ * After you call the <a href="#method_forceMuteAll">OpenTok->forceMuteAll()</a> method,
554+ * any streams published after the call are published with audio muted. Call the
555+ * <c>disableForceMute()</c> method to remove the mute state of a session, so that
556+ * new published streams are not automatically muted.
557+ *
558+ * @param string $sessionId The OpenTok session ID.
559+ *
560+ * @param array<string> $options This array defines options and includes the following keys:
561+ *
562+ * <ul>
563+ * <li><code>'excludedStreams'</code> (array, optional) — An array of stream IDs
564+ * corresponding to streams that should not be muted. This is an optional property.
565+ * If you omit this property, all streams in the session will be muted.</li>
566+ * </ul>
567+ *
568+ * @return bool Whether the call succeeded or failed.
569+ */
570+ public function disableForceMute (string $ sessionId , array $ options ): bool
571+ {
572+ // Active is always false when disabling force mute
573+ $ options ['active ' ] = false ;
574+
575+ Validators::validateSessionId ($ sessionId );
576+ Validators::validateForceMuteAllOptions ($ options );
577+
578+ try {
579+ $ this ->client ->forceMuteAll ($ sessionId , $ options );
580+ } catch (\Exception $ e ) {
581+ return false ;
582+ }
583+
584+ return true ;
585+ }
586+
481587 /**
482588 * Starts a live streaming broadcast of an OpenTok session.
483589 *
@@ -693,7 +799,7 @@ public function listStreams($sessionId)
693799 * <p>
694800 * This is an example of insecure call negotiation: "sip:[email protected] ". 695801 *
696- * @param array $options This array defines options for the token . It includes the
802+ * @param array $options This array defines options for the SIP call . It includes the
697803 * following keys, all of which are optional:
698804 *
699805 * <ul>
0 commit comments