@eluvio/elv-client-js 4.2.15 → 4.2.17
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/ElvClient-min.js +1 -1
- package/dist/ElvClient-node-min.js +1 -1
- package/dist/ElvFrameClient-min.js +1 -1
- package/dist/ElvPermissionsClient-min.js +1 -1
- package/dist/ElvWalletClient-min.js +1 -1
- package/dist/ElvWalletClient-node-min.js +1 -1
- package/dist/src/AuthorizationClient.js +2 -1
- package/dist/src/ContentObjectAudit.js +2 -1
- package/dist/src/ContentObjectVerification.js +281 -0
- package/dist/src/ElvClient.js +8 -9
- package/dist/src/FrameClient.js +1 -1
- package/dist/src/HttpClient.js +83 -47
- package/dist/src/NetworkUrls.js +8 -0
- package/dist/src/abr_profiles/abr_profile_live_drm.js +0 -10
- package/dist/src/client/ContentAccess.js +76 -85
- package/dist/src/client/LiveConf.js +170 -84
- package/dist/src/client/LiveStream.js +5205 -2118
- package/dist/src/live_recording_config_profiles/live_recording_config_default.js +45 -0
- package/package.json +3 -2
- package/src/AuthorizationClient.js +2 -1
- package/src/ContentObjectAudit.js +4 -1
- package/src/ElvClient.js +8 -15
- package/src/FrameClient.js +23 -2
- package/src/HttpClient.js +17 -1
- package/src/NetworkUrls.js +9 -0
- package/src/abr_profiles/abr_profile_live_drm.js +0 -10
- package/src/client/ContentAccess.js +8 -23
- package/src/client/LiveConf.js +149 -65
- package/src/client/LiveStream.js +2592 -654
- package/src/live_recording_config_profiles/live_recording_config_default.js +54 -0
- package/src/live_recording_config_profiles/live_stream_profile_full.json +143 -0
- package/testScripts/StreamUpdateLinks.js +95 -0
- package/utilities/ChannelCreate.js +1 -1
- package/utilities/LibraryDownloadMp4.js +54 -8
- package/utilities/LibraryDownloadMp4Parallel.js +544 -0
- package/utilities/LiveOutputs.js +149 -0
- package/utilities/StreamCreate.js +53 -0
- package/utilities/lib/concerns/Client.js +5 -0
- package/utilities/lib/helpers.js +5 -1
- package/utilities/tests/mocks/ElvClient.mock.js +9 -1
- package/utilities/tests/unit/StreamCreate.test.js +39 -0
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
var _slicedToArray = require("@babel/runtime/helpers/slicedToArray");
|
|
2
1
|
var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
2
|
+
var _objectWithoutProperties = require("@babel/runtime/helpers/objectWithoutProperties");
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
3
4
|
var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
|
|
4
5
|
var _createClass = require("@babel/runtime/helpers/createClass");
|
|
6
|
+
var _excluded = ["recording_config", "recording_params"];
|
|
5
7
|
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
8
|
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; }
|
|
7
9
|
/* eslint no-console: 0 */
|
|
8
|
-
|
|
10
|
+
var R = require("ramda");
|
|
9
11
|
var DefaultABRLadder = {
|
|
10
12
|
"video": [{
|
|
11
13
|
bit_rate: 14000000,
|
|
@@ -51,8 +53,9 @@ var LiveconfTemplate = {
|
|
|
51
53
|
},
|
|
52
54
|
playout_config: {
|
|
53
55
|
dvr_enabled: true,
|
|
54
|
-
dvr_max_duration:
|
|
56
|
+
dvr_max_duration: 14400,
|
|
55
57
|
rebroadcast_start_time_sec_epoch: 0,
|
|
58
|
+
playout_sharding_level: 2,
|
|
56
59
|
vod_enabled: false
|
|
57
60
|
},
|
|
58
61
|
recording_config: {
|
|
@@ -60,11 +63,11 @@ var LiveconfTemplate = {
|
|
|
60
63
|
description: "",
|
|
61
64
|
ladder_specs: [],
|
|
62
65
|
listen: true,
|
|
63
|
-
live_delay_nano:
|
|
66
|
+
live_delay_nano: 6000000000,
|
|
64
67
|
max_duration_sec: -1,
|
|
65
68
|
name: "",
|
|
66
69
|
origin_url: "",
|
|
67
|
-
part_ttl:
|
|
70
|
+
part_ttl: 86400,
|
|
68
71
|
playout_type: "live",
|
|
69
72
|
source_timescale: null,
|
|
70
73
|
reconnect_timeout: 600,
|
|
@@ -101,20 +104,52 @@ var LiveconfTemplate = {
|
|
|
101
104
|
var LiveConf = /*#__PURE__*/function () {
|
|
102
105
|
"use strict";
|
|
103
106
|
|
|
104
|
-
function LiveConf(
|
|
107
|
+
function LiveConf(_ref) {
|
|
108
|
+
var url = _ref.url,
|
|
109
|
+
probeData = _ref.probeData,
|
|
110
|
+
nodeId = _ref.nodeId,
|
|
111
|
+
nodeUrl = _ref.nodeUrl,
|
|
112
|
+
includeAVSegDurations = _ref.includeAVSegDurations,
|
|
113
|
+
overwriteOriginUrl = _ref.overwriteOriginUrl,
|
|
114
|
+
syncAudioToVideo = _ref.syncAudioToVideo,
|
|
115
|
+
liveRecordingMeta = _ref.liveRecordingMeta;
|
|
105
116
|
_classCallCheck(this, LiveConf);
|
|
117
|
+
this.url = url;
|
|
106
118
|
this.probeData = probeData;
|
|
107
119
|
this.nodeId = nodeId;
|
|
108
120
|
this.nodeUrl = nodeUrl;
|
|
109
121
|
this.includeAVSegDurations = includeAVSegDurations;
|
|
110
122
|
this.overwriteOriginUrl = overwriteOriginUrl;
|
|
111
123
|
this.syncAudioToVideo = syncAudioToVideo;
|
|
124
|
+
this.currentLiveRecordingMeta = liveRecordingMeta;
|
|
112
125
|
}
|
|
113
126
|
_createClass(LiveConf, [{
|
|
114
|
-
key: "
|
|
115
|
-
value: function
|
|
116
|
-
var
|
|
117
|
-
|
|
127
|
+
key: "getFormat",
|
|
128
|
+
value: function getFormat() {
|
|
129
|
+
var _this$probeData$forma;
|
|
130
|
+
if (this.probeData.format.format_name) {
|
|
131
|
+
return this.probeData.format.format_name;
|
|
132
|
+
}
|
|
133
|
+
var fileNameSplit = (_this$probeData$forma = this.probeData.format) === null || _this$probeData$forma === void 0 || (_this$probeData$forma = _this$probeData$forma.filename) === null || _this$probeData$forma === void 0 ? void 0 : _this$probeData$forma.split(":");
|
|
134
|
+
if (fileNameSplit.length > 1) {
|
|
135
|
+
var protoScheme = fileNameSplit[0];
|
|
136
|
+
switch (protoScheme) {
|
|
137
|
+
case "rtmp":
|
|
138
|
+
return "flv";
|
|
139
|
+
case "udp":
|
|
140
|
+
case "rtp":
|
|
141
|
+
case "srt":
|
|
142
|
+
return "mpegts";
|
|
143
|
+
default:
|
|
144
|
+
return "format_unknown";
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}, {
|
|
149
|
+
key: "getProtocol",
|
|
150
|
+
value: function getProtocol() {
|
|
151
|
+
var protoScheme = this.url.split(":")[0];
|
|
152
|
+
return protoScheme;
|
|
118
153
|
}
|
|
119
154
|
}, {
|
|
120
155
|
key: "getStreamDataForCodecType",
|
|
@@ -132,19 +167,27 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
132
167
|
// Used by generateAudioStreamsConfig()
|
|
133
168
|
}, {
|
|
134
169
|
key: "getAudioStreamsFromProbe",
|
|
135
|
-
value: function getAudioStreamsFromProbe() {
|
|
170
|
+
value: function getAudioStreamsFromProbe(_ref2) {
|
|
171
|
+
var ladderProfile = _ref2.ladderProfile;
|
|
136
172
|
var audioStreams = {};
|
|
137
173
|
var audioStreamData = this.probeData.streams.filter(function (value) {
|
|
138
174
|
return value.codec_type === "audio";
|
|
139
175
|
});
|
|
140
|
-
|
|
176
|
+
var _loop = function _loop() {
|
|
177
|
+
var _ladderProfile$audio, _profileAudioForType$, _currentStreamData$bi;
|
|
141
178
|
var currentStreamIndex = audioStreamData[index].stream_index;
|
|
142
179
|
var currentStreamData = audioStreamData[index];
|
|
180
|
+
var profileAudioForType = ladderProfile === null || ladderProfile === void 0 || (_ladderProfile$audio = ladderProfile.audio) === null || _ladderProfile$audio === void 0 ? void 0 : _ladderProfile$audio.find(function (a) {
|
|
181
|
+
return a.channels === currentStreamData.channels;
|
|
182
|
+
});
|
|
143
183
|
audioStreams[currentStreamIndex] = {
|
|
144
|
-
recordingBitrate: Math.max(currentStreamData.bit_rate,
|
|
184
|
+
recordingBitrate: (_profileAudioForType$ = profileAudioForType === null || profileAudioForType === void 0 ? void 0 : profileAudioForType.bit_rate) !== null && _profileAudioForType$ !== void 0 ? _profileAudioForType$ : Math.max((_currentStreamData$bi = currentStreamData.bit_rate) !== null && _currentStreamData$bi !== void 0 ? _currentStreamData$bi : 0, 12800),
|
|
145
185
|
recordingChannels: currentStreamData.channels,
|
|
146
186
|
playoutLabel: "Audio ".concat(index + 1)
|
|
147
187
|
};
|
|
188
|
+
};
|
|
189
|
+
for (var index = 0; index < audioStreamData.length; index++) {
|
|
190
|
+
_loop();
|
|
148
191
|
}
|
|
149
192
|
return audioStreams;
|
|
150
193
|
}
|
|
@@ -199,21 +242,20 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
199
242
|
*/
|
|
200
243
|
}, {
|
|
201
244
|
key: "calcSegDuration",
|
|
202
|
-
value: function calcSegDuration(
|
|
203
|
-
var sourceTimescale =
|
|
204
|
-
sampleRate =
|
|
205
|
-
audioCodec =
|
|
245
|
+
value: function calcSegDuration(_ref3) {
|
|
246
|
+
var sourceTimescale = _ref3.sourceTimescale,
|
|
247
|
+
sampleRate = _ref3.sampleRate,
|
|
248
|
+
audioCodec = _ref3.audioCodec;
|
|
206
249
|
var seg = {};
|
|
207
|
-
switch (this.
|
|
208
|
-
case "
|
|
250
|
+
switch (this.getFormat()) {
|
|
251
|
+
case "flv":
|
|
209
252
|
seg = this.calcSegDurationRtmp({
|
|
210
253
|
sourceTimescale: sourceTimescale,
|
|
211
254
|
sampleRate: sampleRate,
|
|
212
255
|
audioCodec: audioCodec
|
|
213
256
|
});
|
|
214
257
|
break;
|
|
215
|
-
case "
|
|
216
|
-
case "srt":
|
|
258
|
+
case "mpegts":
|
|
217
259
|
seg = this.calcSegDurationMpegts({
|
|
218
260
|
sourceTimescale: sourceTimescale,
|
|
219
261
|
sampleRate: sampleRate,
|
|
@@ -221,7 +263,7 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
221
263
|
});
|
|
222
264
|
break;
|
|
223
265
|
default:
|
|
224
|
-
throw "protocol not supported - " + this.
|
|
266
|
+
throw "protocol not supported - " + this.getFormat();
|
|
225
267
|
}
|
|
226
268
|
if (audioCodec == "aac") {
|
|
227
269
|
seg.audio = 29.76 * sampleRate;
|
|
@@ -245,8 +287,8 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
245
287
|
}
|
|
246
288
|
}, {
|
|
247
289
|
key: "calcSegDurationMpegts",
|
|
248
|
-
value: function calcSegDurationMpegts(
|
|
249
|
-
var sourceTimescale =
|
|
290
|
+
value: function calcSegDurationMpegts(_ref4) {
|
|
291
|
+
var sourceTimescale = _ref4.sourceTimescale;
|
|
250
292
|
var videoStream = this.getStreamDataForCodecType("video");
|
|
251
293
|
var frameRate = videoStream.frame_rate;
|
|
252
294
|
|
|
@@ -308,8 +350,8 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
308
350
|
}
|
|
309
351
|
}, {
|
|
310
352
|
key: "calcSegDurationRtmp",
|
|
311
|
-
value: function calcSegDurationRtmp(
|
|
312
|
-
var sourceTimescale =
|
|
353
|
+
value: function calcSegDurationRtmp(_ref5) {
|
|
354
|
+
var sourceTimescale = _ref5.sourceTimescale;
|
|
313
355
|
var videoStream = this.getStreamDataForCodecType("video");
|
|
314
356
|
var frameRate = videoStream.frame_rate;
|
|
315
357
|
var seg = {};
|
|
@@ -372,60 +414,123 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
372
414
|
value: function syncAudioToStreamIdValue() {
|
|
373
415
|
var sync_id = -1;
|
|
374
416
|
var videoStream = this.getStreamDataForCodecType("video");
|
|
375
|
-
switch (this.
|
|
376
|
-
case "
|
|
377
|
-
case "srt":
|
|
417
|
+
switch (this.getFormat()) {
|
|
418
|
+
case "mpegts":
|
|
378
419
|
sync_id = videoStream.stream_id;
|
|
379
420
|
break;
|
|
380
|
-
case "
|
|
421
|
+
case "flv":
|
|
381
422
|
sync_id = videoStream.stream_index;
|
|
382
423
|
break;
|
|
383
424
|
}
|
|
384
425
|
return sync_id;
|
|
385
426
|
}
|
|
386
427
|
|
|
428
|
+
/**
|
|
429
|
+
* Map custom live recording profile to the expected config structure
|
|
430
|
+
* @param {Object} customProfile - User's custom recording profile
|
|
431
|
+
* @return {Object} - Mapped config in live_recording format
|
|
432
|
+
*/
|
|
433
|
+
}, {
|
|
434
|
+
key: "MapCustomProfileToLiveConfig",
|
|
435
|
+
value: function MapCustomProfileToLiveConfig(_ref6) {
|
|
436
|
+
var customProfile = _ref6.customProfile;
|
|
437
|
+
if (!customProfile) return {};
|
|
438
|
+
var CompactDeep = function CompactDeep(obj) {
|
|
439
|
+
if (obj === null || _typeof(obj) !== "object" || Array.isArray(obj)) {
|
|
440
|
+
return obj;
|
|
441
|
+
}
|
|
442
|
+
return R.pipe(R.reject(R.isNil), R.map(function (val) {
|
|
443
|
+
return _typeof(val) === "object" ? CompactDeep(val) : val;
|
|
444
|
+
}))(obj);
|
|
445
|
+
};
|
|
446
|
+
var recording_config = customProfile.recording_config,
|
|
447
|
+
recording_params = customProfile.recording_params,
|
|
448
|
+
rest = _objectWithoutProperties(customProfile, _excluded);
|
|
449
|
+
return CompactDeep({
|
|
450
|
+
live_recording: _objectSpread(_objectSpread({}, rest), {}, {
|
|
451
|
+
recording_config: {
|
|
452
|
+
recording_params: _objectSpread(_objectSpread({}, recording_params), {}, {
|
|
453
|
+
part_ttl: recording_config === null || recording_config === void 0 ? void 0 : recording_config.part_ttl,
|
|
454
|
+
reconnect_timeout: recording_config === null || recording_config === void 0 ? void 0 : recording_config.reconnect_timeout,
|
|
455
|
+
xc_params: _objectSpread(_objectSpread({}, (recording_params === null || recording_params === void 0 ? void 0 : recording_params.xc_params) || {}), {}, {
|
|
456
|
+
connection_timeout: recording_config === null || recording_config === void 0 ? void 0 : recording_config.connection_timeout,
|
|
457
|
+
copy_mpegts: recording_config === null || recording_config === void 0 ? void 0 : recording_config.copy_mpegts,
|
|
458
|
+
input_cfg: recording_config === null || recording_config === void 0 ? void 0 : recording_config.input_cfg
|
|
459
|
+
})
|
|
460
|
+
})
|
|
461
|
+
}
|
|
462
|
+
})
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
|
|
387
466
|
/*
|
|
388
467
|
* Generate audio streams recording configuration based on the optional custom settings.
|
|
389
468
|
* If no custom "audio" section is present, record all the acceptable audio streams found in the probe
|
|
390
469
|
*/
|
|
391
470
|
}, {
|
|
392
471
|
key: "generateAudioStreamsConfig",
|
|
393
|
-
value: function generateAudioStreamsConfig(
|
|
394
|
-
var
|
|
472
|
+
value: function generateAudioStreamsConfig(_ref7) {
|
|
473
|
+
var _liveRecordingConfigP, _liveRecordingConfigP2;
|
|
474
|
+
var liveRecordingConfigProfile = _ref7.liveRecordingConfigProfile;
|
|
475
|
+
var ladderProfile = (liveRecordingConfigProfile === null || liveRecordingConfigProfile === void 0 || (_liveRecordingConfigP = liveRecordingConfigProfile.playout_config) === null || _liveRecordingConfigP === void 0 ? void 0 : _liveRecordingConfigP.ladder_specs) || DefaultABRLadder;
|
|
476
|
+
var audioSettings = liveRecordingConfigProfile === null || liveRecordingConfigProfile === void 0 || (_liveRecordingConfigP2 = liveRecordingConfigProfile.recording_stream_config) === null || _liveRecordingConfigP2 === void 0 ? void 0 : _liveRecordingConfigP2.audio;
|
|
395
477
|
var audioStreams = {};
|
|
396
|
-
if (
|
|
397
|
-
|
|
398
|
-
var
|
|
399
|
-
var
|
|
478
|
+
if (audioSettings && Object.keys(audioSettings).length > 0) {
|
|
479
|
+
var _loop2 = function _loop2() {
|
|
480
|
+
var _audio$recording_bitr;
|
|
481
|
+
var audioIdx = Object.keys(audioSettings)[i];
|
|
482
|
+
var audio = audioSettings[audioIdx];
|
|
483
|
+
var profileAudioForType = ladderProfile === null || ladderProfile === void 0 ? void 0 : ladderProfile.audio.find(function (a) {
|
|
484
|
+
var _audio$channels;
|
|
485
|
+
return a.channels === ((_audio$channels = audio.channels) !== null && _audio$channels !== void 0 ? _audio$channels : 2);
|
|
486
|
+
});
|
|
400
487
|
audioStreams[audioIdx] = {
|
|
401
|
-
recordingBitrate: audio.recording_bitrate
|
|
402
|
-
recordingChannels: audio.recording_channels || 2
|
|
488
|
+
recordingBitrate: ladderProfile !== null && ladderProfile !== void 0 && ladderProfile.audio ? profileAudioForType.bit_rate : (_audio$recording_bitr = audio.recording_bitrate) !== null && _audio$recording_bitr !== void 0 ? _audio$recording_bitr : 192000,
|
|
489
|
+
recordingChannels: audio.recording_channels || 2,
|
|
490
|
+
lang: audio.lang,
|
|
491
|
+
isDefault: audio["default"]
|
|
403
492
|
};
|
|
404
493
|
if (audio.playout) {
|
|
405
494
|
audioStreams[audioIdx].playoutLabel = audio.playout_label || "Audio ".concat(i + 1);
|
|
406
495
|
}
|
|
496
|
+
};
|
|
497
|
+
for (var i = 0; i < Object.keys(audioSettings).length; i++) {
|
|
498
|
+
_loop2();
|
|
407
499
|
}
|
|
408
500
|
}
|
|
409
501
|
|
|
410
502
|
// If no audio streams specified in custom config, set up all the suitable audio streams in the probe
|
|
411
|
-
if (!
|
|
412
|
-
audioStreams = this.getAudioStreamsFromProbe(
|
|
503
|
+
if (!audioSettings || Object.keys(audioSettings).length === 0) {
|
|
504
|
+
audioStreams = this.getAudioStreamsFromProbe({
|
|
505
|
+
ladderProfile: ladderProfile
|
|
506
|
+
});
|
|
413
507
|
}
|
|
414
508
|
return audioStreams;
|
|
415
509
|
}
|
|
416
510
|
|
|
417
511
|
/*
|
|
418
|
-
* Generate the live recording config as required by QFAB, based on defaults and optional custom settings.
|
|
512
|
+
* Generate the live recording config as required by QFAB, based on defaults, existing settings and optional custom settings.
|
|
419
513
|
*/
|
|
420
514
|
}, {
|
|
421
515
|
key: "generateLiveConf",
|
|
422
|
-
value: function generateLiveConf(
|
|
423
|
-
var
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
var
|
|
516
|
+
value: function generateLiveConf(_ref8) {
|
|
517
|
+
var _customSettings$liveR, _customSettings$liveR2, _ladder_specs$video;
|
|
518
|
+
var customSettings = _ref8.customSettings;
|
|
519
|
+
// Saved config overrides defaults and is preserved on reconfiguration
|
|
520
|
+
var conf = R.clone(LiveconfTemplate);
|
|
521
|
+
if (this.currentLiveRecordingMeta) {
|
|
522
|
+
conf = R.mergeDeepRight(conf, {
|
|
523
|
+
live_recording: this.currentLiveRecordingMeta
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
if (customSettings.liveRecordingConfigProfile) {
|
|
527
|
+
conf = R.mergeDeepRight(conf, this.MapCustomProfileToLiveConfig({
|
|
528
|
+
customProfile: customSettings.liveRecordingConfigProfile
|
|
529
|
+
}));
|
|
530
|
+
}
|
|
531
|
+
var fileName = this.url;
|
|
427
532
|
var audioStreams = this.generateAudioStreamsConfig({
|
|
428
|
-
|
|
533
|
+
liveRecordingConfigProfile: customSettings.liveRecordingConfigProfile
|
|
429
534
|
});
|
|
430
535
|
|
|
431
536
|
// Retrieve one audio stream from the probe to read the sample rate and codec name
|
|
@@ -453,16 +558,11 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
453
558
|
}
|
|
454
559
|
|
|
455
560
|
// Fill in specifics for protocol
|
|
456
|
-
switch (this.
|
|
457
|
-
case "
|
|
561
|
+
switch (this.getFormat()) {
|
|
562
|
+
case "mpegts":
|
|
458
563
|
sourceTimescale = 90000;
|
|
459
564
|
conf.live_recording.recording_config.recording_params.source_timescale = sourceTimescale;
|
|
460
565
|
break;
|
|
461
|
-
case "srt":
|
|
462
|
-
sourceTimescale = 90000;
|
|
463
|
-
conf.live_recording.recording_config.recording_params.source_timescale = sourceTimescale;
|
|
464
|
-
conf.live_recording.recording_config.recording_params.live_delay_nano = 4000000000;
|
|
465
|
-
break;
|
|
466
566
|
case "rtmp":
|
|
467
567
|
sourceTimescale = 16000;
|
|
468
568
|
conf.live_recording.recording_config.recording_params.source_timescale = sourceTimescale;
|
|
@@ -471,7 +571,14 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
471
571
|
console.log("HLS detected. Not yet implemented");
|
|
472
572
|
break;
|
|
473
573
|
default:
|
|
474
|
-
console.log("Unsupported media", this.
|
|
574
|
+
console.log("Unsupported media", this.getFormat());
|
|
575
|
+
break;
|
|
576
|
+
}
|
|
577
|
+
switch (this.getProtocol()) {
|
|
578
|
+
case "srt":
|
|
579
|
+
if (!((_customSettings$liveR = customSettings.liveRecordingConfigProfile) !== null && _customSettings$liveR !== void 0 && (_customSettings$liveR = _customSettings$liveR.recording_params) !== null && _customSettings$liveR !== void 0 && _customSettings$liveR.live_delay_nano)) {
|
|
580
|
+
conf.live_recording.recording_config.recording_params.live_delay_nano = 6000000000;
|
|
581
|
+
}
|
|
475
582
|
break;
|
|
476
583
|
}
|
|
477
584
|
var segDurations = this.calcSegDuration({
|
|
@@ -496,10 +603,14 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
496
603
|
if (segDurations.videoFrameDurationTs) {
|
|
497
604
|
conf.live_recording.recording_config.recording_params.xc_params.video_frame_duration_ts = segDurations.videoFrameDurationTs;
|
|
498
605
|
}
|
|
499
|
-
var
|
|
606
|
+
var ladder_specs = (_customSettings$liveR2 = customSettings.liveRecordingConfigProfile) === null || _customSettings$liveR2 === void 0 || (_customSettings$liveR2 = _customSettings$liveR2.playout_config) === null || _customSettings$liveR2 === void 0 ? void 0 : _customSettings$liveR2.ladder_specs;
|
|
607
|
+
var ladderProfile = (ladder_specs === null || ladder_specs === void 0 || (_ladder_specs$video = ladder_specs.video) === null || _ladder_specs$video === void 0 ? void 0 : _ladder_specs$video.length) > 0 ? ladder_specs : DefaultABRLadder;
|
|
500
608
|
conf.live_recording.recording_config.recording_params.xc_params.enc_height = videoStream.height;
|
|
501
609
|
conf.live_recording.recording_config.recording_params.xc_params.enc_width = videoStream.width;
|
|
502
610
|
|
|
611
|
+
// Reset ladder specs (updating existing stream will carry over old specs
|
|
612
|
+
conf.live_recording.recording_config.recording_params.ladder_specs = [];
|
|
613
|
+
|
|
503
614
|
// Determine video recording bitrate and ABR ladder
|
|
504
615
|
var topLadderRate = 0;
|
|
505
616
|
for (var _i = 0; _i < ladderProfile.video.length; _i++) {
|
|
@@ -521,6 +632,7 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
521
632
|
var globalAudioBitrate = 0;
|
|
522
633
|
var nAudio = 0;
|
|
523
634
|
for (var _i2 = 0; _i2 < Object.keys(audioStreams).length; _i2++) {
|
|
635
|
+
var _audio$lang;
|
|
524
636
|
var audioLadderSpec = {};
|
|
525
637
|
var audioIndex = Object.keys(audioStreams)[_i2];
|
|
526
638
|
var audio = audioStreams[audioIndex];
|
|
@@ -543,7 +655,8 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
543
655
|
audioLadderSpec.stream_name = "audio_".concat(audioIndex);
|
|
544
656
|
audioLadderSpec.stream_label = audio.playoutLabel ? audio.playoutLabel : null;
|
|
545
657
|
audioLadderSpec.media_type = 2;
|
|
546
|
-
|
|
658
|
+
audioLadderSpec.lang = (_audio$lang = audio.lang) !== null && _audio$lang !== void 0 ? _audio$lang : "";
|
|
659
|
+
if (Object.keys(audioStreams).length === 1 || audio.isDefault) {
|
|
547
660
|
audioLadderSpec["default"] = true;
|
|
548
661
|
}
|
|
549
662
|
conf.live_recording.recording_config.recording_params.ladder_specs.push(audioLadderSpec);
|
|
@@ -556,33 +669,6 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
556
669
|
// Global recording bitrate for all audio streams
|
|
557
670
|
conf.live_recording.recording_config.recording_params.xc_params.audio_bitrate = globalAudioBitrate;
|
|
558
671
|
conf.live_recording.recording_config.recording_params.xc_params.n_audio = nAudio;
|
|
559
|
-
|
|
560
|
-
// Iterate through custom settings (which will override any existing setting)
|
|
561
|
-
function SetByPath(_ref6) {
|
|
562
|
-
var obj = _ref6.obj,
|
|
563
|
-
path = _ref6.path,
|
|
564
|
-
value = _ref6.value;
|
|
565
|
-
var keys = path.split(".");
|
|
566
|
-
var temp = obj;
|
|
567
|
-
for (var _i3 = 0; _i3 < keys.length - 1; _i3++) {
|
|
568
|
-
if (!temp[keys[_i3]]) {
|
|
569
|
-
temp[keys[_i3]] = {};
|
|
570
|
-
}
|
|
571
|
-
temp = temp[keys[_i3]];
|
|
572
|
-
}
|
|
573
|
-
temp[keys[keys.length - 1]] = value;
|
|
574
|
-
}
|
|
575
|
-
var metaPathValues = customSettings.metaPathValues;
|
|
576
|
-
for (var _i4 = 0, _Object$entries = Object.entries(metaPathValues || {}); _i4 < _Object$entries.length; _i4++) {
|
|
577
|
-
var _Object$entries$_i = _slicedToArray(_Object$entries[_i4], 2),
|
|
578
|
-
path = _Object$entries$_i[0],
|
|
579
|
-
value = _Object$entries$_i[1];
|
|
580
|
-
SetByPath({
|
|
581
|
-
obj: conf,
|
|
582
|
-
path: path,
|
|
583
|
-
value: value
|
|
584
|
-
});
|
|
585
|
-
}
|
|
586
672
|
return conf;
|
|
587
673
|
}
|
|
588
674
|
}]);
|