@eluvio/elv-client-js 4.0.59 → 4.0.61

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.
@@ -27,7 +27,7 @@ var _require = require("./LogMessage"),
27
27
  var Pako = require("pako");
28
28
  var _require2 = require("./Validation"),
29
29
  ValidatePresence = _require2.ValidatePresence;
30
- var CBOR = require("cbor");
30
+ var CBOR = require("cbor-x");
31
31
  var networks = {
32
32
  "main": "https://main.net955305.contentfabric.io",
33
33
  "demo": "https://demov3.net955210.contentfabric.io",
@@ -554,7 +554,7 @@ var ElvClient = /*#__PURE__*/function () {
554
554
  _context7.next = 7;
555
555
  return Utils.LimitedMap(5, _toConsumableArray(new Array(n)), /*#__PURE__*/function () {
556
556
  var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_, index) {
557
- var bigi, addr, locatorsHex, nodeId, node, buffer, hex, locators, match, fabArray, i, host, endpoint;
557
+ var bigi, addr, locatorsHex, nodeId, node, locators, match, fabArray, i, host, endpoint;
558
558
  return _regeneratorRuntime.wrap(function _callee6$(_context6) {
559
559
  while (1) switch (_context6.prev = _context6.next) {
560
560
  case 0:
@@ -587,9 +587,11 @@ var ElvClient = /*#__PURE__*/function () {
587
587
  id: nodeId,
588
588
  endpoints: []
589
589
  }; // Parse locators CBOR
590
- buffer = locatorsHex.slice(2, locatorsHex.length); // Skip "0x"
591
- hex = buffer.toString("hex");
592
- locators = CBOR.decodeAllSync(hex);
590
+ console.log(locatorsHex);
591
+ //let buffer = locatorsHex.slice(2, locatorsHex.length); // Skip "0x"
592
+ //let hex = buffer.toString("hex");
593
+ console.log(locatorsHex.slice(2, -1));
594
+ locators = CBOR.decode(Buffer.from(locatorsHex.slice(2, -1), "hex"));
593
595
  match = false;
594
596
  if (!(locators.length >= 5)) {
595
597
  _context6.next = 31;
package/dist/src/Utils.js CHANGED
@@ -806,6 +806,36 @@ 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
+ _ref4$ultraLowLatency = _ref4.ultraLowLatency,
814
+ ultraLowLatency = _ref4$ultraLowLatency === void 0 ? false : _ref4$ultraLowLatency;
815
+ var isSafari = typeof window !== "undefined" && typeof window.navigator !== "undefined" && /^((?!chrome|android).)*safari/i.test(window.navigator.userAgent);
816
+ if (ultraLowLatency && !isSafari) {
817
+ return {
818
+ "capLevelToPlayerSize": false,
819
+ "enableWorker": true,
820
+ "lowLatencyMode": true,
821
+ "maxBufferLength": 8,
822
+ "backBufferLength": 4,
823
+ "liveSyncDuration": 4,
824
+ "liveMaxLatencyDuration": 5,
825
+ "liveDurationInfinity": false,
826
+ "highBufferWatchdogPeriod": 1
827
+ };
828
+ }
829
+ return {
830
+ "enableWorker": true,
831
+ "lowLatencyMode": true,
832
+ "maxBufferLength": 5,
833
+ "backBufferLength": 5,
834
+ "liveSyncDuration": 5,
835
+ "liveMaxLatencyDuration": !lowLatency || isSafari ? 15 : 10,
836
+ "liveDurationInfinity": false,
837
+ "highBufferWatchdogPeriod": 1
838
+ };
809
839
  }
810
840
  };
811
841
  module.exports = Utils;
@@ -50,31 +50,36 @@ exports.ListAccessGroups = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regener
50
50
  return _regeneratorRuntime.wrap(function _callee$(_context) {
51
51
  while (1) switch (_context.prev = _context.next) {
52
52
  case 0:
53
+ _context.prev = 0;
53
54
  id = _this.utils.AddressToHash(address);
54
- _context.next = 3;
55
+ _context.next = 4;
55
56
  return _this.ContentObjectMetadata({
56
57
  libraryId: _this.contentSpaceLibraryId,
57
58
  objectId: "iq__".concat(id)
58
59
  });
59
- case 3:
60
+ case 4:
60
61
  _context.t0 = _context.sent;
61
62
  if (_context.t0) {
62
- _context.next = 6;
63
+ _context.next = 7;
63
64
  break;
64
65
  }
65
66
  _context.t0 = {};
66
- case 6:
67
+ case 7:
67
68
  meta = _context.t0;
68
69
  return _context.abrupt("return", {
69
70
  address: address,
70
71
  id: "igrp".concat(id),
71
72
  meta: meta
72
73
  });
73
- case 8:
74
+ case 11:
75
+ _context.prev = 11;
76
+ _context.t1 = _context["catch"](0);
77
+ _this.Log(_context.t1, true);
78
+ case 14:
74
79
  case "end":
75
80
  return _context.stop();
76
81
  }
77
- }, _callee);
82
+ }, _callee, null, [[0, 11]]);
78
83
  }));
79
84
  return function (_x) {
80
85
  return _ref2.apply(this, arguments);
@@ -82,7 +87,9 @@ exports.ListAccessGroups = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regener
82
87
  }());
83
88
  case 5:
84
89
  groups = _context2.sent;
85
- return _context2.abrupt("return", groups.sort(function (a, b) {
90
+ return _context2.abrupt("return", groups.filter(function (g) {
91
+ return g;
92
+ }).sort(function (a, b) {
86
93
  var name1 = (a.meta["public"] || {}).name || "zz__".concat(a.address);
87
94
  var name2 = (b.meta["public"] || {}).name || "zz__".concat(b.address);
88
95
  return name1 < name2 ? -1 : 1;
@@ -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
  }
@@ -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
  }
@@ -15,26 +15,27 @@ var NotificationPath = function NotificationPath(_ref) {
15
15
  };
16
16
 
17
17
  /**
18
- * Push a notification to the current user
18
+ * Push a notification to a user
19
19
  *
20
20
  * @methodGroup Notifications
21
21
  * @param {string} tenantId - The tenant associated with this notification
22
22
  * @param {string} eventType - The type of the notification
23
23
  * @param {(Object | string)=} data - Data associated with this notification
24
+ * @param {string=} userAddress - Address of the user to notify. If not specified, it will be sent to the current user.
24
25
  */
25
26
  exports.PushNotification = /*#__PURE__*/function () {
26
27
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
27
- var tenantId, eventType, data;
28
+ var tenantId, eventType, data, userAddress;
28
29
  return _regeneratorRuntime.wrap(function _callee$(_context) {
29
30
  while (1) switch (_context.prev = _context.next) {
30
31
  case 0:
31
- tenantId = _ref2.tenantId, eventType = _ref2.eventType, data = _ref2.data;
32
+ tenantId = _ref2.tenantId, eventType = _ref2.eventType, data = _ref2.data, userAddress = _ref2.userAddress;
32
33
  _context.next = 3;
33
34
  return this.stateStoreClient.Request({
34
35
  method: "POST",
35
36
  path: NotificationPath({
36
37
  network: this.network,
37
- path: UrlJoin("notify_user", this.UserAddress(), tenantId, eventType)
38
+ path: UrlJoin("notify_user", userAddress || this.UserAddress(), tenantId, eventType)
38
39
  }),
39
40
  body: data,
40
41
  headers: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "4.0.59",
3
+ "version": "4.0.61",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
@@ -60,7 +60,8 @@
60
60
  "bn.js": "^5.1.1",
61
61
  "bs58": "^4.0.1",
62
62
  "buffer": "^5.2.1",
63
- "cbor": "^4.1.5",
63
+ "cbor-web": "^9.0.1",
64
+ "cbor-x": "^1.5.4",
64
65
  "columnify": "^1.5.4",
65
66
  "country-codes-list": "^1.6.8",
66
67
  "crocks": "^0.12.4",