Skip to content

Commit a8b636c

Browse files
author
Manik Sachdeva
authored
Merge pull request #236 from opentok/dev
v4.4.0
2 parents 3bc33d5 + 1c72c46 commit a8b636c

File tree

7 files changed

+120
-51
lines changed

7 files changed

+120
-51
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Add this package (`opentok/opentok`) to your `composer.json` file, or just run t
2020
command line:
2121

2222
```
23-
$ ./composer.phar require opentok/opentok 4.3.x
23+
$ ./composer.phar require opentok/opentok 4.4.x
2424
```
2525

2626
### Manually:
@@ -255,16 +255,18 @@ You can only start live streaming broadcasts for sessions that use the OpenTok M
255255
Start the live streaming broadcast of an OpenTok Session using the
256256
`startBroadcast($sessionId, $options)` method of the `OpenTok\OpenTok` class.
257257
This will return an `OpenTok\Broadcast` instance. The `$options` parameter is
258-
an optional array used to assign a layout type for the broadcast.
258+
an optional array used to assign broadcast options such as layout, maxDuration, resolution, and more.
259259

260260
```php
261261
// Start a live streaming broadcast of a session
262262
$broadcast = $opentok->startBroadcast($sessionId);
263263

264264

265-
// Start a live streaming broadcast of a session, setting a layout type
265+
// Start a live streaming broadcast of a session, using broadcast options
266266
$options = array(
267-
'layout' => Layout::getBestFit()
267+
'layout' => Layout::getBestFit(),
268+
'maxDuration' => 5400,
269+
'resolution' => '1280x720'
268270
);
269271
$broadcast = $opentok->startBroadcast($sessionId, $options);
270272

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: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
// TODO: build this dynamically
4040
/** @internal */
41-
define('OPENTOK_SDK_VERSION', '4.3.0');
41+
define('OPENTOK_SDK_VERSION', '4.4.0');
4242
/** @internal */
4343
define('OPENTOK_SDK_USER_AGENT', 'OpenTok-PHP-SDK/' . OPENTOK_SDK_VERSION);
4444

@@ -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) {

tests/OpenTok/ArchiveTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public function testStopsArchive()
156156
// TODO: test the dynamically built User Agent string
157157
$userAgent = $request->getHeaderLine('User-Agent');
158158
$this->assertNotEmpty($userAgent);
159-
$this->assertStringStartsWith('OpenTok-PHP-SDK/4.3.0', $userAgent);
159+
$this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent);
160160

161161
// TODO: test the properties of the actual archive object
162162
$this->assertEquals('stopped', $this->archive->status);
@@ -195,7 +195,7 @@ public function testDeletesArchive()
195195
// TODO: test the dynamically built User Agent string
196196
$userAgent = $request->getHeaderLine('User-Agent');
197197
$this->assertNotEmpty($userAgent);
198-
$this->assertStringStartsWith('OpenTok-PHP-SDK/4.3.0', $userAgent);
198+
$this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent);
199199

200200
$this->assertTrue($success);
201201
// TODO: assert that all properties of the archive object were cleared

0 commit comments

Comments
 (0)