@eluvio/elv-client-js 4.0.57 → 4.0.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/src/Utils.js CHANGED
@@ -806,6 +806,21 @@ var Utils = {
806
806
  } else {
807
807
  return Utils.PLATFORM_WEB;
808
808
  }
809
+ },
810
+ LiveHLSJSSettings: function LiveHLSJSSettings(_ref4) {
811
+ var _ref4$lowLatency = _ref4.lowLatency,
812
+ lowLatency = _ref4$lowLatency === void 0 ? false : _ref4$lowLatency;
813
+ var isSafari = typeof window !== "undefined" && typeof window.navigator !== "undefined" && /^((?!chrome|android).)*safari/i.test(window.navigator.userAgent);
814
+ return {
815
+ "enableWorker": true,
816
+ "lowLatencyMode": true,
817
+ "maxBufferLength": 5,
818
+ "backBufferLength": 5,
819
+ "liveSyncDuration": 5,
820
+ "liveMaxLatencyDuration": !lowLatency || isSafari ? 15 : 10,
821
+ "liveDurationInfinity": false,
822
+ "highBufferWatchdogPeriod": 1
823
+ };
809
824
  }
810
825
  };
811
826
  module.exports = Utils;
@@ -3244,6 +3244,16 @@ exports.ContentObjectImageUrl = /*#__PURE__*/function () {
3244
3244
  return _ref71.apply(this, arguments);
3245
3245
  };
3246
3246
  }();
3247
+ var EmbedMediaTypes = {
3248
+ "video": "v",
3249
+ "live_video": "lv",
3250
+ "audio": "a",
3251
+ "image": "i",
3252
+ "html": "h",
3253
+ "ebook": "b",
3254
+ "gallery": "g",
3255
+ "link": "l"
3256
+ };
3247
3257
 
3248
3258
  /**
3249
3259
  * Get an embed URL for the specified object
@@ -3253,6 +3263,14 @@ exports.ContentObjectImageUrl = /*#__PURE__*/function () {
3253
3263
  * @param {string} objectId - ID of the object
3254
3264
  * @param {string} versionHash - Version hash of the object
3255
3265
  * @param {number} duration - Time until the token expires, in milliseconds (1 day = 24 * 60 * 60 * 1000 = 86400000)
3266
+ * @param {string=} mediaType=video - The type of the media. Available options:
3267
+ - `video`
3268
+ - `live_video`
3269
+ - `audio`
3270
+ - `image`
3271
+ - `gallery`
3272
+ - `ebook`
3273
+ - `html`
3256
3274
  * @param {Object} options - Additional video/player options
3257
3275
  - `autoplay` - If enabled, video will autoplay. Note that videos block autoplay of videos with audio by default
3258
3276
  - `capLevelToPlayerSize` - Caps video quality to player size
@@ -3276,11 +3294,11 @@ exports.ContentObjectImageUrl = /*#__PURE__*/function () {
3276
3294
  */
3277
3295
  exports.EmbedUrl = /*#__PURE__*/function () {
3278
3296
  var _ref73 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41(_ref72) {
3279
- var objectId, versionHash, _ref72$duration, duration, _ref72$options, options, controlsMap, embedUrl, networkInfo, networkName, permission, data, _i, _Object$keys, option, token;
3297
+ var objectId, versionHash, _ref72$duration, duration, _ref72$mediaType, mediaType, _ref72$options, options, controlsMap, embedUrl, networkInfo, networkName, permission, data, _i, _Object$keys, option, token;
3280
3298
  return _regeneratorRuntime.wrap(function _callee41$(_context41) {
3281
3299
  while (1) switch (_context41.prev = _context41.next) {
3282
3300
  case 0:
3283
- objectId = _ref72.objectId, versionHash = _ref72.versionHash, _ref72$duration = _ref72.duration, duration = _ref72$duration === void 0 ? 86400000 : _ref72$duration, _ref72$options = _ref72.options, options = _ref72$options === void 0 ? {} : _ref72$options;
3301
+ objectId = _ref72.objectId, versionHash = _ref72.versionHash, _ref72$duration = _ref72.duration, duration = _ref72$duration === void 0 ? 86400000 : _ref72$duration, _ref72$mediaType = _ref72.mediaType, mediaType = _ref72$mediaType === void 0 ? "video" : _ref72$mediaType, _ref72$options = _ref72.options, options = _ref72$options === void 0 ? {} : _ref72$options;
3284
3302
  if (versionHash) {
3285
3303
  ValidateVersion(versionHash);
3286
3304
  } else if (objectId) {
@@ -3314,96 +3332,100 @@ exports.EmbedUrl = /*#__PURE__*/function () {
3314
3332
  } else if (objectId) {
3315
3333
  embedUrl.searchParams.set("oid", objectId);
3316
3334
  }
3335
+ embedUrl.searchParams.set("mt", EmbedMediaTypes[mediaType.toLowerCase()] || "v");
3317
3336
  data = {};
3318
3337
  _i = 0, _Object$keys = Object.keys(options);
3319
- case 17:
3338
+ case 18:
3320
3339
  if (!(_i < _Object$keys.length)) {
3321
- _context41.next = 59;
3340
+ _context41.next = 62;
3322
3341
  break;
3323
3342
  }
3324
3343
  option = _Object$keys[_i];
3325
3344
  _context41.t0 = option;
3326
- _context41.next = _context41.t0 === "autoplay" ? 22 : _context41.t0 === "capLevelToPlayerSize" ? 24 : _context41.t0 === "clipEnd" ? 26 : _context41.t0 === "clipStart" ? 28 : _context41.t0 === "controls" ? 30 : _context41.t0 === "description" ? 32 : _context41.t0 === "directLink" ? 34 : _context41.t0 === "linkPath" ? 36 : _context41.t0 === "loop" ? 38 : _context41.t0 === "muted" ? 40 : _context41.t0 === "offerings" ? 42 : _context41.t0 === "posterUrl" ? 44 : _context41.t0 === "protocols" ? 46 : _context41.t0 === "showShare" ? 48 : _context41.t0 === "showTitle" ? 50 : _context41.t0 === "title" ? 52 : _context41.t0 === "viewRecordKey" ? 54 : 56;
3345
+ _context41.next = _context41.t0 === "accountWatermark" ? 23 : _context41.t0 === "autoplay" ? 25 : _context41.t0 === "capLevelToPlayerSize" ? 27 : _context41.t0 === "clipEnd" ? 29 : _context41.t0 === "clipStart" ? 31 : _context41.t0 === "controls" ? 33 : _context41.t0 === "description" ? 35 : _context41.t0 === "directLink" ? 37 : _context41.t0 === "linkPath" ? 39 : _context41.t0 === "loop" ? 41 : _context41.t0 === "muted" ? 43 : _context41.t0 === "offerings" ? 45 : _context41.t0 === "posterUrl" ? 47 : _context41.t0 === "protocols" ? 49 : _context41.t0 === "showShare" ? 51 : _context41.t0 === "showTitle" ? 53 : _context41.t0 === "title" ? 55 : _context41.t0 === "viewRecordKey" ? 57 : 59;
3327
3346
  break;
3328
- case 22:
3347
+ case 23:
3348
+ embedUrl.searchParams.set("awm", "");
3349
+ return _context41.abrupt("break", 59);
3350
+ case 25:
3329
3351
  embedUrl.searchParams.set("ap", "");
3330
- return _context41.abrupt("break", 56);
3331
- case 24:
3352
+ return _context41.abrupt("break", 59);
3353
+ case 27:
3332
3354
  embedUrl.searchParams.set("cap", "");
3333
- return _context41.abrupt("break", 56);
3334
- case 26:
3355
+ return _context41.abrupt("break", 59);
3356
+ case 29:
3335
3357
  embedUrl.searchParams.set("end", options.clipEnd);
3336
- return _context41.abrupt("break", 56);
3337
- case 28:
3358
+ return _context41.abrupt("break", 59);
3359
+ case 31:
3338
3360
  embedUrl.searchParams.set("start", options.clipStart);
3339
- return _context41.abrupt("break", 56);
3340
- case 30:
3361
+ return _context41.abrupt("break", 59);
3362
+ case 33:
3341
3363
  if (options.controls !== "hide") {
3342
3364
  embedUrl.searchParams.set("ct", controlsMap[options.controls]);
3343
3365
  }
3344
- return _context41.abrupt("break", 56);
3345
- case 32:
3366
+ return _context41.abrupt("break", 59);
3367
+ case 35:
3346
3368
  data["og:description"] = options.description;
3347
- return _context41.abrupt("break", 56);
3348
- case 34:
3369
+ return _context41.abrupt("break", 59);
3370
+ case 37:
3349
3371
  embedUrl.searchParams.set("dr", "");
3350
- return _context41.abrupt("break", 56);
3351
- case 36:
3372
+ return _context41.abrupt("break", 59);
3373
+ case 39:
3352
3374
  embedUrl.searchParams.set("ln", this.utils.B64(options.linkPath));
3353
- return _context41.abrupt("break", 56);
3354
- case 38:
3375
+ return _context41.abrupt("break", 59);
3376
+ case 41:
3355
3377
  embedUrl.searchParams.set("lp", "");
3356
- return _context41.abrupt("break", 56);
3357
- case 40:
3378
+ return _context41.abrupt("break", 59);
3379
+ case 43:
3358
3380
  embedUrl.searchParams.set("m", "");
3359
- return _context41.abrupt("break", 56);
3360
- case 42:
3381
+ return _context41.abrupt("break", 59);
3382
+ case 45:
3361
3383
  embedUrl.searchParams.set("off", options.offerings.join(","));
3362
- return _context41.abrupt("break", 56);
3363
- case 44:
3384
+ return _context41.abrupt("break", 59);
3385
+ case 47:
3364
3386
  embedUrl.searchParams.set("pst", options.posterUrl);
3365
- return _context41.abrupt("break", 56);
3366
- case 46:
3387
+ return _context41.abrupt("break", 59);
3388
+ case 49:
3367
3389
  embedUrl.searchParams.set("ptc", options.protocols.join(","));
3368
- return _context41.abrupt("break", 56);
3369
- case 48:
3390
+ return _context41.abrupt("break", 59);
3391
+ case 51:
3370
3392
  embedUrl.searchParams.set("sh", "");
3371
- return _context41.abrupt("break", 56);
3372
- case 50:
3393
+ return _context41.abrupt("break", 59);
3394
+ case 53:
3373
3395
  embedUrl.searchParams.set("st", "");
3374
- return _context41.abrupt("break", 56);
3375
- case 52:
3396
+ return _context41.abrupt("break", 59);
3397
+ case 55:
3376
3398
  data["og:title"] = options.title;
3377
- return _context41.abrupt("break", 56);
3378
- case 54:
3399
+ return _context41.abrupt("break", 59);
3400
+ case 57:
3379
3401
  embedUrl.searchParams.set("vrk", options.viewRecordKey);
3380
- return _context41.abrupt("break", 56);
3381
- case 56:
3402
+ return _context41.abrupt("break", 59);
3403
+ case 59:
3382
3404
  _i++;
3383
- _context41.next = 17;
3405
+ _context41.next = 18;
3384
3406
  break;
3385
- case 59:
3407
+ case 62:
3386
3408
  if (Object.keys(data).length > 0) {
3387
3409
  embedUrl.searchParams.set("data", this.utils.B64(JSON.stringify({
3388
3410
  meta_tags: data
3389
3411
  })));
3390
3412
  }
3391
3413
  if (!["owner", "editable", "viewable"].includes(permission)) {
3392
- _context41.next = 65;
3414
+ _context41.next = 68;
3393
3415
  break;
3394
3416
  }
3395
- _context41.next = 63;
3417
+ _context41.next = 66;
3396
3418
  return this.CreateSignedToken({
3397
3419
  objectId: objectId,
3398
3420
  versionHash: versionHash,
3399
3421
  duration: duration
3400
3422
  });
3401
- case 63:
3423
+ case 66:
3402
3424
  token = _context41.sent;
3403
3425
  embedUrl.searchParams.set("ath", token);
3404
- case 65:
3426
+ case 68:
3405
3427
  return _context41.abrupt("return", embedUrl.toString());
3406
- case 66:
3428
+ case 69:
3407
3429
  case "end":
3408
3430
  return _context41.stop();
3409
3431
  }
@@ -2215,7 +2215,7 @@ exports.UpdateContentObjectGraph = /*#__PURE__*/function () {
2215
2215
  return _context30.delegateYield(_loop(), "t0", 8);
2216
2216
  case 8:
2217
2217
  _ret = _context30.t0;
2218
- if (!(_typeof(_ret) === "object")) {
2218
+ if (!_ret) {
2219
2219
  _context30.next = 11;
2220
2220
  break;
2221
2221
  }
@@ -1,3 +1,4 @@
1
+ var _toConsumableArray = require("@babel/runtime/helpers/toConsumableArray");
1
2
  var _defineProperty = require("@babel/runtime/helpers/defineProperty");
2
3
  var _regeneratorRuntime = require("@babel/runtime/regenerator");
3
4
  var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
@@ -772,7 +773,7 @@ exports.UploadStatus = /*#__PURE__*/function () {
772
773
  }();
773
774
  exports.UploadJobStatus = /*#__PURE__*/function () {
774
775
  var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref14) {
775
- var libraryId, objectId, writeToken, uploadId, jobId, path;
776
+ var libraryId, objectId, writeToken, uploadId, jobId, path, response, newResponse;
776
777
  return _regeneratorRuntime.wrap(function _callee9$(_context10) {
777
778
  while (1) switch (_context10.prev = _context10.next) {
778
779
  case 0:
@@ -795,17 +796,59 @@ exports.UploadJobStatus = /*#__PURE__*/function () {
795
796
  _context10.t2 = _context10.sent;
796
797
  _context10.t3 = path;
797
798
  _context10.t4 = {
799
+ start: 0,
800
+ limit: 10000
801
+ };
802
+ _context10.t5 = {
798
803
  headers: _context10.t2,
799
804
  method: "GET",
800
805
  path: _context10.t3,
801
- allowFailover: false
806
+ allowFailover: false,
807
+ queryParams: _context10.t4
802
808
  };
803
- _context10.t5 = _context10.t1.Request.call(_context10.t1, _context10.t4);
804
- _context10.next = 14;
805
- return _context10.t0.ResponseToJson.call(_context10.t0, _context10.t5);
806
- case 14:
807
- return _context10.abrupt("return", _context10.sent);
809
+ _context10.t6 = _context10.t1.Request.call(_context10.t1, _context10.t5);
810
+ _context10.next = 15;
811
+ return _context10.t0.ResponseToJson.call(_context10.t0, _context10.t6);
808
812
  case 15:
813
+ response = _context10.sent;
814
+ case 16:
815
+ if (!(response.next !== response.total && response.next >= 0)) {
816
+ _context10.next = 33;
817
+ break;
818
+ }
819
+ _context10.t7 = this.utils;
820
+ _context10.t8 = this.HttpClient;
821
+ _context10.next = 21;
822
+ return this.authClient.AuthorizationHeader({
823
+ libraryId: libraryId,
824
+ objectId: objectId,
825
+ update: true
826
+ });
827
+ case 21:
828
+ _context10.t9 = _context10.sent;
829
+ _context10.t10 = path;
830
+ _context10.t11 = {
831
+ start: response.next
832
+ };
833
+ _context10.t12 = {
834
+ headers: _context10.t9,
835
+ method: "GET",
836
+ path: _context10.t10,
837
+ allowFailover: false,
838
+ queryParams: _context10.t11
839
+ };
840
+ _context10.t13 = _context10.t8.Request.call(_context10.t8, _context10.t12);
841
+ _context10.next = 28;
842
+ return _context10.t7.ResponseToJson.call(_context10.t7, _context10.t13);
843
+ case 28:
844
+ newResponse = _context10.sent;
845
+ response.files = [].concat(_toConsumableArray(response.files), _toConsumableArray(newResponse.files));
846
+ response.next = newResponse.next;
847
+ _context10.next = 16;
848
+ break;
849
+ case 33:
850
+ return _context10.abrupt("return", response);
851
+ case 34:
809
852
  case "end":
810
853
  return _context10.stop();
811
854
  }
@@ -37,14 +37,14 @@ var LadderTemplate = {
37
37
  stream_name: "video",
38
38
  width: 960
39
39
  },
40
- "360": {
41
- bit_rate: 520000,
40
+ "540_low": {
41
+ bit_rate: 900000,
42
42
  codecs: "avc1.640028,mp4a.40.2",
43
- height: 360,
43
+ height: 540,
44
44
  media_type: 1,
45
- representation: "videovideo_640x360_h264@520000",
45
+ representation: "videovideo_960x540_h264@900000",
46
46
  stream_name: "video",
47
- width: 640
47
+ width: 960
48
48
  }
49
49
  };
50
50
  var LiveconfTemplate = {
@@ -235,9 +235,13 @@ var LiveConf = /*#__PURE__*/function () {
235
235
  }
236
236
  }, {
237
237
  key: "generateLiveConf",
238
- value: function generateLiveConf() {
238
+ value: function generateLiveConf(_ref2) {
239
+ var audioBitrate = _ref2.audioBitrate,
240
+ audioIndex = _ref2.audioIndex,
241
+ partTtl = _ref2.partTtl,
242
+ channelLayout = _ref2.channelLayout;
239
243
  // gather required data
240
- var conf = LiveconfTemplate;
244
+ var conf = JSON.parse(JSON.stringify(LiveconfTemplate));
241
245
  var fileName = this.overwriteOriginUrl || this.probeData.format.filename;
242
246
  var audioStream = this.getStreamDataForCodecType("audio");
243
247
  var sampleRate = parseInt(audioStream.sample_rate);
@@ -253,13 +257,16 @@ var LiveConf = /*#__PURE__*/function () {
253
257
  conf.live_recording.recording_config.recording_params.origin_url = fileName;
254
258
  conf.live_recording.recording_config.recording_params.description = "Ingest stream ".concat(fileName);
255
259
  conf.live_recording.recording_config.recording_params.name = "Ingest stream ".concat(fileName);
256
- conf.live_recording.recording_config.recording_params.xc_params.audio_index[0] = audioStream.stream_index;
260
+ conf.live_recording.recording_config.recording_params.xc_params.audio_index[0] = audioIndex === undefined ? audioStream.stream_index : audioIndex;
257
261
  conf.live_recording.recording_config.recording_params.xc_params.sample_rate = sampleRate;
258
262
  conf.live_recording.recording_config.recording_params.xc_params.enc_height = videoStream.height;
259
263
  conf.live_recording.recording_config.recording_params.xc_params.enc_width = videoStream.width;
260
264
  if (this.syncAudioToVideo) {
261
265
  conf.live_recording.recording_config.recording_params.xc_params.sync_audio_to_stream_id = this.syncAudioToStreamIdValue();
262
266
  }
267
+ if (partTtl) {
268
+ conf.live_recording.recording_config.recording_params.part_ttl = partTtl;
269
+ }
263
270
 
264
271
  // Fill in specifics for protocol
265
272
  switch (this.probeKind()) {
@@ -289,38 +296,44 @@ var LiveConf = /*#__PURE__*/function () {
289
296
  conf.live_recording.recording_config.recording_params.xc_params.force_keyint = segDurations.keyint;
290
297
  switch (videoStream.height) {
291
298
  case 2160:
292
- conf.live_recording.recording_config.recording_params.ladder_specs.unshift(LadderTemplate[2160], LadderTemplate[1080], LadderTemplate[720], LadderTemplate[540], LadderTemplate[360]);
299
+ conf.live_recording.recording_config.recording_params.ladder_specs.unshift(LadderTemplate[2160], LadderTemplate[1080], LadderTemplate[720], LadderTemplate[540], LadderTemplate["540_low"]);
293
300
  conf.live_recording.recording_config.recording_params.xc_params.video_bitrate = LadderTemplate[2160].bit_rate;
294
301
  conf.live_recording.recording_config.recording_params.xc_params.enc_height = 2160;
295
302
  conf.live_recording.recording_config.recording_params.xc_params.enc_width = 3840;
296
303
  break;
297
304
  case 1080:
298
- conf.live_recording.recording_config.recording_params.ladder_specs.unshift(LadderTemplate[1080], LadderTemplate[720], LadderTemplate[540], LadderTemplate[360]);
305
+ conf.live_recording.recording_config.recording_params.ladder_specs.unshift(LadderTemplate[1080], LadderTemplate[720], LadderTemplate[540], LadderTemplate["540_low"]);
299
306
  conf.live_recording.recording_config.recording_params.xc_params.video_bitrate = LadderTemplate[1080].bit_rate;
300
307
  conf.live_recording.recording_config.recording_params.xc_params.enc_height = 1080;
301
308
  conf.live_recording.recording_config.recording_params.xc_params.enc_width = 1920;
302
309
  break;
303
310
  case 720:
304
- conf.live_recording.recording_config.recording_params.ladder_specs.unshift(LadderTemplate[720], LadderTemplate[540], LadderTemplate[360]);
311
+ conf.live_recording.recording_config.recording_params.ladder_specs.unshift(LadderTemplate[720], LadderTemplate[540], LadderTemplate["540_low"]);
305
312
  conf.live_recording.recording_config.recording_params.xc_params.video_bitrate = LadderTemplate[720].bit_rate;
306
313
  conf.live_recording.recording_config.recording_params.xc_params.enc_height = 720;
307
314
  conf.live_recording.recording_config.recording_params.xc_params.enc_width = 1280;
308
315
  break;
309
316
  case 540:
310
- conf.live_recording.recording_config.recording_params.ladder_specs.unshift(LadderTemplate[540], LadderTemplate[360]);
317
+ conf.live_recording.recording_config.recording_params.ladder_specs.unshift(LadderTemplate[540], LadderTemplate["540_low"]);
311
318
  conf.live_recording.recording_config.recording_params.xc_params.video_bitrate = LadderTemplate[540].bit_rate;
312
319
  conf.live_recording.recording_config.recording_params.xc_params.enc_height = 540;
313
320
  conf.live_recording.recording_config.recording_params.xc_params.enc_width = 960;
314
321
  break;
315
- case 360:
316
- conf.live_recording.recording_config.recording_params.ladder_specs.unshift(LadderTemplate[360]);
317
- conf.live_recording.recording_config.recording_params.ladder_specs.unshift(LadderTemplate[360]);
318
- conf.live_recording.recording_config.recording_params.xc_params.video_bitrate = LadderTemplate[360].bit_rate;
319
- conf.live_recording.recording_config.recording_params.xc_params.enc_height = 360;
320
- conf.live_recording.recording_config.recording_params.xc_params.enc_width = 640;
321
- break;
322
322
  default:
323
- throw new Error("ERROR: Probed stream does not conform to one of the following built in resolution ladders [4096, 2160], [1920, 1080] [1280, 720], [960, 540], [640, 360]");
323
+ throw new Error("ERROR: Probed stream does not conform to one of the following built in resolution ladders [4096, 2160], [1920, 1080] [1280, 720], [960, 540]");
324
+ }
325
+ if (audioBitrate || channelLayout) {
326
+ var audioLadderSpec = conf.live_recording.recording_config.recording_params.ladder_specs.find(function (spec) {
327
+ return spec.stream_name === "audio";
328
+ });
329
+ if (audioBitrate) {
330
+ conf.live_recording.recording_config.recording_params.xc_params.audio_bitrate = audioBitrate;
331
+ audioLadderSpec.bit_rate = audioBitrate;
332
+ audioLadderSpec.representation = "audioaudio_aac@".concat(audioBitrate);
333
+ }
334
+ if (channelLayout) {
335
+ audioLadderSpec.channels = channelLayout;
336
+ }
324
337
  }
325
338
  return JSON.stringify(conf, null, 2);
326
339
  }
@@ -346,7 +346,7 @@ exports.StreamStatus = /*#__PURE__*/function () {
346
346
  if (networkInfo.name.includes("demo")) {
347
347
  embed_net = "demo";
348
348
  }
349
- embed_url = "https://embed.v3.contentfabric.io/?net=".concat(embed_net, "&p&ct=h&oid=").concat(conf.objectId, "&mt=v&ath=").concat(token);
349
+ embed_url = "https://embed.v3.contentfabric.io/?net=".concat(embed_net, "&p&ct=h&oid=").concat(conf.objectId, "&mt=lv&ath=").concat(token);
350
350
  playout_urls.embed_url = embed_url;
351
351
  status.playout_urls = playout_urls;
352
352
  case 128:
@@ -1310,11 +1310,11 @@ exports.LoadConf = /*#__PURE__*/function () {
1310
1310
  */
1311
1311
  exports.StreamConfig = /*#__PURE__*/function () {
1312
1312
  var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref11) {
1313
- var name, conf, status, libraryId, mainMeta, userConfig, hostName, streamUrl, nodes, node, endpoint, probe, controller, timeoutId, probeUrl, lc, liveRecordingConfigStr, liveRecordingConfig, e, writeToken;
1313
+ var name, customSettings, conf, status, libraryId, mainMeta, userConfig, hostName, streamUrl, nodes, node, endpoint, probe, controller, timeoutId, probeUrl, lc, liveRecordingConfigStr, liveRecordingConfig, e, writeToken;
1314
1314
  return _regeneratorRuntime.wrap(function _callee6$(_context6) {
1315
1315
  while (1) switch (_context6.prev = _context6.next) {
1316
1316
  case 0:
1317
- name = _ref11.name;
1317
+ name = _ref11.name, customSettings = _ref11.customSettings;
1318
1318
  _context6.next = 3;
1319
1319
  return this.LoadConf({
1320
1320
  name: name
@@ -1422,9 +1422,14 @@ exports.StreamConfig = /*#__PURE__*/function () {
1422
1422
  console.log("PROBE", probe);
1423
1423
  probe.format.filename = streamUrl.href;
1424
1424
 
1425
- // Create live reocording config
1425
+ // Create live recording config
1426
1426
  lc = new LiveConf(probe, node.id, endpoint, false, false, true);
1427
- liveRecordingConfigStr = lc.generateLiveConf();
1427
+ liveRecordingConfigStr = lc.generateLiveConf({
1428
+ audioBitrate: customSettings.audioBitrate,
1429
+ audioIndex: customSettings.audioIndex,
1430
+ partTtl: customSettings.partTtl,
1431
+ channelLayout: customSettings.channelLayout
1432
+ });
1428
1433
  liveRecordingConfig = JSON.parse(liveRecordingConfigStr);
1429
1434
  console.log("CONFIG", JSON.stringify(liveRecordingConfig.live_recording));
1430
1435
 
@@ -1447,16 +1452,25 @@ exports.StreamConfig = /*#__PURE__*/function () {
1447
1452
  });
1448
1453
  case 66:
1449
1454
  _context6.next = 68;
1455
+ return this.ReplaceMetadata({
1456
+ libraryId: libraryId,
1457
+ objectId: conf.objectId,
1458
+ writeToken: writeToken,
1459
+ metadataSubtree: "probe",
1460
+ metadata: probe
1461
+ });
1462
+ case 68:
1463
+ _context6.next = 70;
1450
1464
  return this.FinalizeContentObject({
1451
1465
  libraryId: libraryId,
1452
1466
  objectId: conf.objectId,
1453
1467
  writeToken: writeToken,
1454
1468
  commitMessage: "Apply live stream configuration"
1455
1469
  });
1456
- case 68:
1470
+ case 70:
1457
1471
  status.fin = _context6.sent;
1458
1472
  return _context6.abrupt("return", status);
1459
- case 70:
1473
+ case 72:
1460
1474
  case "end":
1461
1475
  return _context6.stop();
1462
1476
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "4.0.57",
3
+ "version": "4.0.58",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
@@ -35,14 +35,14 @@ const LadderTemplate = {
35
35
  stream_name: "video",
36
36
  width: 960
37
37
  },
38
- "360": {
39
- bit_rate: 520000,
38
+ "540_low": {
39
+ bit_rate: 900000,
40
40
  codecs: "avc1.640028,mp4a.40.2",
41
- height: 360,
41
+ height: 540,
42
42
  media_type: 1,
43
- representation: "videovideo_640x360_h264@520000",
43
+ representation: "videovideo_960x540_h264@900000",
44
44
  stream_name: "video",
45
- width: 640
45
+ width: 960
46
46
  }
47
47
  };
48
48
 
@@ -236,9 +236,9 @@ class LiveConf {
236
236
  return sync_id;
237
237
  }
238
238
 
239
- generateLiveConf() {
239
+ generateLiveConf({audioBitrate, audioIndex, partTtl, channelLayout}) {
240
240
  // gather required data
241
- const conf = LiveconfTemplate;
241
+ const conf = JSON.parse(JSON.stringify(LiveconfTemplate));
242
242
  const fileName = this.overwriteOriginUrl || this.probeData.format.filename;
243
243
  const audioStream = this.getStreamDataForCodecType("audio");
244
244
  const sampleRate = parseInt(audioStream.sample_rate);
@@ -255,7 +255,7 @@ class LiveConf {
255
255
  conf.live_recording.recording_config.recording_params.origin_url = fileName;
256
256
  conf.live_recording.recording_config.recording_params.description = `Ingest stream ${fileName}`;
257
257
  conf.live_recording.recording_config.recording_params.name = `Ingest stream ${fileName}`;
258
- conf.live_recording.recording_config.recording_params.xc_params.audio_index[0] = audioStream.stream_index;
258
+ conf.live_recording.recording_config.recording_params.xc_params.audio_index[0] = audioIndex === undefined ? audioStream.stream_index : audioIndex;
259
259
  conf.live_recording.recording_config.recording_params.xc_params.sample_rate = sampleRate;
260
260
  conf.live_recording.recording_config.recording_params.xc_params.enc_height = videoStream.height;
261
261
  conf.live_recording.recording_config.recording_params.xc_params.enc_width = videoStream.width;
@@ -264,6 +264,10 @@ class LiveConf {
264
264
  conf.live_recording.recording_config.recording_params.xc_params.sync_audio_to_stream_id = this.syncAudioToStreamIdValue();
265
265
  }
266
266
 
267
+ if(partTtl) {
268
+ conf.live_recording.recording_config.recording_params.part_ttl = partTtl;
269
+ }
270
+
267
271
  // Fill in specifics for protocol
268
272
  switch(this.probeKind()) {
269
273
  case "udp":
@@ -297,7 +301,7 @@ class LiveConf {
297
301
  LadderTemplate[1080],
298
302
  LadderTemplate[720],
299
303
  LadderTemplate[540],
300
- LadderTemplate[360]
304
+ LadderTemplate["540_low"]
301
305
  );
302
306
  conf.live_recording.recording_config.recording_params.xc_params.video_bitrate = LadderTemplate[2160].bit_rate;
303
307
  conf.live_recording.recording_config.recording_params.xc_params.enc_height = 2160;
@@ -309,7 +313,7 @@ class LiveConf {
309
313
  LadderTemplate[1080],
310
314
  LadderTemplate[720],
311
315
  LadderTemplate[540],
312
- LadderTemplate[360]
316
+ LadderTemplate["540_low"]
313
317
  );
314
318
  conf.live_recording.recording_config.recording_params.xc_params.video_bitrate = LadderTemplate[1080].bit_rate;
315
319
  conf.live_recording.recording_config.recording_params.xc_params.enc_height = 1080;
@@ -319,7 +323,7 @@ class LiveConf {
319
323
  conf.live_recording.recording_config.recording_params.ladder_specs.unshift(
320
324
  LadderTemplate[720],
321
325
  LadderTemplate[540],
322
- LadderTemplate[360]
326
+ LadderTemplate["540_low"]
323
327
  );
324
328
  conf.live_recording.recording_config.recording_params.xc_params.video_bitrate = LadderTemplate[720].bit_rate;
325
329
  conf.live_recording.recording_config.recording_params.xc_params.enc_height = 720;
@@ -328,21 +332,28 @@ class LiveConf {
328
332
  case 540:
329
333
  conf.live_recording.recording_config.recording_params.ladder_specs.unshift(
330
334
  LadderTemplate[540],
331
- LadderTemplate[360]
335
+ LadderTemplate["540_low"]
332
336
  );
333
337
  conf.live_recording.recording_config.recording_params.xc_params.video_bitrate = LadderTemplate[540].bit_rate;
334
338
  conf.live_recording.recording_config.recording_params.xc_params.enc_height = 540;
335
339
  conf.live_recording.recording_config.recording_params.xc_params.enc_width = 960;
336
340
  break;
337
- case 360:
338
- conf.live_recording.recording_config.recording_params.ladder_specs.unshift(LadderTemplate[360]);
339
- conf.live_recording.recording_config.recording_params.ladder_specs.unshift(LadderTemplate[360]);
340
- conf.live_recording.recording_config.recording_params.xc_params.video_bitrate = LadderTemplate[360].bit_rate;
341
- conf.live_recording.recording_config.recording_params.xc_params.enc_height = 360;
342
- conf.live_recording.recording_config.recording_params.xc_params.enc_width = 640;
343
- break;
344
341
  default:
345
- throw new Error("ERROR: Probed stream does not conform to one of the following built in resolution ladders [4096, 2160], [1920, 1080] [1280, 720], [960, 540], [640, 360]");
342
+ throw new Error("ERROR: Probed stream does not conform to one of the following built in resolution ladders [4096, 2160], [1920, 1080] [1280, 720], [960, 540]");
343
+ }
344
+
345
+ if(audioBitrate || channelLayout) {
346
+ const audioLadderSpec = conf.live_recording.recording_config.recording_params.ladder_specs.find(spec => spec.stream_name === "audio");
347
+
348
+ if(audioBitrate) {
349
+ conf.live_recording.recording_config.recording_params.xc_params.audio_bitrate = audioBitrate;
350
+ audioLadderSpec.bit_rate = audioBitrate;
351
+ audioLadderSpec.representation = `audioaudio_aac@${audioBitrate}`;
352
+ }
353
+
354
+ if(channelLayout) {
355
+ audioLadderSpec.channels = channelLayout;
356
+ }
346
357
  }
347
358
 
348
359
  return JSON.stringify(conf, null, 2);
@@ -1118,7 +1118,7 @@ exports.LoadConf = async function({name}) {
1118
1118
  * @return {Object} - The status response for the stream
1119
1119
  *
1120
1120
  */
1121
- exports.StreamConfig = async function({name}) {
1121
+ exports.StreamConfig = async function({name, customSettings}) {
1122
1122
  let conf = await this.LoadConf({name});
1123
1123
  let status = {name};
1124
1124
 
@@ -1191,10 +1191,15 @@ exports.StreamConfig = async function({name}) {
1191
1191
  console.log("PROBE", probe);
1192
1192
  probe.format.filename = streamUrl.href;
1193
1193
 
1194
- // Create live reocording config
1194
+ // Create live recording config
1195
1195
  let lc = new LiveConf(probe, node.id, endpoint, false, false, true);
1196
1196
 
1197
- const liveRecordingConfigStr = lc.generateLiveConf();
1197
+ const liveRecordingConfigStr = lc.generateLiveConf({
1198
+ audioBitrate: customSettings.audioBitrate,
1199
+ audioIndex: customSettings.audioIndex,
1200
+ partTtl: customSettings.partTtl,
1201
+ channelLayout: customSettings.channelLayout
1202
+ });
1198
1203
  let liveRecordingConfig = JSON.parse(liveRecordingConfigStr);
1199
1204
  console.log("CONFIG", JSON.stringify(liveRecordingConfig.live_recording));
1200
1205
 
@@ -1213,6 +1218,14 @@ exports.StreamConfig = async function({name}) {
1213
1218
  metadata: liveRecordingConfig.live_recording
1214
1219
  });
1215
1220
 
1221
+ await this.ReplaceMetadata({
1222
+ libraryId,
1223
+ objectId: conf.objectId,
1224
+ writeToken,
1225
+ metadataSubtree: "probe",
1226
+ metadata: probe
1227
+ });
1228
+
1216
1229
  status.fin = await this.FinalizeContentObject({
1217
1230
  libraryId,
1218
1231
  objectId: conf.objectId,