Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"johnstevenson/json-works": "~1.1",
"firebase/php-jwt": "^6.11",
"guzzlehttp/guzzle": "~6.0|~7.0",
"ext-json": "*",
"ext-json": "*",
"vonage/jwt": "^0.5.1"
},
"require-dev": {
Expand Down
5 changes: 5 additions & 0 deletions src/OpenTok/Archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ public function __construct($archiveData, $options = array())
Validators::validateClient($client);
Validators::validateHasStreamMode($streamMode);

if (isset($archiveData['maxBitrate']) && isset($archiveData['quantizationParameter'])) {
throw new \DomainException('Max Bitrate cannot be set with QuantizationParameter ');
}

$this->data = $archiveData;

if (isset($this->data['multiArchiveTag'])) {
Expand Down Expand Up @@ -179,6 +183,7 @@ public function __get($name)
case 'resolution':
case 'streamMode':
case 'maxBitrate':
case 'quantizationParameter':
return $this->data[$name];
case 'multiArchiveTag':
return $this->multiArchiveTag;
Expand Down
3 changes: 3 additions & 0 deletions src/OpenTok/OpenTok.php
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,9 @@ public function disableForceMute(string $sessionId, array $options): bool
* <li><code>maxBitRate</code> &mdash; Max Bitrate allowed for the broadcast composing. Must be between
* 400000 and 2000000.</li>
*
* <li><code>quantizationParameter</code> &mdash; quantization parameter (QP) is an optional video encoding
* value allowed for composed archiving, smaller values generate higher quality and larger archives</li>
*
* <li><code>outputs</code> (Array) &mdash;
* Defines the HLS broadcast and RTMP streams. You can provide the following keys:
* <ul>
Expand Down
14 changes: 12 additions & 2 deletions tests/OpenTokTest/ArchiveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static function setUpBeforeClass(): void
self::$mockBasePath = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'mock' . DIRECTORY_SEPARATOR;
}

public function setupArchives($streamMode)
public function setupArchives($streamMode, $quantization = false)
{
// Set up fixtures
$this->archiveData = array(
Expand All @@ -49,9 +49,15 @@ public function setupArchives($streamMode)
'outputMode' => 'composed',
'resolution' => '640x480',
'streamMode' => $streamMode,
'multiArchiveTag' => true
'multiArchiveTag' => true,
'maxBitrate' => 400000,
);

if ($quantization) {
unset($this->archiveData['maxBitrate']);
$this->archiveData['quantizationParameter'] = 40;
}

$this->archive = new Archive($this->archiveData, array(
'apiKey' => $this->API_KEY,
'apiSecret' => $this->API_SECRET,
Expand Down Expand Up @@ -127,6 +133,10 @@ public function testReadsProperties()
$this->assertEquals($this->archiveData['resolution'], $this->archive->resolution);
$this->assertEquals($this->archiveData['streamMode'], $this->archive->streamMode);
$this->assertEquals($this->archiveData['multiArchiveTag'], $this->archive->multiArchiveTag);
$this->assertEquals($this->archiveData['maxBitrate'], $this->archive->maxBitrate);

$this->setupArchives(StreamMode::AUTO, true);
$this->assertEquals($this->archiveData['quantizationParameter'], $this->archive->quantizationParameter);
}

public function testStopsArchive()
Expand Down
Loading