Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added maxbitrate to archives #342

Merged
merged 1 commit into from
Nov 27, 2024
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
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