Skip to content

Commit e3c1695

Browse files
thieumlabsManik Sachdeva
authored andcommitted
Send options like maxDuration and resolution to startBroadcast (#232)
* get new options : status, maxDuration and resolution * send options like maxDuration and resolution to startBroadcast
1 parent 687c7f0 commit e3c1695

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

src/OpenTok/Broadcast.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ public function __get($name)
8787
case 'partnerId':
8888
case 'sessionId':
8989
case 'broadcastUrls':
90+
case 'status':
91+
case 'maxDuration':
92+
case 'resolution':
9093
return $this->data[$name];
9194
break;
9295
case 'hlsUrl':

src/OpenTok/OpenTok.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ public function startBroadcast($sessionId, $options=array())
504504
$defaults = array(
505505
'layout' => Layout::getBestFit()
506506
);
507-
$options = array_merge($defaults, array_intersect_key($options, $defaults));
507+
$options = array_merge($defaults, $options);
508508
list($layout) = array_values($options);
509509

510510
// validate arguments

src/OpenTok/Util/Client.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,13 +280,17 @@ public function startBroadcast($sessionId, $options)
280280
'/v2/project/'.$this->apiKey.'/broadcast'
281281
);
282282

283+
$optionsJson = [
284+
'sessionId' => $sessionId,
285+
'layout' => $options['layout']->jsonSerialize()
286+
];
287+
unset($options['layout']);
288+
$optionsJson = array_merge($optionsJson, $options);
289+
283290
try {
284291
$response = $this->client->send($request, [
285292
'debug' => $this->isDebug(),
286-
'json' => [
287-
'sessionId' => $sessionId,
288-
'layout' => $options['layout']->jsonSerialize()
289-
]
293+
'json' => $optionsJson
290294
]);
291295
$broadcastJson = json_decode($response->getBody(), true);
292296
} catch (\Exception $e) {

0 commit comments

Comments
 (0)