4444*
4545* @property boolean $isDvr
4646* Whether the broadcast supports DVR functionality for the HLS stream.
47+
48+ * @property string $status
49+ * Broadcast state. Either `started` or `stopped`
50+ *
51+ * @property string $maxBitRate
52+ * Max Bitrate allowed for the broadcast composing. Must be between 400000 and 2000000
4753*
4854* @property boolean $isLowLatency
4955* Whether the broadcast supports low-latency mode for the HLS stream.
@@ -86,6 +92,10 @@ class Broadcast
8692 private $ hasAudio ;
8793 /** @ignore */
8894 private $ hasVideo ;
95+ /** @ignore */
96+ private $ status ;
97+ /** @ignore */
98+ private $ maxBitRate ;
8999
90100 public function __construct ($ broadcastData , $ options = array ())
91101 {
@@ -107,34 +117,41 @@ public function __construct($broadcastData, $options = array())
107117 );
108118
109119 $ options = array_merge ($ defaults , array_intersect_key ($ options , $ defaults ));
110- list ($ apiKey , $ apiSecret , $ apiUrl , $ client , $ isStopped , $ streamMode , $ hasAudio , $ hasVideo ) = array_values ($ options );
111120
112- // validate params
113121 Validators::validateBroadcastData ($ broadcastData );
114- Validators::validateClient ($ client );
115- Validators::validateHasStreamMode ($ streamMode );
122+ Validators::validateClient ($ options [ ' client ' ] );
123+ Validators::validateHasStreamMode ($ options [ ' streamMode ' ] );
116124
117125 $ this ->data = $ broadcastData ;
118126
119127 if (isset ($ this ->data ['multiBroadcastTag ' ])) {
120128 $ this ->multiBroadcastTag = $ this ->data ['multiBroadcastTag ' ];
121129 }
122130
123- $ this ->isStopped = $ isStopped ;
131+ if (isset ($ this ->data ['maxBitRate ' ])) {
132+ $ this ->maxBitRate = $ this ->data ['maxBitRate ' ];
133+ }
134+
135+ if (isset ($ this ->data ['status ' ])) {
136+ $ this ->status = $ this ->data ['status ' ];
137+ }
138+
139+ $ this ->isStopped = $ options ['isStopped ' ];
124140 $ this ->resolution = $ this ->data ['resolution ' ];
125141 $ this ->isHls = isset ($ this ->data ['settings ' ]['hls ' ]);
126142 $ this ->isLowLatency = $ this ->data ['settings ' ]['hls ' ]['lowLatency ' ] ?? false ;
127143 $ this ->isDvr = $ this ->data ['settings ' ]['hls ' ]['dvr ' ] ?? false ;
128- $ this ->hasAudio = $ hasAudio ;
129- $ this ->hasVideo = $ hasVideo ;
144+ $ this ->hasAudio = $ options ['hasAudio ' ];
145+ $ this ->hasVideo = $ options ['hasVideo ' ];
146+
147+ $ this ->client = $ options ['client ' ] ?? new Client ();
130148
131- $ this ->client = isset ($ client ) ? $ client : new Client ();
132149 if (!$ this ->client ->isConfigured ()) {
133- Validators::validateApiKey ($ apiKey );
134- Validators::validateApiSecret ($ apiSecret );
135- Validators::validateApiUrl ($ apiUrl );
150+ Validators::validateApiKey ($ options [ ' apiKey ' ] );
151+ Validators::validateApiSecret ($ options [ ' apiSecret ' ] );
152+ Validators::validateApiUrl ($ options [ ' apiUrl ' ] );
136153
137- $ this ->client ->configure ($ apiKey , $ apiSecret , $ apiUrl );
154+ $ this ->client ->configure ($ options [ ' apiKey ' ] , $ options [ ' apiSecret ' ] , $ options [ ' apiUrl ' ] );
138155 }
139156 }
140157
@@ -148,7 +165,6 @@ public function __get($name)
148165 case 'partnerId ' :
149166 case 'sessionId ' :
150167 case 'broadcastUrls ' :
151- case 'status ' :
152168 case 'maxDuration ' :
153169 case 'streamMode ' :
154170 return $ this ->data [$ name ];
@@ -170,6 +186,10 @@ public function __get($name)
170186 return $ this ->hasAudio ;
171187 case 'hasVideo ' :
172188 return $ this ->hasVideo ;
189+ case 'status ' :
190+ return $ this ->status ;
191+ case 'maxBitRate ' :
192+ return $ this ->maxBitRate ;
173193 default :
174194 return null ;
175195 }
0 commit comments