@eluvio/elv-client-js 4.0.85 → 4.0.87

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.
Files changed (39) hide show
  1. package/dist/ElvClient-min.js +12 -13
  2. package/dist/ElvClient-node-min.js +13 -14
  3. package/dist/ElvFrameClient-min.js +9 -9
  4. package/dist/ElvPermissionsClient-min.js +10 -10
  5. package/dist/ElvWalletClient-min.js +13 -14
  6. package/dist/ElvWalletClient-node-min.js +13 -14
  7. package/dist/src/AuthorizationClient.js +5 -4
  8. package/dist/src/Crypto.js +2 -2
  9. package/dist/src/ElvClient.js +2 -2
  10. package/dist/src/EthClient.js +2 -2
  11. package/dist/src/FrameClient.js +3 -3
  12. package/dist/src/PermissionsClient.js +2 -2
  13. package/dist/src/Utils.js +2 -2
  14. package/dist/src/abr_profiles/abr_profile_live_to_vod.js +0 -7
  15. package/dist/src/client/ABRPublishing.js +2 -2
  16. package/dist/src/client/AccessGroups.js +2 -2
  17. package/dist/src/client/ContentAccess.js +757 -821
  18. package/dist/src/client/ContentManagement.js +6 -59
  19. package/dist/src/client/Contracts.js +2 -2
  20. package/dist/src/client/Files.js +2 -2
  21. package/dist/src/client/LiveConf.js +35 -144
  22. package/dist/src/client/LiveStream.js +529 -1054
  23. package/dist/src/client/NFT.js +2 -2
  24. package/dist/src/walletClient/ClientMethods.js +2 -2
  25. package/dist/src/walletClient/Profile.js +2 -2
  26. package/dist/src/walletClient/Utils.js +2 -2
  27. package/dist/src/walletClient/index.js +2 -2
  28. package/package.json +1 -1
  29. package/src/ContentObjectAudit.js +98 -0
  30. package/src/ElvClient.js +86 -83
  31. package/src/FrameClient.js +2 -1
  32. package/src/HttpClient.js +36 -4
  33. package/src/RemoteSigner.js +54 -0
  34. package/src/client/ContentAccess.js +17 -14
  35. package/src/client/ContentManagement.js +0 -1
  36. package/src/client/LiveConf.js +13 -13
  37. package/src/client/LiveStream.js +40 -12
  38. package/src/walletClient/index.js +40 -13
  39. package/src/ContentObjectVerification.js +0 -210
@@ -2,8 +2,8 @@ var _typeof = require("@babel/runtime/helpers/typeof");
2
2
  var _defineProperty = require("@babel/runtime/helpers/defineProperty");
3
3
  var _regeneratorRuntime = require("@babel/runtime/regenerator");
4
4
  var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
5
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
7
  /**
8
8
  * Methods for managing content types, libraries and objects
9
9
  *
@@ -1711,7 +1711,7 @@ exports.FinalizeContentObject = /*#__PURE__*/function () {
1711
1711
  */
1712
1712
  exports.PublishContentVersion = /*#__PURE__*/function () {
1713
1713
  var _ref38 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref37) {
1714
- var objectId, versionHash, _ref37$awaitCommitCon, awaitCommitConfirmation, commit, abi, fromBlock, objectHash, pendingHash, pollingInterval, events, confirmEvent, _pollingInterval, tries, h;
1714
+ var objectId, versionHash, _ref37$awaitCommitCon, awaitCommitConfirmation, commit, abi, fromBlock, objectHash, pendingHash, pollingInterval, events, confirmEvent;
1715
1715
  return _regeneratorRuntime.wrap(function _callee21$(_context21) {
1716
1716
  while (1) switch (_context21.prev = _context21.next) {
1717
1717
  case 0:
@@ -1793,69 +1793,16 @@ exports.PublishContentVersion = /*#__PURE__*/function () {
1793
1793
  break;
1794
1794
  }
1795
1795
  // Found confirmation
1796
- this.Log("Commit confirmed on chain: ".concat(objectHash));
1796
+ this.Log("Commit confirmed: ".concat(objectHash));
1797
1797
  return _context21.abrupt("break", 34);
1798
1798
  case 32:
1799
1799
  _context21.next = 22;
1800
1800
  break;
1801
1801
  case 34:
1802
- if (!awaitCommitConfirmation) {
1803
- _context21.next = 63;
1804
- break;
1805
- }
1806
- _pollingInterval = 500; // ms
1807
- tries = 20;
1808
- case 37:
1809
- if (!(tries > 0)) {
1810
- _context21.next = 63;
1811
- break;
1812
- }
1813
- h = void 0;
1814
- _context21.prev = 39;
1815
- _context21.next = 42;
1816
- return this.LatestVersionHashV2({
1817
- objectId: objectId
1818
- });
1819
- case 42:
1820
- h = _context21.sent;
1821
- if (!(h === versionHash)) {
1822
- _context21.next = 48;
1823
- break;
1824
- }
1825
- this.Log("Commit confirmed on fabric node: ".concat(versionHash));
1826
- return _context21.abrupt("break", 63);
1827
- case 48:
1828
- tries--;
1829
- _context21.next = 51;
1830
- return new Promise(function (resolve) {
1831
- return setTimeout(resolve, _pollingInterval);
1832
- });
1833
- case 51:
1834
- _context21.next = 61;
1835
- break;
1836
- case 53:
1837
- _context21.prev = 53;
1838
- _context21.t0 = _context21["catch"](39);
1839
- console.error(_context21.t0);
1840
- if (!(_context21.t0.status !== 404)) {
1841
- _context21.next = 58;
1842
- break;
1843
- }
1844
- throw _context21.t0;
1845
- case 58:
1846
- tries--;
1847
- _context21.next = 61;
1848
- return new Promise(function (resolve) {
1849
- return setTimeout(resolve, _pollingInterval);
1850
- });
1851
- case 61:
1852
- _context21.next = 37;
1853
- break;
1854
- case 63:
1855
1802
  case "end":
1856
1803
  return _context21.stop();
1857
1804
  }
1858
- }, _callee21, this, [[39, 53]]);
1805
+ }, _callee21, this);
1859
1806
  }));
1860
1807
  return function (_x20) {
1861
1808
  return _ref38.apply(this, arguments);
@@ -2279,7 +2226,7 @@ exports.UpdateContentObjectGraph = /*#__PURE__*/function () {
2279
2226
  return _context30.delegateYield(_loop(), "t0", 8);
2280
2227
  case 8:
2281
2228
  _ret = _context30.t0;
2282
- if (!_ret) {
2229
+ if (!(_typeof(_ret) === "object")) {
2283
2230
  _context30.next = 11;
2284
2231
  break;
2285
2232
  }
@@ -2,8 +2,8 @@ var _defineProperty = require("@babel/runtime/helpers/defineProperty");
2
2
  var _typeof = require("@babel/runtime/helpers/typeof");
3
3
  var _regeneratorRuntime = require("@babel/runtime/regenerator");
4
4
  var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
5
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
7
  /**
8
8
  * Methods for deploying and interacting with contracts
9
9
  *
@@ -2,8 +2,8 @@ var _toConsumableArray = require("@babel/runtime/helpers/toConsumableArray");
2
2
  var _defineProperty = require("@babel/runtime/helpers/defineProperty");
3
3
  var _regeneratorRuntime = require("@babel/runtime/regenerator");
4
4
  var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
5
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
7
  /**
8
8
  * Methods for accessing and managing access groups
9
9
  *
@@ -1,8 +1,5 @@
1
- var _defineProperty = require("@babel/runtime/helpers/defineProperty");
2
1
  var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
3
2
  var _createClass = require("@babel/runtime/helpers/createClass");
4
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
3
  var LadderTemplate = {
7
4
  "2160": {
8
5
  bit_rate: 14000000,
@@ -20,7 +17,6 @@ var LadderTemplate = {
20
17
  media_type: 1,
21
18
  representation: "videovideo_1920x1080_h264@9500000",
22
19
  stream_name: "video",
23
- stream_index: 0,
24
20
  width: 1920
25
21
  },
26
22
  "720": {
@@ -30,7 +26,6 @@ var LadderTemplate = {
30
26
  media_type: 1,
31
27
  representation: "videovideo_1280x720_h264@4500000",
32
28
  stream_name: "video",
33
- stream_index: 0,
34
29
  width: 1280
35
30
  },
36
31
  "540": {
@@ -40,7 +35,6 @@ var LadderTemplate = {
40
35
  media_type: 1,
41
36
  representation: "videovideo_960x540_h264@2000000",
42
37
  stream_name: "video",
43
- stream_index: 0,
44
38
  width: 960
45
39
  },
46
40
  "540_low": {
@@ -50,7 +44,6 @@ var LadderTemplate = {
50
44
  media_type: 1,
51
45
  representation: "videovideo_960x540_h264@900000",
52
46
  stream_name: "video",
53
- stream_index: 0,
54
47
  width: 960
55
48
  }
56
49
  };
@@ -67,7 +60,14 @@ var LiveconfTemplate = {
67
60
  recording_config: {
68
61
  recording_params: {
69
62
  description: "",
70
- ladder_specs: [],
63
+ ladder_specs: [{
64
+ bit_rate: 384000,
65
+ channels: 2,
66
+ codecs: "mp4a.40.2",
67
+ media_type: 2,
68
+ representation: "audioaudio_aac@384000",
69
+ stream_name: "audio"
70
+ }],
71
71
  listen: true,
72
72
  live_delay_nano: 2000000000,
73
73
  max_duration_sec: -1,
@@ -80,7 +80,6 @@ var LiveconfTemplate = {
80
80
  audio_bitrate: 384000,
81
81
  audio_index: [0, 0, 0, 0, 0, 0, 0, 0],
82
82
  audio_seg_duration_ts: null,
83
- connection_timeout: 60,
84
83
  ecodec2: "aac",
85
84
  enc_height: null,
86
85
  enc_width: null,
@@ -99,22 +98,12 @@ var LiveconfTemplate = {
99
98
  video_bitrate: null,
100
99
  video_seg_duration_ts: null,
101
100
  video_time_base: null,
102
- video_frame_duration_ts: null,
103
101
  xc_type: 3
104
102
  }
105
103
  }
106
104
  }
107
105
  }
108
106
  };
109
- var LadderSpecAudio = {
110
- bit_rate: 384000,
111
- channels: 2,
112
- codecs: "mp4a.40.2",
113
- media_type: 2,
114
- representation: "audioaudio_aac@384000",
115
- stream_name: "audio",
116
- stream_index: 0
117
- };
118
107
  var LiveConf = /*#__PURE__*/function () {
119
108
  "use strict";
120
109
 
@@ -144,24 +133,6 @@ var LiveConf = /*#__PURE__*/function () {
144
133
  }
145
134
  return stream;
146
135
  }
147
-
148
- // Return all audio streams found in the probe
149
- // Used by generateAudioStreamsConfig()
150
- }, {
151
- key: "getAudioStreamsFromProbe",
152
- value: function getAudioStreamsFromProbe() {
153
- var audioStreams = {};
154
- for (var index = 0; index < this.probeData.streams.length; index++) {
155
- if (this.probeData.streams[index].codec_type == "audio") {
156
- audioStreams[index] = {
157
- recordingBitrate: Math.max(this.probeData.streams[index].bit_rate, 128000),
158
- recordingChannels: this.probeData.streams[index].channels,
159
- playoutLabel: "Audio ".concat(index)
160
- };
161
- }
162
- }
163
- return audioStreams;
164
- }
165
136
  }, {
166
137
  key: "getFrameRate",
167
138
  value: function getFrameRate() {
@@ -245,30 +216,13 @@ var LiveConf = /*#__PURE__*/function () {
245
216
 
246
217
  return seg;
247
218
  }
248
-
249
- /*
250
- * Calculate output timebase from the encoder (codec) timebase. The videoTimeBase parameter
251
- * represents the encoder timebase. The format muxer will change it so it is greater than 10000.
252
- */
253
- }, {
254
- key: "calcOutputTimebase",
255
- value: function calcOutputTimebase(codecTimebase) {
256
- var outputTimebase = codecTimebase;
257
- while (outputTimebase < 10000) outputTimebase = outputTimebase * 2;
258
- return outputTimebase;
259
- }
260
219
  }, {
261
220
  key: "calcSegDurationMpegts",
262
221
  value: function calcSegDurationMpegts(_ref2) {
263
222
  var sourceTimescale = _ref2.sourceTimescale;
264
223
  var videoStream = this.getStreamDataForCodecType("video");
265
224
  var frameRate = videoStream.frame_rate;
266
-
267
- // PENDING(SS) - calculate frame duration here
268
- // let frameRateNum = 0;
269
- var seg = {
270
- // videoFrameDurationTs: sourceTimescale / frameRateNum
271
- };
225
+ var seg = {};
272
226
  switch (frameRate) {
273
227
  case "24":
274
228
  seg.video = sourceTimescale * 30;
@@ -286,25 +240,21 @@ var LiveConf = /*#__PURE__*/function () {
286
240
  seg.duration = "30";
287
241
  break;
288
242
  case "30000/1001":
289
- //seg.videoFrameDurationTs = 3003;
290
243
  seg.video = sourceTimescale * 30;
291
244
  seg.keyint = 60;
292
245
  seg.duration = "30.03";
293
246
  break;
294
247
  case "48":
295
- //seg.videoFrameDurationTs = 1875;
296
248
  seg.video = sourceTimescale * 30;
297
249
  seg.keyint = 96;
298
250
  seg.duration = "30";
299
251
  break;
300
252
  case "50":
301
- //seg.videoFrameDurationTs = 1800;
302
253
  seg.video = sourceTimescale * 30;
303
254
  seg.keyint = 100;
304
255
  seg.duration = "30";
305
256
  break;
306
257
  case "60":
307
- //seg.videoFrameDurationTs = 1500;
308
258
  seg.video = sourceTimescale * 30;
309
259
  seg.keyint = 120;
310
260
  seg.duration = "30";
@@ -330,9 +280,7 @@ var LiveConf = /*#__PURE__*/function () {
330
280
  var seg = {};
331
281
  switch (frameRate) {
332
282
  case "24":
333
- seg.videoTimeBase = 768; // Note 1536 produces low output bitrate
334
- seg.videoFrameDurationTs = 512;
335
- seg.video = this.calcOutputTimebase(seg.videoTimeBase) * 30;
283
+ seg.video = sourceTimescale * 30;
336
284
  seg.keyint = 48;
337
285
  seg.duration = "30";
338
286
  break;
@@ -342,9 +290,7 @@ var LiveConf = /*#__PURE__*/function () {
342
290
  seg.duration = "30";
343
291
  break;
344
292
  case "30":
345
- seg.videoTimeBase = 960; // Output timebase: 15360
346
- seg.videoFrameDurationTs = 512;
347
- seg.video = this.calcOutputTimebase(seg.videoTimeBase) * 30;
293
+ seg.video = sourceTimescale * 30;
348
294
  seg.keyint = 60;
349
295
  seg.duration = "30";
350
296
  break;
@@ -354,9 +300,7 @@ var LiveConf = /*#__PURE__*/function () {
354
300
  seg.duration = "30.03";
355
301
  break;
356
302
  case "48":
357
- seg.videoTimeBase = 1536; // Output timebase: 12288
358
- seg.videoFrameDurationTs = 256;
359
- seg.video = this.calcOutputTimebase(seg.videoTimeBase) * 30;
303
+ seg.video = sourceTimescale * 30;
360
304
  seg.keyint = 96;
361
305
  seg.duration = "30";
362
306
  break;
@@ -366,9 +310,7 @@ var LiveConf = /*#__PURE__*/function () {
366
310
  seg.duration = "30";
367
311
  break;
368
312
  case "60":
369
- seg.videoTimeBase = 960; // Output timebase: 15360
370
- seg.videoFrameDurationTs = 256;
371
- seg.video = this.calcOutputTimebase(seg.videoTimeBase) * 30;
313
+ seg.video = sourceTimescale * 30;
372
314
  seg.keyint = 120;
373
315
  seg.duration = "30";
374
316
  break;
@@ -399,52 +341,16 @@ var LiveConf = /*#__PURE__*/function () {
399
341
  }
400
342
  return sync_id;
401
343
  }
402
-
403
- /*
404
- * Generate audio streams recording configuration based on the optional custom settings.
405
- * If no custom "audio" section is present, record all the acceptable audio streams found in the probe
406
- */
407
- }, {
408
- key: "generateAudioStreamsConfig",
409
- value: function generateAudioStreamsConfig(_ref4) {
410
- var customSettings = _ref4.customSettings;
411
- var audioStreams = {};
412
- if (customSettings && customSettings.audio) {
413
- for (var i = 0; i < Object.keys(customSettings.audio).length; i++) {
414
- var audioIdx = Object.keys(customSettings.audio)[i];
415
- var audio = customSettings.audio[audioIdx];
416
- audioStreams[audioIdx] = {
417
- recordingBitrate: audio.recording_bitrate || 192000,
418
- recordingChannels: audio.recording_channels || 2
419
- };
420
- if (audio.playout) {
421
- audioStreams[audioIdx].playoutLabel = audio.playout_label || "Audio ".concat(audioIdx);
422
- }
423
- }
424
- }
425
-
426
- // If no audio streams specified in custom config, set up all the suitable audio streams in the probe
427
- if (!customSettings.audio) {
428
- audioStreams = this.getAudioStreamsFromProbe();
429
- }
430
- return audioStreams;
431
- }
432
-
433
- /*
434
- * Generate the live recording config as required by QFAB, based on defaults and optional custom settings.
435
- */
436
344
  }, {
437
345
  key: "generateLiveConf",
438
- value: function generateLiveConf(_ref5) {
439
- var customSettings = _ref5.customSettings;
346
+ value: function generateLiveConf(_ref4) {
347
+ var audioBitrate = _ref4.audioBitrate,
348
+ audioIndex = _ref4.audioIndex,
349
+ partTtl = _ref4.partTtl,
350
+ channelLayout = _ref4.channelLayout;
440
351
  // gather required data
441
352
  var conf = JSON.parse(JSON.stringify(LiveconfTemplate));
442
353
  var fileName = this.overwriteOriginUrl || this.probeData.format.filename;
443
- var audioStreams = this.generateAudioStreamsConfig({
444
- customSettings: customSettings
445
- });
446
-
447
- // Retrieve one audio stream from the probe to read the sample rate and codec name
448
354
  var audioStream = this.getStreamDataForCodecType("audio");
449
355
  var sampleRate = parseInt(audioStream.sample_rate);
450
356
  var audioCodec = audioStream.codec_name;
@@ -452,26 +358,22 @@ var LiveConf = /*#__PURE__*/function () {
452
358
  var sourceTimescale;
453
359
 
454
360
  // Fill in liveconf all formats have in common
361
+ conf.live_recording.probe_info = this.probeData;
455
362
  conf.live_recording.fabric_config.ingress_node_api = this.nodeUrl || null;
456
363
  conf.live_recording.fabric_config.ingress_node_id = this.nodeId || null;
457
364
  conf.live_recording.recording_config.recording_params.description;
458
365
  conf.live_recording.recording_config.recording_params.origin_url = fileName;
459
366
  conf.live_recording.recording_config.recording_params.description = "Ingest stream ".concat(fileName);
460
367
  conf.live_recording.recording_config.recording_params.name = "Ingest stream ".concat(fileName);
368
+ conf.live_recording.recording_config.recording_params.xc_params.audio_index[0] = audioIndex === undefined ? audioStream.stream_index : audioIndex;
461
369
  conf.live_recording.recording_config.recording_params.xc_params.sample_rate = sampleRate;
462
370
  conf.live_recording.recording_config.recording_params.xc_params.enc_height = videoStream.height;
463
371
  conf.live_recording.recording_config.recording_params.xc_params.enc_width = videoStream.width;
464
- for (var i = 0; i < Object.keys(audioStreams).length; i++) {
465
- conf.live_recording.recording_config.recording_params.xc_params.audio_index[i] = parseInt(Object.keys(audioStreams)[i]);
466
- }
467
372
  if (this.syncAudioToVideo) {
468
373
  conf.live_recording.recording_config.recording_params.xc_params.sync_audio_to_stream_id = this.syncAudioToStreamIdValue();
469
374
  }
470
- if (customSettings.edge_write_token) {
471
- conf.live_recording.fabric_config.edge_write_token = customSettings.edge_write_token;
472
- }
473
- if (customSettings.part_ttl) {
474
- conf.live_recording.recording_config.recording_params.part_ttl = customSettings.part_ttl;
375
+ if (partTtl) {
376
+ conf.live_recording.recording_config.recording_params.part_ttl = partTtl;
475
377
  }
476
378
 
477
379
  // Fill in specifics for protocol
@@ -511,9 +413,7 @@ var LiveConf = /*#__PURE__*/function () {
511
413
  // Optional override output timebase and frame duration (ts)
512
414
  if (segDurations.videoTimeBase) {
513
415
  conf.live_recording.recording_config.recording_params.xc_params.video_time_base = segDurations.videoTimeBase;
514
-
515
- // Note 'source_timescale' needs to be set to the output timebase and is used by playout
516
- conf.live_recording.recording_config.recording_params.source_timescale = this.calcOutputTimebase(segDurations.videoTimeBase);
416
+ conf.live_recording.recording_config.recording_params.source_timescale = segDurations.videoTimeBase;
517
417
  }
518
418
  if (segDurations.videoFrameDurationTs) {
519
419
  conf.live_recording.recording_config.recording_params.xc_params.video_frame_duration_ts = segDurations.videoFrameDurationTs;
@@ -546,29 +446,20 @@ var LiveConf = /*#__PURE__*/function () {
546
446
  default:
547
447
  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]");
548
448
  }
549
- var globalAudioBitrate = 0;
550
- var nAudio = 0;
551
- for (var _i = 0; _i < Object.keys(audioStreams).length; _i++) {
552
- var audioLadderSpec = _objectSpread({}, LadderSpecAudio);
553
- var audioIndex = Object.keys(audioStreams)[_i];
554
- var audio = audioStreams[audioIndex];
555
- audioLadderSpec.bit_rate = audio.recordingBitrate;
556
- audioLadderSpec.representation = "audioaudio_aac@".concat(audio.recordingBitrate);
557
- audioLadderSpec.channels = audio.recordingChannels;
558
- audioLadderSpec.stream_index = parseInt(audioIndex);
559
- audioLadderSpec.stream_name = "audio_".concat(audioIndex);
560
- audioLadderSpec.stream_label = audio.playoutLabel ? audio.playoutLabel : null;
561
- conf.live_recording.recording_config.recording_params.ladder_specs.push(audioLadderSpec);
562
- if (audio.recordingBitrate > globalAudioBitrate) {
563
- globalAudioBitrate = audio.recordingBitrate;
449
+ if (audioBitrate || channelLayout) {
450
+ var audioLadderSpec = conf.live_recording.recording_config.recording_params.ladder_specs.find(function (spec) {
451
+ return spec.stream_name === "audio";
452
+ });
453
+ if (audioBitrate) {
454
+ conf.live_recording.recording_config.recording_params.xc_params.audio_bitrate = audioBitrate;
455
+ audioLadderSpec.bit_rate = audioBitrate;
456
+ audioLadderSpec.representation = "audioaudio_aac@".concat(audioBitrate);
457
+ }
458
+ if (channelLayout) {
459
+ audioLadderSpec.channels = channelLayout;
564
460
  }
565
- nAudio++;
566
461
  }
567
-
568
- // Global recording bitrate for all audio streams
569
- conf.live_recording.recording_config.recording_params.xc_params.audio_bitrate = globalAudioBitrate;
570
- conf.live_recording.recording_config.recording_params.xc_params.n_audio = nAudio;
571
- return conf;
462
+ return JSON.stringify(conf, null, 2);
572
463
  }
573
464
  }]);
574
465
  return LiveConf;