1212* Contains methods for creating OpenTok sessions, generating tokens, and working with archives.
1313* <p>
1414* To create a new OpenTok object, call the OpenTok() constructor with your OpenTok API key
15- * and the API secret for your <a href="https://tokbox.com/account">TokBox account</a>. Do not
15+ * and the API secret for your <a href="https://tokbox.com/account">OpenTok Video API account</a>. Do not
1616* publicly share your API secret. You will use it with the OpenTok() constructor (only on your web
1717* server) to create OpenTok sessions.
1818* <p>
@@ -67,7 +67,7 @@ public function __construct($apiKey, $apiSecret, $options = array())
6767 * connecting to an OpenTok session, the client passes a token when connecting to the session.
6868 * <p>
6969 * For testing, you generate tokens or by logging in to your
70- * <a href="https://tokbox.com/account">TokBox account</a>.
70+ * <a href="https://tokbox.com/account">OpenTok Video API account</a>.
7171 *
7272 * @param string $sessionId The session ID corresponding to the session to which the user
7373 * will connect.
@@ -152,7 +152,7 @@ public function generateToken($sessionId, $options = array())
152152 * Check the error message for details.
153153 * <p>
154154 * You can also create a session by logging in to your
155- * <a href="https://tokbox.com/account">TokBox account</a>.
155+ * <a href="https://tokbox.com/account">OpenTok Video API account</a>.
156156 *
157157 * @param array $options (Optional) This array defines options for the session. The array includes
158158 * the following keys (all of which are optional):
@@ -625,7 +625,7 @@ public function disableForceMute(string $sessionId, array $options): bool
625625 * Video Layout for the OpenTok live streaming feature</a>.
626626 * </li>
627627 *
628- * <li><code>' streamMode' </code> (String) — Whether streams included in the broadcast
628+ * <li><code>streamMode</code> (String) — Whether streams included in the broadcast
629629 * are selected automatically (<code>StreamMode.AUTO</code>, the default) or manually
630630 * (<code>StreamMode.MANUAL</code>). When streams are selected automatically
631631 * (<code>StreamMode.AUTO</code>), all streams in the session can be included in the broadcast.
@@ -637,6 +637,36 @@ public function disableForceMute(string $sessionId, array $options): bool
637637 * <a href="https://tokbox.com/developer/guides/archive-broadcast-layout/#stream-prioritization-rules">stream
638638 * prioritization rules</a>.</li>
639639 *
640+ * <li><code>outputs</code> (Array) —
641+ * Defines the HLS broadcast and RTMP streams. You can provide the following keys:
642+ * <ul>
643+ * <li><code>hls</code> (Array) — available with the following options:
644+ * <p>
645+ * <ul>
646+ * <li><code>'dvr'</code> (Bool) — Whether to enable
647+ * <a href="https://tokbox.com/developer/guides/broadcast/live-streaming/#dvr">DVR functionality</a>
648+ * — rewinding, pausing, and resuming — in players that support it (<code>true</code>),
649+ * or not (<code>false</code>, the default). With DVR enabled, the HLS URL will include
650+ * a ?DVR query string appended to the end.
651+ * </li>
652+ * <li><code>'lowLatency'</code> (Bool) — Whether to enable
653+ * <a href="https://tokbox.com/developer/guides/broadcast/live-streaming/#low-latency">low-latency mode</a>
654+ * for the HLS stream. Some HLS players do not support low-latency mode. This feature
655+ * is incompatible with DVR mode HLS broadcasts.
656+ * </li>
657+ * </ul>
658+ * </p>
659+ * </li>
660+ * <li><code>rtmp</code> (Array) — An array of arrays defining RTMP streams to broadcast. You
661+ * can specify up to five target RTMP streams. Each RTMP stream array has the following keys:
662+ * <ul>
663+ * <li><code>id</code></code> (String) — The stream ID (optional)</li>
664+ * <li><code>serverUrl</code> (String) — The RTMP server URL</li>
665+ * <li><code>streamName</code> (String) — The stream name, such as
666+ * the YouTube Live stream name or the Facebook stream key</li>
667+ * </ul>
668+ * </li>
669+ * </ul>
640670 * </ul>
641671 *
642672 * @return Broadcast An object with properties defining the broadcast.
@@ -647,11 +677,28 @@ public function startBroadcast(string $sessionId, array $options = []): Broadcas
647677 // NOTE: although the server can be authoritative about the default value of layout, its
648678 // not preferred to depend on that in the SDK because its then harder to garauntee backwards
649679 // compatibility
650- $ defaults = array (
680+
681+ if (isset ($ options ['output ' ]['hls ' ])) {
682+ Validators::validateBroadcastOutputOptions ($ options ['output ' ]['hls ' ]);
683+ }
684+
685+ if (isset ($ options ['output ' ]['rtmp ' ])) {
686+ Validators::validateRtmpStreams ($ options ['output ' ]['rtmp ' ]);
687+ }
688+
689+ $ defaults = [
651690 'layout ' => Layout::getBestFit (),
652- 'streamMode ' => 'auto '
653- );
691+ 'streamMode ' => 'auto ' ,
692+ 'output ' => [
693+ 'hls ' => [
694+ 'dvr ' => false ,
695+ 'lowLatency ' => false
696+ ]
697+ ]
698+ ];
699+
654700 $ options = array_merge ($ defaults , $ options );
701+
655702 list ($ layout , $ streamMode ) = array_values ($ options );
656703
657704 // validate arguments
0 commit comments