@eluvio/elv-client-js 4.0.111 → 4.0.113

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 (125) hide show
  1. package/package.json +1 -1
  2. package/src/FrameClient.js +2 -0
  3. package/dist/ElvClient-min.js +0 -67
  4. package/dist/ElvClient-node-min.js +0 -66
  5. package/dist/ElvFrameClient-min.js +0 -60
  6. package/dist/ElvPermissionsClient-min.js +0 -60
  7. package/dist/ElvWalletClient-min.js +0 -67
  8. package/dist/ElvWalletClient-node-min.js +0 -66
  9. package/dist/src/AuthorizationClient.js +0 -2157
  10. package/dist/src/ContentObjectAudit.js +0 -175
  11. package/dist/src/ContentObjectVerification.js +0 -281
  12. package/dist/src/Crypto.js +0 -412
  13. package/dist/src/ElvClient.js +0 -2049
  14. package/dist/src/ElvWallet.js +0 -245
  15. package/dist/src/EthClient.js +0 -1154
  16. package/dist/src/FrameClient.js +0 -485
  17. package/dist/src/HttpClient.js +0 -315
  18. package/dist/src/Id.js +0 -21
  19. package/dist/src/LogMessage.js +0 -25
  20. package/dist/src/PermissionsClient.js +0 -1544
  21. package/dist/src/RemoteSigner.js +0 -385
  22. package/dist/src/UserProfileClient.js +0 -1450
  23. package/dist/src/Utils.js +0 -894
  24. package/dist/src/Validation.js +0 -121
  25. package/dist/src/abr_profiles/abr_profile_live_drm.js +0 -1661
  26. package/dist/src/abr_profiles/abr_profile_live_to_vod.js +0 -1606
  27. package/dist/src/client/ABRPublishing.js +0 -1018
  28. package/dist/src/client/AccessGroups.js +0 -1503
  29. package/dist/src/client/ContentAccess.js +0 -5173
  30. package/dist/src/client/ContentManagement.js +0 -2680
  31. package/dist/src/client/Contracts.js +0 -1520
  32. package/dist/src/client/Files.js +0 -2181
  33. package/dist/src/client/LiveConf.js +0 -567
  34. package/dist/src/client/LiveStream.js +0 -2638
  35. package/dist/src/client/NFT.js +0 -162
  36. package/dist/src/client/NTP.js +0 -581
  37. package/dist/src/contracts/v2/AccessIndexor.js +0 -831
  38. package/dist/src/contracts/v2/Accessible.js +0 -31
  39. package/dist/src/contracts/v2/BaseAccessControlGroup.js +0 -1263
  40. package/dist/src/contracts/v2/BaseAccessWallet.js +0 -1609
  41. package/dist/src/contracts/v2/BaseAccessWalletFactory.js +0 -93
  42. package/dist/src/contracts/v2/BaseContent.js +0 -1076
  43. package/dist/src/contracts/v2/BaseContentFactory.js +0 -219
  44. package/dist/src/contracts/v2/BaseContentSpace.js +0 -1352
  45. package/dist/src/contracts/v2/BaseContentType.js +0 -364
  46. package/dist/src/contracts/v2/BaseFactory.js +0 -107
  47. package/dist/src/contracts/v2/BaseGroupFactory.js +0 -93
  48. package/dist/src/contracts/v2/BaseLibrary.js +0 -1041
  49. package/dist/src/contracts/v2/BaseLibraryFactory.js +0 -96
  50. package/dist/src/contracts/v2/Certifyer.js +0 -86
  51. package/dist/src/contracts/v2/Container.js +0 -540
  52. package/dist/src/contracts/v2/Content.js +0 -443
  53. package/dist/src/contracts/v2/Editable.js +0 -306
  54. package/dist/src/contracts/v2/ExternalUserWallet.js +0 -379
  55. package/dist/src/contracts/v2/IFactorySpace.js +0 -57
  56. package/dist/src/contracts/v2/IKmsSpace.js +0 -52
  57. package/dist/src/contracts/v2/INodeSpace.js +0 -18
  58. package/dist/src/contracts/v2/IUserSpace.js +0 -18
  59. package/dist/src/contracts/v2/LvRecordableStream.js +0 -1037
  60. package/dist/src/contracts/v2/LvRecording.js +0 -627
  61. package/dist/src/contracts/v2/LvStreamRightsHolder.js +0 -562
  62. package/dist/src/contracts/v2/MetaObject.js +0 -119
  63. package/dist/src/contracts/v2/Node.js +0 -167
  64. package/dist/src/contracts/v2/NodeSpace.js +0 -273
  65. package/dist/src/contracts/v2/Ownable.js +0 -87
  66. package/dist/src/contracts/v2/PaymentService.js +0 -627
  67. package/dist/src/contracts/v2/Precompile.js +0 -15
  68. package/dist/src/contracts/v2/Transactable.js +0 -82
  69. package/dist/src/contracts/v2/UserSpace.js +0 -29
  70. package/dist/src/contracts/v2/Utils.js +0 -18
  71. package/dist/src/contracts/v2/Verifier.js +0 -53
  72. package/dist/src/contracts/v2/strings.js +0 -4
  73. package/dist/src/contracts/v3/AccessIndexor.js +0 -774
  74. package/dist/src/contracts/v3/Accessible.js +0 -232
  75. package/dist/src/contracts/v3/Adminable.js +0 -107
  76. package/dist/src/contracts/v3/AvailsDelivery.js +0 -586
  77. package/dist/src/contracts/v3/BaseAccessControlGroup.js +0 -1603
  78. package/dist/src/contracts/v3/BaseAccessWallet.js +0 -1628
  79. package/dist/src/contracts/v3/BaseAccessWalletFactory.js +0 -112
  80. package/dist/src/contracts/v3/BaseContent.js +0 -1312
  81. package/dist/src/contracts/v3/BaseContentFactory.js +0 -183
  82. package/dist/src/contracts/v3/BaseContentFactoryExt.js +0 -175
  83. package/dist/src/contracts/v3/BaseContentSpace.js +0 -1515
  84. package/dist/src/contracts/v3/BaseContentType.js +0 -527
  85. package/dist/src/contracts/v3/BaseFactory.js +0 -126
  86. package/dist/src/contracts/v3/BaseGroupFactory.js +0 -112
  87. package/dist/src/contracts/v3/BaseLibrary.js +0 -1204
  88. package/dist/src/contracts/v3/BaseLibraryFactory.js +0 -115
  89. package/dist/src/contracts/v3/BaseTenantSpace.js +0 -1587
  90. package/dist/src/contracts/v3/Certifyer.js +0 -86
  91. package/dist/src/contracts/v3/Container.js +0 -739
  92. package/dist/src/contracts/v3/Content.js +0 -438
  93. package/dist/src/contracts/v3/CounterObject.js +0 -243
  94. package/dist/src/contracts/v3/Editable.js +0 -519
  95. package/dist/src/contracts/v3/EncToken.js +0 -4
  96. package/dist/src/contracts/v3/ExternalUserWallet.js +0 -587
  97. package/dist/src/contracts/v3/IAdmin.js +0 -18
  98. package/dist/src/contracts/v3/IFactorySpace.js +0 -57
  99. package/dist/src/contracts/v3/IKmsSpace.js +0 -52
  100. package/dist/src/contracts/v3/INodeSpace.js +0 -18
  101. package/dist/src/contracts/v3/IUserSpace.js +0 -32
  102. package/dist/src/contracts/v3/LvRecordableStream.js +0 -1032
  103. package/dist/src/contracts/v3/LvRecording.js +0 -650
  104. package/dist/src/contracts/v3/LvStreamRightsHolder.js +0 -557
  105. package/dist/src/contracts/v3/MetaObject.js +0 -144
  106. package/dist/src/contracts/v3/Node.js +0 -178
  107. package/dist/src/contracts/v3/NodeSpace.js +0 -284
  108. package/dist/src/contracts/v3/Ownable.js +0 -98
  109. package/dist/src/contracts/v3/PaymentService.js +0 -622
  110. package/dist/src/contracts/v3/Precompile.js +0 -26
  111. package/dist/src/contracts/v3/TenantFuncsBase.js +0 -351
  112. package/dist/src/contracts/v3/Transactable.js +0 -82
  113. package/dist/src/contracts/v3/UserSpace.js +0 -43
  114. package/dist/src/contracts/v3/Utils.js +0 -18
  115. package/dist/src/contracts/v3/Verifier.js +0 -53
  116. package/dist/src/contracts/v3/strings.js +0 -4
  117. package/dist/src/contracts/v3b/BaseAccessControlGroup.js +0 -1704
  118. package/dist/src/events/Topics.js +0 -1793
  119. package/dist/src/index.js +0 -8
  120. package/dist/src/walletClient/ClientMethods.js +0 -3102
  121. package/dist/src/walletClient/Configuration.js +0 -38
  122. package/dist/src/walletClient/Notifications.js +0 -168
  123. package/dist/src/walletClient/Profile.js +0 -332
  124. package/dist/src/walletClient/Utils.js +0 -281
  125. package/dist/src/walletClient/index.js +0 -2106
@@ -1,567 +0,0 @@
1
- var _defineProperty = require("@babel/runtime/helpers/defineProperty");
2
- var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
3
- var _createClass = require("@babel/runtime/helpers/createClass");
4
- 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; }
5
- 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; }
6
- var DefaultABRLadder = {
7
- "video": [{
8
- bit_rate: 14000000,
9
- codecs: "avc1.640028,mp4a.40.2",
10
- height: 2160,
11
- width: 3840
12
- }, {
13
- bit_rate: 9500000,
14
- codecs: "avc1.640028,mp4a.40.2",
15
- height: 1080,
16
- width: 1920
17
- }, {
18
- bit_rate: 4500000,
19
- codecs: "avc1.640028,mp4a.40.2",
20
- height: 720,
21
- width: 1280
22
- }, {
23
- bit_rate: 2000000,
24
- codecs: "avc1.640028,mp4a.40.2",
25
- height: 540,
26
- width: 960
27
- }, {
28
- bit_rate: 900000,
29
- codecs: "avc1.640028,mp4a.40.2",
30
- height: 540,
31
- width: 960
32
- }],
33
- "audio": [{
34
- bit_rate: 192000,
35
- channels: 2,
36
- codecs: "mp4a.40.2"
37
- }, {
38
- bit_rate: 384000,
39
- channels: 6,
40
- codecs: "mp4a.40.2"
41
- }]
42
- };
43
- var LiveconfTemplate = {
44
- live_recording: {
45
- fabric_config: {
46
- ingress_node_api: "",
47
- ingress_node_id: ""
48
- },
49
- playout_config: {
50
- dvr_enabled: true,
51
- dvr_max_duration: 0,
52
- rebroadcast_start_time_sec_epoch: 0,
53
- vod_enabled: false
54
- },
55
- recording_config: {
56
- recording_params: {
57
- description: "",
58
- ladder_specs: [],
59
- listen: true,
60
- live_delay_nano: 2000000000,
61
- max_duration_sec: -1,
62
- name: "",
63
- origin_url: "",
64
- part_ttl: 3600,
65
- playout_type: "live",
66
- source_timescale: null,
67
- reconnect_timeout: 600,
68
- xc_params: {
69
- audio_bitrate: 384000,
70
- audio_index: [0, 0, 0, 0, 0, 0, 0, 0],
71
- audio_seg_duration_ts: null,
72
- connection_timeout: 600,
73
- ecodec2: "aac",
74
- enc_height: null,
75
- enc_width: null,
76
- filter_descriptor: "",
77
- force_keyint: null,
78
- format: "fmp4-segment",
79
- listen: true,
80
- n_audio: 1,
81
- preset: "faster",
82
- sample_rate: 48000,
83
- seg_duration: null,
84
- skip_decoding: false,
85
- start_segment_str: "1",
86
- stream_id: -1,
87
- sync_audio_to_stream_id: -1,
88
- video_bitrate: null,
89
- video_seg_duration_ts: null,
90
- video_time_base: null,
91
- video_frame_duration_ts: null,
92
- xc_type: 3
93
- }
94
- }
95
- }
96
- }
97
- };
98
- var LiveConf = /*#__PURE__*/function () {
99
- "use strict";
100
-
101
- function LiveConf(probeData, nodeId, nodeUrl, includeAVSegDurations, overwriteOriginUrl, syncAudioToVideo) {
102
- _classCallCheck(this, LiveConf);
103
- this.probeData = probeData;
104
- this.nodeId = nodeId;
105
- this.nodeUrl = nodeUrl;
106
- this.includeAVSegDurations = includeAVSegDurations;
107
- this.overwriteOriginUrl = overwriteOriginUrl;
108
- this.syncAudioToVideo = syncAudioToVideo;
109
- }
110
- _createClass(LiveConf, [{
111
- key: "probeKind",
112
- value: function probeKind() {
113
- var fileNameSplit = this.probeData.format.filename.split(":");
114
- return fileNameSplit[0];
115
- }
116
- }, {
117
- key: "getStreamDataForCodecType",
118
- value: function getStreamDataForCodecType(codecType) {
119
- var stream = null;
120
- for (var index = 0; index < this.probeData.streams.length; index++) {
121
- if (this.probeData.streams[index].codec_type == codecType) {
122
- stream = this.probeData.streams[index];
123
- }
124
- }
125
- return stream;
126
- }
127
-
128
- // Return all audio streams found in the probe
129
- // Used by generateAudioStreamsConfig()
130
- }, {
131
- key: "getAudioStreamsFromProbe",
132
- value: function getAudioStreamsFromProbe() {
133
- var audioStreams = {};
134
- for (var index = 0; index < this.probeData.streams.length; index++) {
135
- if (this.probeData.streams[index].codec_type == "audio") {
136
- audioStreams[index] = {
137
- recordingBitrate: Math.max(this.probeData.streams[index].bit_rate, 128000),
138
- recordingChannels: this.probeData.streams[index].channels,
139
- playoutLabel: "Audio ".concat(index)
140
- };
141
- }
142
- }
143
- return audioStreams;
144
- }
145
- }, {
146
- key: "getFrameRate",
147
- value: function getFrameRate() {
148
- var videoStream = this.getStreamDataForCodecType("video");
149
- var frameRate = videoStream.r_frame_rate || videoStream.frame_rate;
150
- return frameRate.split("/");
151
- }
152
- }, {
153
- key: "isFrameRateWhole",
154
- value: function isFrameRateWhole() {
155
- var frameRate = this.getFrameRate();
156
- return frameRate[1] == "1";
157
- }
158
- }, {
159
- key: "getForceKeyint",
160
- value: function getForceKeyint() {
161
- var frameRate = this.getFrameRate();
162
- var roundedFrameRate = Math.round(frameRate[0] / frameRate[1]);
163
- if (roundedFrameRate > 30) {
164
- return roundedFrameRate;
165
- } else {
166
- return roundedFrameRate * 2;
167
- }
168
- }
169
-
170
- /*
171
- * Calculates mez segment durations based on input stream parameters
172
- *
173
- * Live input formats have fixed timebase:
174
- * - MPEG-TS/SRT input stream timebase is 90000
175
- * - RTMP input stream timebase is 1000 and gets translated to 16000 if not otherwise specified
176
- *
177
- * This causes frame duration irregularities for certain frame rates.
178
- * For example RTMP 60fps has frames of durations 16 and 17. MPEG-TS 59.94fps has frames of
179
- * durations 1001 and 1002.
180
- *
181
- * Live mez segmentation requires that the segment be cut at the specific number of frames, and when
182
- * the frame durations are irregular we adjust both the video timebase and the video frame duration
183
- * to make the math possible. This adjustment is also required for live-to-vod conversion.
184
- *
185
- * For example for MPEG-TS 59.94fps, the mez segment timebase needs to be 60000
186
- * (and resulting frame duration is 1001) and for RTMP 60fps the timebase needs to be 15360 (resulting frame
187
- * duration is 256).
188
- *
189
- * @sourceTimescale - adjusted source video stream timescale (eg. MPEGTS 90000, RTMP 16000 )
190
- * @sampleRate - audio sample rate (commonly 48000 but can be different)
191
- * @audioCodec - audio codec as a string (eg. "aac")
192
- * @return - segment encoding parameters
193
- */
194
- }, {
195
- key: "calcSegDuration",
196
- value: function calcSegDuration(_ref) {
197
- var sourceTimescale = _ref.sourceTimescale,
198
- sampleRate = _ref.sampleRate,
199
- audioCodec = _ref.audioCodec;
200
- var seg = {};
201
- switch (this.probeKind()) {
202
- case "rtmp":
203
- seg = this.calcSegDurationRtmp({
204
- sourceTimescale: sourceTimescale,
205
- sampleRate: sampleRate,
206
- audioCodec: audioCodec
207
- });
208
- break;
209
- case "udp":
210
- case "srt":
211
- seg = this.calcSegDurationMpegts({
212
- sourceTimescale: sourceTimescale,
213
- sampleRate: sampleRate,
214
- audioCodec: audioCodec
215
- });
216
- break;
217
- default:
218
- throw "protocol not supported - " + this.probeKind();
219
- }
220
- if (audioCodec == "aac") {
221
- seg.audio = 29.76 * sampleRate;
222
- } else {
223
- seg.audio = 29.76 * 48000; // Other codecs are resampled @48000
224
- }
225
-
226
- return seg;
227
- }
228
-
229
- /*
230
- * Calculate output timebase from the encoder (codec) timebase. The videoTimeBase parameter
231
- * represents the encoder timebase. The format muxer will change it so it is greater than 10000.
232
- */
233
- }, {
234
- key: "calcOutputTimebase",
235
- value: function calcOutputTimebase(codecTimebase) {
236
- var outputTimebase = codecTimebase;
237
- while (outputTimebase < 10000) outputTimebase = outputTimebase * 2;
238
- return outputTimebase;
239
- }
240
- }, {
241
- key: "calcSegDurationMpegts",
242
- value: function calcSegDurationMpegts(_ref2) {
243
- var sourceTimescale = _ref2.sourceTimescale;
244
- var videoStream = this.getStreamDataForCodecType("video");
245
- var frameRate = videoStream.frame_rate;
246
-
247
- // PENDING(SS) - calculate frame duration here
248
- // let frameRateNum = 0;
249
- var seg = {
250
- // videoFrameDurationTs: sourceTimescale / frameRateNum
251
- };
252
- switch (frameRate) {
253
- case "24":
254
- seg.video = sourceTimescale * 30;
255
- seg.keyint = 48;
256
- seg.duration = "30";
257
- break;
258
- case "25":
259
- seg.video = sourceTimescale * 30;
260
- seg.keyint = 50;
261
- seg.duration = "30";
262
- break;
263
- case "30":
264
- seg.video = sourceTimescale * 30;
265
- seg.keyint = 60;
266
- seg.duration = "30";
267
- break;
268
- case "30000/1001":
269
- //seg.videoFrameDurationTs = 3003;
270
- seg.video = sourceTimescale * 30;
271
- seg.keyint = 60;
272
- seg.duration = "30.03";
273
- break;
274
- case "48":
275
- //seg.videoFrameDurationTs = 1875;
276
- seg.video = sourceTimescale * 30;
277
- seg.keyint = 96;
278
- seg.duration = "30";
279
- break;
280
- case "50":
281
- //seg.videoFrameDurationTs = 1800;
282
- seg.video = sourceTimescale * 30;
283
- seg.keyint = 100;
284
- seg.duration = "30";
285
- break;
286
- case "60":
287
- //seg.videoFrameDurationTs = 1500;
288
- seg.video = sourceTimescale * 30;
289
- seg.keyint = 120;
290
- seg.duration = "30";
291
- break;
292
- case "60000/1001":
293
- seg.videoTimeBase = 60000;
294
- seg.video = seg.videoTimeBase * 30.03;
295
- seg.keyint = 120;
296
- seg.duration = "30.03";
297
- break;
298
- default:
299
- throw "unsupported frame rate for MPEGTS - " + frameRate;
300
- }
301
- return seg;
302
- }
303
- }, {
304
- key: "calcSegDurationRtmp",
305
- value: function calcSegDurationRtmp(_ref3) {
306
- var sourceTimescale = _ref3.sourceTimescale;
307
- var videoStream = this.getStreamDataForCodecType("video");
308
- var frameRate = videoStream.frame_rate;
309
- var seg = {};
310
- switch (frameRate) {
311
- case "24":
312
- seg.videoTimeBase = 768; // Note 1536 produces low output bitrate
313
- seg.videoFrameDurationTs = 512;
314
- seg.video = this.calcOutputTimebase(seg.videoTimeBase) * 30;
315
- seg.keyint = 48;
316
- seg.duration = "30";
317
- break;
318
- case "25":
319
- seg.video = sourceTimescale * 30;
320
- seg.keyint = 50;
321
- seg.duration = "30";
322
- break;
323
- case "30":
324
- seg.videoTimeBase = 960; // Output timebase: 15360
325
- seg.videoFrameDurationTs = 512;
326
- seg.video = this.calcOutputTimebase(seg.videoTimeBase) * 30;
327
- seg.keyint = 60;
328
- seg.duration = "30";
329
- break;
330
- case "30000/1001":
331
- seg.video = sourceTimescale * 30.03;
332
- seg.keyint = 60;
333
- seg.duration = "30.03";
334
- break;
335
- case "48":
336
- seg.videoTimeBase = 1536; // Output timebase: 12288
337
- seg.videoFrameDurationTs = 256;
338
- seg.video = this.calcOutputTimebase(seg.videoTimeBase) * 30;
339
- seg.keyint = 96;
340
- seg.duration = "30";
341
- break;
342
- case "50":
343
- seg.video = sourceTimescale * 30;
344
- seg.keyint = 100;
345
- seg.duration = "30";
346
- break;
347
- case "60":
348
- seg.videoTimeBase = 960; // Output timebase: 15360
349
- seg.videoFrameDurationTs = 256;
350
- seg.video = this.calcOutputTimebase(seg.videoTimeBase) * 30;
351
- seg.keyint = 120;
352
- seg.duration = "30";
353
- break;
354
- case "60000/1001":
355
- seg.video = sourceTimescale * 30.03;
356
- seg.keyint = 120;
357
- seg.duration = "30.03";
358
- break;
359
- default:
360
- throw "unsupported frame rate for RTMP - " + frameRate;
361
- }
362
- return seg;
363
- }
364
- }, {
365
- key: "syncAudioToStreamIdValue",
366
- value: function syncAudioToStreamIdValue() {
367
- var sync_id = -1;
368
- var videoStream = this.getStreamDataForCodecType("video");
369
- switch (this.probeKind()) {
370
- case "udp":
371
- case "srt":
372
- sync_id = videoStream.stream_id;
373
- break;
374
- case "rtmp":
375
- sync_id = videoStream.stream_index;
376
- break;
377
- }
378
- return sync_id;
379
- }
380
-
381
- /*
382
- * Generate audio streams recording configuration based on the optional custom settings.
383
- * If no custom "audio" section is present, record all the acceptable audio streams found in the probe
384
- */
385
- }, {
386
- key: "generateAudioStreamsConfig",
387
- value: function generateAudioStreamsConfig(_ref4) {
388
- var customSettings = _ref4.customSettings;
389
- var audioStreams = {};
390
- if (customSettings && customSettings.audio && Object.keys(customSettings.audio).length > 0) {
391
- for (var i = 0; i < Object.keys(customSettings.audio).length; i++) {
392
- var audioIdx = Object.keys(customSettings.audio)[i];
393
- var audio = customSettings.audio[audioIdx];
394
- audioStreams[audioIdx] = {
395
- recordingBitrate: audio.recording_bitrate || 192000,
396
- recordingChannels: audio.recording_channels || 2
397
- };
398
- if (audio.playout) {
399
- audioStreams[audioIdx].playoutLabel = audio.playout_label || "Audio ".concat(audioIdx);
400
- }
401
- }
402
- }
403
-
404
- // If no audio streams specified in custom config, set up all the suitable audio streams in the probe
405
- if (!customSettings.audio || Object.keys(customSettings.audio).length == 0) {
406
- audioStreams = this.getAudioStreamsFromProbe();
407
- }
408
- return audioStreams;
409
- }
410
-
411
- /*
412
- * Generate the live recording config as required by QFAB, based on defaults and optional custom settings.
413
- */
414
- }, {
415
- key: "generateLiveConf",
416
- value: function generateLiveConf(_ref5) {
417
- var customSettings = _ref5.customSettings;
418
- // gather required data
419
- var conf = JSON.parse(JSON.stringify(LiveconfTemplate));
420
- var fileName = this.overwriteOriginUrl || this.probeData.format.filename;
421
- var audioStreams = this.generateAudioStreamsConfig({
422
- customSettings: customSettings
423
- });
424
-
425
- // Retrieve one audio stream from the probe to read the sample rate and codec name
426
- var audioStream = this.getStreamDataForCodecType("audio");
427
- var sampleRate = parseInt(audioStream.sample_rate);
428
- var audioCodec = audioStream.codec_name;
429
- var videoStream = this.getStreamDataForCodecType("video");
430
- var sourceTimescale;
431
-
432
- // Fill in liveconf all formats have in common
433
- conf.live_recording.fabric_config.ingress_node_api = this.nodeUrl || null;
434
- conf.live_recording.fabric_config.ingress_node_id = this.nodeId || null;
435
- conf.live_recording.recording_config.recording_params.description;
436
- conf.live_recording.recording_config.recording_params.origin_url = fileName;
437
- conf.live_recording.recording_config.recording_params.description = "Ingest stream ".concat(fileName);
438
- conf.live_recording.recording_config.recording_params.name = "Ingest stream ".concat(fileName);
439
- conf.live_recording.recording_config.recording_params.xc_params.sample_rate = sampleRate;
440
- conf.live_recording.recording_config.recording_params.xc_params.enc_height = videoStream.height;
441
- conf.live_recording.recording_config.recording_params.xc_params.enc_width = videoStream.width;
442
- for (var i = 0; i < Object.keys(audioStreams).length; i++) {
443
- conf.live_recording.recording_config.recording_params.xc_params.audio_index[i] = parseInt(Object.keys(audioStreams)[i]);
444
- }
445
- if (this.syncAudioToVideo) {
446
- conf.live_recording.recording_config.recording_params.xc_params.sync_audio_to_stream_id = this.syncAudioToStreamIdValue();
447
- }
448
- if (customSettings.edge_write_token) {
449
- conf.live_recording.fabric_config.edge_write_token = customSettings.edge_write_token;
450
- }
451
- if (customSettings.part_ttl) {
452
- conf.live_recording.recording_config.recording_params.part_ttl = customSettings.part_ttl;
453
- }
454
- if (customSettings.connection_timeout) {
455
- conf.live_recording.recording_config.recording_params.xc_params.connection_timeout = customSettings.connection_timeout;
456
- }
457
- if (customSettings.reconnect_timeout) {
458
- conf.live_recording.recording_config.recording_params.reconnect_timeout = customSettings.reconnect_timeout;
459
- }
460
-
461
- // Fill in specifics for protocol
462
- switch (this.probeKind()) {
463
- case "udp":
464
- sourceTimescale = 90000;
465
- conf.live_recording.recording_config.recording_params.source_timescale = sourceTimescale;
466
- break;
467
- case "srt":
468
- sourceTimescale = 90000;
469
- conf.live_recording.recording_config.recording_params.source_timescale = sourceTimescale;
470
- conf.live_recording.recording_config.recording_params.live_delay_nano = 4000000000;
471
- break;
472
- case "rtmp":
473
- sourceTimescale = 16000;
474
- conf.live_recording.recording_config.recording_params.source_timescale = sourceTimescale;
475
- break;
476
- case "hls":
477
- console.log("HLS detected. Not yet implemented");
478
- break;
479
- default:
480
- console.log("Unsupported media", this.probeKind());
481
- break;
482
- }
483
- var segDurations = this.calcSegDuration({
484
- sourceTimescale: sourceTimescale,
485
- sampleRate: sampleRate,
486
- audioCodec: audioCodec
487
- });
488
-
489
- // Segment conditioning parameters
490
- conf.live_recording.recording_config.recording_params.xc_params.seg_duration = segDurations.duration;
491
- conf.live_recording.recording_config.recording_params.xc_params.audio_seg_duration_ts = segDurations.audio;
492
- conf.live_recording.recording_config.recording_params.xc_params.video_seg_duration_ts = segDurations.video;
493
- conf.live_recording.recording_config.recording_params.xc_params.force_keyint = segDurations.keyint;
494
-
495
- // Optional override output timebase and frame duration (ts)
496
- if (segDurations.videoTimeBase) {
497
- conf.live_recording.recording_config.recording_params.xc_params.video_time_base = segDurations.videoTimeBase;
498
-
499
- // Note 'source_timescale' needs to be set to the output timebase and is used by playout
500
- conf.live_recording.recording_config.recording_params.source_timescale = this.calcOutputTimebase(segDurations.videoTimeBase);
501
- }
502
- if (segDurations.videoFrameDurationTs) {
503
- conf.live_recording.recording_config.recording_params.xc_params.video_frame_duration_ts = segDurations.videoFrameDurationTs;
504
- }
505
- var ladderProfile = customSettings.ladder_profile || DefaultABRLadder;
506
- conf.live_recording.recording_config.recording_params.xc_params.enc_height = videoStream.height;
507
- conf.live_recording.recording_config.recording_params.xc_params.enc_width = videoStream.width;
508
-
509
- // Determine video recording bitrate and ABR ladder
510
- var topLadderRate = 0;
511
- for (var _i = 0; _i < ladderProfile.video.length; _i++) {
512
- var elem = ladderProfile.video[_i];
513
- if (elem.height > videoStream.height) continue;
514
- if (elem.bit_rate > topLadderRate) {
515
- topLadderRate = elem.bit_rate;
516
- }
517
- elem.media_type = 1;
518
- elem.stream_name = "video";
519
- elem.stream_index = 0;
520
- elem.representation = "videovideo_" + elem.width + "x" + elem.height + "_h264@" + elem.bit_rate;
521
- conf.live_recording.recording_config.recording_params.ladder_specs.push(elem);
522
- }
523
- // Currently the recording bitrate is the top bitrate of the ladder (it will be configurable separately in the future)
524
- conf.live_recording.recording_config.recording_params.xc_params.video_bitrate = topLadderRate;
525
-
526
- // Determine audio recording bitrate and ABR ladder
527
- var globalAudioBitrate = 0;
528
- var nAudio = 0;
529
- for (var _i2 = 0; _i2 < Object.keys(audioStreams).length; _i2++) {
530
- var audioLadderSpec = {};
531
- var audioIndex = Object.keys(audioStreams)[_i2];
532
- var audio = audioStreams[audioIndex];
533
-
534
- // Find ladder rung for the specific channel layout (2 or 6 channels)
535
- for (var j = 0; j < ladderProfile.audio.length; j++) {
536
- var _elem = ladderProfile.audio[j];
537
- if (_elem.channels == audio.recordingChannels) {
538
- audioLadderSpec = _objectSpread({}, _elem);
539
- break;
540
- }
541
- }
542
- if (Object.keys(audioLadderSpec).length === 0) {
543
- // If no channels layout match, just use the first element in the ladder
544
- audioLadderSpec = _objectSpread({}, ladderProfile.audio[0]);
545
- }
546
- audioLadderSpec.representation = "audioaudio_aac@".concat(audioLadderSpec.bit_rate);
547
- audioLadderSpec.channels = audio.recordingChannels;
548
- audioLadderSpec.stream_index = parseInt(audioIndex);
549
- audioLadderSpec.stream_name = "audio_".concat(audioIndex);
550
- audioLadderSpec.stream_label = audio.playoutLabel ? audio.playoutLabel : null;
551
- audioLadderSpec.media_type = 2;
552
- conf.live_recording.recording_config.recording_params.ladder_specs.push(audioLadderSpec);
553
- if (audio.recordingBitrate > globalAudioBitrate) {
554
- globalAudioBitrate = audio.recordingBitrate;
555
- }
556
- nAudio++;
557
- }
558
-
559
- // Global recording bitrate for all audio streams
560
- conf.live_recording.recording_config.recording_params.xc_params.audio_bitrate = globalAudioBitrate;
561
- conf.live_recording.recording_config.recording_params.xc_params.n_audio = nAudio;
562
- return conf;
563
- }
564
- }]);
565
- return LiveConf;
566
- }();
567
- exports.LiveConf = LiveConf;