Skip to content

Commit

Permalink
Added maxbitrate to archives
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonmantank committed Nov 27, 2024
1 parent d18c642 commit 955f484
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/archiving.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ exports.startArchive = function (ot, config, sessionId, options, callback) {
layout: options.layout,
resolution: options.resolution,
streamMode: options.streamMode,
multiArchiveTag: options.multiArchiveTag
multiArchiveTag: options.multiArchiveTag,
maxBitrate: options.maxBitrate,
},
function startArchiveCallback(err, response, body) {
if (err) {
Expand Down
7 changes: 7 additions & 0 deletions lib/opentok.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,13 @@ OpenTok = function (apiKey, apiSecret, env) {
* unique <code>multiArchiveTag</code> you can only record one archive at a time for a
* given session.
* </li>
* <li>
* <code>maxBitrate</code> (Number) &mdash; The maximum video bitrate for the archive,
* in bits per second. This option is only valid for composed archives. Set the maximum
* video bitrate to control the size of the composed archive. This maximum bitrate
* applies to the video bitrate only. If the output archive has audio, those bits will be
* excluded from the limit.
* </li>
* </ul>
*
* For more information on archiving and the archive file formats, see the
Expand Down
22 changes: 22 additions & 0 deletions spec/opentok_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,28 @@ describe('Archiving', function () {
});
});

it('should be able to archive with maxBitrate set to 300000', function (done) {
nock(archiveHostUrl)
.post(archiveResource, { sessionId: mockSessionId, hasAudio: true, hasVideo: false, maxBitrate: 300000 })
.reply(
200,
'{\n "createdAt" : 1391149936527,\n "duration" : 0,\n "id" : "4072fe0f-d499-4f2f-8237-64f5a9d936f5",\n "name" : null,\n "partnerId" : "APIKEY",\n "reason" : "",\n "sessionId" : "1_MX4xMDB-MTI3LjAuMC4xflR1ZSBKYW4gMjggMTU6NDg6NDAgUFNUIDIwMTR-MC43NjAyOTYyfg",\n "size" : 0,\n "status" : "started",\n "maxBitrate" : 300000,\n "url" : null\n}',
{
server: 'nginx',
date: 'Fri, 31 Jan 2014 06:32:16 GMT',
'content-type': 'application/json',
'transfer-encoding': 'chunked',
connection: 'keep-alive'
}
);

opentok.startArchive(mockSessionId, { hasAudio: true, hasVideo: false, maxBitrate: 300000 }, function (err, archive) {
expect(err).toBeNull();
expect(archive.maxBitrate).toEqual(300000)
done();
});
});

it('should be able to archive if outputMode is individual', function (done) {
nock(archiveHostUrl)
.post(archiveResource, { sessionId: mockSessionId, outputMode: 'individual' })
Expand Down

0 comments on commit 955f484

Please sign in to comment.