diff --git a/lib/archiving.js b/lib/archiving.js
index 381db3e2..625ac299 100644
--- a/lib/archiving.js
+++ b/lib/archiving.js
@@ -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) {
diff --git a/lib/opentok.js b/lib/opentok.js
index 266ad3d5..f5e52a39 100644
--- a/lib/opentok.js
+++ b/lib/opentok.js
@@ -210,6 +210,13 @@ OpenTok = function (apiKey, apiSecret, env) {
* unique multiArchiveTag
you can only record one archive at a time for a
* given session.
*
+ *
+ * maxBitrate
(Number) — 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.
+ *
*
*
* For more information on archiving and the archive file formats, see the
diff --git a/spec/opentok_spec.js b/spec/opentok_spec.js
index 7fc5a3cf..48d88e10 100644
--- a/spec/opentok_spec.js
+++ b/spec/opentok_spec.js
@@ -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' })