@eluvio/elv-client-js 4.2.29 → 4.2.30
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/ElvClient.js +355 -275
- package/dist/src/EthClient.js +3 -2
- package/dist/src/FrameClient.js +1 -1
- package/dist/src/client/ABRPublishing.js +71 -60
- package/dist/src/client/ContentAccess.js +298 -204
- package/dist/src/client/Files.js +1400 -844
- package/dist/src/client/LiveConf.js +54 -37
- package/dist/src/client/LiveStream.js +123 -81
- package/package.json +1 -1
- package/src/ElvClient.js +51 -0
- package/src/FrameClient.js +1 -0
- package/dist/src/ContentObjectVerification.js +0 -281
|
@@ -221,7 +221,8 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
221
221
|
*
|
|
222
222
|
* Live input formats have fixed timebase:
|
|
223
223
|
* - MPEG-TS/SRT input stream timebase is 90000
|
|
224
|
-
* - RTMP input stream timebase is 1000 and gets translated to
|
|
224
|
+
* - RTMP input stream timebase is 1000 and gets translated to match the frame rate
|
|
225
|
+
* (eg. 24000 @24fps, 30000 @30fps/29.97fps, 60000 @60fps/59.94fps)
|
|
225
226
|
*
|
|
226
227
|
* This causes frame duration irregularities for certain frame rates.
|
|
227
228
|
* For example RTMP 60fps has frames of durations 16 and 17. MPEG-TS 59.94fps has frames of
|
|
@@ -232,10 +233,13 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
232
233
|
* to make the math possible. This adjustment is also required for live-to-vod conversion.
|
|
233
234
|
*
|
|
234
235
|
* For example for MPEG-TS 59.94fps, the mez segment timebase needs to be 60000
|
|
235
|
-
* (and resulting frame duration is 1001) and for RTMP 60fps the timebase
|
|
236
|
-
* duration is
|
|
236
|
+
* (and resulting frame duration is 1001) and for RTMP 60fps the timebase is set to 60000
|
|
237
|
+
* (resulting frame duration is 1000). For every supported RTMP frame rate, the video timebase is
|
|
238
|
+
* set equal to the source timescale, with a frame duration of 1000 (1001 for the *000/1001
|
|
239
|
+
* fractional rates).
|
|
237
240
|
*
|
|
238
|
-
* @sourceTimescale - adjusted source video stream timescale (eg. MPEGTS 90000
|
|
241
|
+
* @sourceTimescale - adjusted source video stream timescale (eg. MPEGTS 90000; ignored for RTMP,
|
|
242
|
+
* which derives its own timebase per frame rate in calcSegDurationRtmp)
|
|
239
243
|
* @sampleRate - audio sample rate (commonly 48000 but can be different)
|
|
240
244
|
* @audioCodec - audio codec as a string (eg. "aac")
|
|
241
245
|
* @return - segment encoding parameters
|
|
@@ -350,57 +354,64 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
350
354
|
}
|
|
351
355
|
}, {
|
|
352
356
|
key: "calcSegDurationRtmp",
|
|
353
|
-
value: function calcSegDurationRtmp(
|
|
354
|
-
var sourceTimescale = _ref5.sourceTimescale;
|
|
357
|
+
value: function calcSegDurationRtmp() {
|
|
355
358
|
var videoStream = this.getStreamDataForCodecType("video");
|
|
356
359
|
var frameRate = videoStream.frame_rate;
|
|
357
360
|
var seg = {};
|
|
358
361
|
switch (frameRate) {
|
|
359
362
|
case "24":
|
|
360
|
-
seg.videoTimeBase =
|
|
361
|
-
seg.videoFrameDurationTs =
|
|
362
|
-
seg.video =
|
|
363
|
+
seg.videoTimeBase = 24000;
|
|
364
|
+
seg.videoFrameDurationTs = 1000;
|
|
365
|
+
seg.video = seg.videoTimeBase * 30;
|
|
363
366
|
seg.keyint = 48;
|
|
364
367
|
seg.duration = "30";
|
|
365
368
|
break;
|
|
366
369
|
case "25":
|
|
367
|
-
seg.
|
|
370
|
+
seg.videoTimeBase = 25000;
|
|
371
|
+
seg.videoFrameDurationTs = 1000;
|
|
372
|
+
seg.video = seg.videoTimeBase * 30;
|
|
368
373
|
seg.keyint = 50;
|
|
369
374
|
seg.duration = "30";
|
|
370
375
|
break;
|
|
371
376
|
case "30":
|
|
372
|
-
seg.videoTimeBase =
|
|
373
|
-
seg.videoFrameDurationTs =
|
|
374
|
-
seg.video =
|
|
377
|
+
seg.videoTimeBase = 30000;
|
|
378
|
+
seg.videoFrameDurationTs = 1000;
|
|
379
|
+
seg.video = seg.videoTimeBase * 30;
|
|
375
380
|
seg.keyint = 60;
|
|
376
381
|
seg.duration = "30";
|
|
377
382
|
break;
|
|
378
383
|
case "30000/1001":
|
|
379
|
-
seg.
|
|
384
|
+
seg.videoTimeBase = 30000;
|
|
385
|
+
seg.videoFrameDurationTs = 1001;
|
|
386
|
+
seg.video = seg.videoTimeBase * 30.03;
|
|
380
387
|
seg.keyint = 60;
|
|
381
388
|
seg.duration = "30.03";
|
|
382
389
|
break;
|
|
383
390
|
case "48":
|
|
384
|
-
seg.videoTimeBase =
|
|
385
|
-
seg.videoFrameDurationTs =
|
|
386
|
-
seg.video =
|
|
391
|
+
seg.videoTimeBase = 48000;
|
|
392
|
+
seg.videoFrameDurationTs = 1000;
|
|
393
|
+
seg.video = seg.videoTimeBase * 30;
|
|
387
394
|
seg.keyint = 96;
|
|
388
395
|
seg.duration = "30";
|
|
389
396
|
break;
|
|
390
397
|
case "50":
|
|
391
|
-
seg.
|
|
398
|
+
seg.videoTimeBase = 50000;
|
|
399
|
+
seg.videoFrameDurationTs = 1000;
|
|
400
|
+
seg.video = seg.videoTimeBase * 30;
|
|
392
401
|
seg.keyint = 100;
|
|
393
402
|
seg.duration = "30";
|
|
394
403
|
break;
|
|
395
404
|
case "60":
|
|
396
|
-
seg.videoTimeBase =
|
|
397
|
-
seg.videoFrameDurationTs =
|
|
398
|
-
seg.video =
|
|
405
|
+
seg.videoTimeBase = 60000;
|
|
406
|
+
seg.videoFrameDurationTs = 1000;
|
|
407
|
+
seg.video = seg.videoTimeBase * 30;
|
|
399
408
|
seg.keyint = 120;
|
|
400
409
|
seg.duration = "30";
|
|
401
410
|
break;
|
|
402
411
|
case "60000/1001":
|
|
403
|
-
seg.
|
|
412
|
+
seg.videoTimeBase = 60000;
|
|
413
|
+
seg.videoFrameDurationTs = 1001;
|
|
414
|
+
seg.video = seg.videoTimeBase * 30.03;
|
|
404
415
|
seg.keyint = 120;
|
|
405
416
|
seg.duration = "30.03";
|
|
406
417
|
break;
|
|
@@ -432,8 +443,8 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
432
443
|
*/
|
|
433
444
|
}, {
|
|
434
445
|
key: "MapCustomProfileToLiveConfig",
|
|
435
|
-
value: function MapCustomProfileToLiveConfig(
|
|
436
|
-
var customProfile =
|
|
446
|
+
value: function MapCustomProfileToLiveConfig(_ref5) {
|
|
447
|
+
var customProfile = _ref5.customProfile;
|
|
437
448
|
if (!customProfile) return {};
|
|
438
449
|
var CompactDeep = function CompactDeep(obj) {
|
|
439
450
|
if (obj === null || _typeof(obj) !== "object" || Array.isArray(obj)) {
|
|
@@ -469,9 +480,9 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
469
480
|
*/
|
|
470
481
|
}, {
|
|
471
482
|
key: "generateAudioStreamsConfig",
|
|
472
|
-
value: function generateAudioStreamsConfig(
|
|
483
|
+
value: function generateAudioStreamsConfig(_ref6) {
|
|
473
484
|
var _liveRecordingConfigP, _liveRecordingConfigP2;
|
|
474
|
-
var liveRecordingConfigProfile =
|
|
485
|
+
var liveRecordingConfigProfile = _ref6.liveRecordingConfigProfile;
|
|
475
486
|
var ladderProfile = (liveRecordingConfigProfile === null || liveRecordingConfigProfile === void 0 || (_liveRecordingConfigP = liveRecordingConfigProfile.playout_config) === null || _liveRecordingConfigP === void 0 ? void 0 : _liveRecordingConfigP.ladder_specs) || DefaultABRLadder;
|
|
476
487
|
var audioSettings = liveRecordingConfigProfile === null || liveRecordingConfigProfile === void 0 || (_liveRecordingConfigP2 = liveRecordingConfigProfile.recording_stream_config) === null || _liveRecordingConfigP2 === void 0 ? void 0 : _liveRecordingConfigP2.audio;
|
|
477
488
|
var audioStreams = {};
|
|
@@ -513,9 +524,9 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
513
524
|
*/
|
|
514
525
|
}, {
|
|
515
526
|
key: "generateLiveConf",
|
|
516
|
-
value: function generateLiveConf(
|
|
517
|
-
var _customSettings$liveR, _customSettings$liveR2, _ladder_specs$video;
|
|
518
|
-
var customSettings =
|
|
527
|
+
value: function generateLiveConf(_ref7) {
|
|
528
|
+
var _customSettings$liveR, _customRecordingParam, _customRecordingParam2, _customSettings$liveR2, _customXcParams$video, _customSettings$liveR3, _ladder_specs$video;
|
|
529
|
+
var customSettings = _ref7.customSettings;
|
|
519
530
|
// Saved config overrides defaults and is preserved on reconfiguration
|
|
520
531
|
var conf = R.clone(LiveconfTemplate);
|
|
521
532
|
if (this.currentLiveRecordingMeta) {
|
|
@@ -540,6 +551,10 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
540
551
|
var videoStream = this.getStreamDataForCodecType("video");
|
|
541
552
|
var sourceTimescale;
|
|
542
553
|
|
|
554
|
+
// Custom profile values take precedence over computed defaults
|
|
555
|
+
var customRecordingParams = (_customSettings$liveR = customSettings.liveRecordingConfigProfile) === null || _customSettings$liveR === void 0 ? void 0 : _customSettings$liveR.recording_params;
|
|
556
|
+
var customXcParams = customRecordingParams === null || customRecordingParams === void 0 ? void 0 : customRecordingParams.xc_params;
|
|
557
|
+
|
|
543
558
|
// Fill in liveconf all formats have in common
|
|
544
559
|
conf.live_recording.fabric_config.ingress_node_api = this.nodeUrl || null;
|
|
545
560
|
conf.live_recording.fabric_config.ingress_node_id = this.nodeId || null;
|
|
@@ -560,12 +575,12 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
560
575
|
// Fill in specifics for protocol
|
|
561
576
|
switch (this.getFormat()) {
|
|
562
577
|
case "mpegts":
|
|
563
|
-
sourceTimescale = 90000;
|
|
578
|
+
sourceTimescale = (_customRecordingParam = customRecordingParams === null || customRecordingParams === void 0 ? void 0 : customRecordingParams.source_timescale) !== null && _customRecordingParam !== void 0 ? _customRecordingParam : 90000;
|
|
564
579
|
conf.live_recording.recording_config.recording_params.source_timescale = sourceTimescale;
|
|
565
580
|
break;
|
|
566
581
|
case "rtmp":
|
|
567
582
|
case "flv":
|
|
568
|
-
sourceTimescale = 16000;
|
|
583
|
+
sourceTimescale = (_customRecordingParam2 = customRecordingParams === null || customRecordingParams === void 0 ? void 0 : customRecordingParams.source_timescale) !== null && _customRecordingParam2 !== void 0 ? _customRecordingParam2 : 16000;
|
|
569
584
|
conf.live_recording.recording_config.recording_params.source_timescale = sourceTimescale;
|
|
570
585
|
break;
|
|
571
586
|
case "hls":
|
|
@@ -577,7 +592,7 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
577
592
|
}
|
|
578
593
|
switch (this.getProtocol()) {
|
|
579
594
|
case "srt":
|
|
580
|
-
if (!((_customSettings$
|
|
595
|
+
if (!((_customSettings$liveR2 = customSettings.liveRecordingConfigProfile) !== null && _customSettings$liveR2 !== void 0 && (_customSettings$liveR2 = _customSettings$liveR2.recording_params) !== null && _customSettings$liveR2 !== void 0 && _customSettings$liveR2.live_delay_nano)) {
|
|
581
596
|
conf.live_recording.recording_config.recording_params.live_delay_nano = 6000000000;
|
|
582
597
|
}
|
|
583
598
|
break;
|
|
@@ -591,20 +606,22 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
591
606
|
// Segment conditioning parameters
|
|
592
607
|
conf.live_recording.recording_config.recording_params.xc_params.seg_duration = segDurations.duration;
|
|
593
608
|
conf.live_recording.recording_config.recording_params.xc_params.audio_seg_duration_ts = segDurations.audio;
|
|
594
|
-
conf.live_recording.recording_config.recording_params.xc_params.video_seg_duration_ts = segDurations.video;
|
|
609
|
+
conf.live_recording.recording_config.recording_params.xc_params.video_seg_duration_ts = (_customXcParams$video = customXcParams === null || customXcParams === void 0 ? void 0 : customXcParams.video_seg_duration_ts) !== null && _customXcParams$video !== void 0 ? _customXcParams$video : segDurations.video;
|
|
595
610
|
conf.live_recording.recording_config.recording_params.xc_params.force_keyint = segDurations.keyint;
|
|
596
611
|
|
|
597
612
|
// Optional override output timebase and frame duration (ts)
|
|
598
|
-
if (segDurations.videoTimeBase) {
|
|
613
|
+
if (segDurations.videoTimeBase && R.isNil(customXcParams === null || customXcParams === void 0 ? void 0 : customXcParams.video_time_base)) {
|
|
599
614
|
conf.live_recording.recording_config.recording_params.xc_params.video_time_base = segDurations.videoTimeBase;
|
|
600
615
|
|
|
601
616
|
// Note 'source_timescale' needs to be set to the output timebase and is used by playout
|
|
602
|
-
|
|
617
|
+
if (R.isNil(customRecordingParams === null || customRecordingParams === void 0 ? void 0 : customRecordingParams.source_timescale)) {
|
|
618
|
+
conf.live_recording.recording_config.recording_params.source_timescale = this.calcOutputTimebase(segDurations.videoTimeBase);
|
|
619
|
+
}
|
|
603
620
|
}
|
|
604
|
-
if (segDurations.videoFrameDurationTs) {
|
|
621
|
+
if (segDurations.videoFrameDurationTs && R.isNil(customXcParams === null || customXcParams === void 0 ? void 0 : customXcParams.video_frame_duration_ts)) {
|
|
605
622
|
conf.live_recording.recording_config.recording_params.xc_params.video_frame_duration_ts = segDurations.videoFrameDurationTs;
|
|
606
623
|
}
|
|
607
|
-
var ladder_specs = (_customSettings$
|
|
624
|
+
var ladder_specs = (_customSettings$liveR3 = customSettings.liveRecordingConfigProfile) === null || _customSettings$liveR3 === void 0 || (_customSettings$liveR3 = _customSettings$liveR3.playout_config) === null || _customSettings$liveR3 === void 0 ? void 0 : _customSettings$liveR3.ladder_specs;
|
|
608
625
|
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;
|
|
609
626
|
conf.live_recording.recording_config.recording_params.xc_params.enc_height = videoStream.height;
|
|
610
627
|
conf.live_recording.recording_config.recording_params.xc_params.enc_width = videoStream.width;
|
|
@@ -365,7 +365,7 @@ exports.StreamCreate = /*#__PURE__*/function () {
|
|
|
365
365
|
_liveRecordingConfig2,
|
|
366
366
|
_liveRecordingConfig3,
|
|
367
367
|
_liveRecordingConfig5;
|
|
368
|
-
var libraryId, objectId, url, _ref12$finalize, finalize, liveRecordingConfig, _ref12$options, options, defaultName, existingObject, contentType, adminGroups, _tenantContentAdminGr, _tenantMeta$content_t, tenantId, tenantMeta, tenantContentAdminGroup, editResponse, _editResponse, writeToken, accessGroup, _options$name, name, displayTitle, description, _options$permission, permission, ingressNodeId, _options$initializeDr, initializeDrm, playoutFormats, invalid, metadata, oldProfile, returnResponse, _liveRecordingConfig4, formats, finalizeResponse, _liveRecordingConfig6, slug;
|
|
368
|
+
var libraryId, objectId, url, _ref12$finalize, finalize, liveRecordingConfig, _ref12$options, options, defaultName, existingObject, contentType, adminGroups, _tenantContentAdminGr, _tenantMeta$content_t, tenantId, tenantMeta, tenantContentAdminGroup, editResponse, _editResponse, writeToken, accessGroup, _options$name, name, displayTitle, description, _options$permission, permission, ingressNodeId, _options$initializeDr, initializeDrm, playoutFormats, invalid, metadata, currentLiveRecordingConfig, oldProfile, returnResponse, _liveRecordingConfig4, formats, finalizeResponse, _liveRecordingConfig6, slug;
|
|
369
369
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
370
370
|
while (1) switch (_context8.prev = _context8.next) {
|
|
371
371
|
case 0:
|
|
@@ -526,30 +526,46 @@ exports.StreamCreate = /*#__PURE__*/function () {
|
|
|
526
526
|
video_type: "live",
|
|
527
527
|
slug: slugify(name)
|
|
528
528
|
}
|
|
529
|
-
}
|
|
530
|
-
"live_recording_config": liveRecordingConfig
|
|
529
|
+
}
|
|
531
530
|
};
|
|
532
531
|
_context8.next = 61;
|
|
533
532
|
return this.ContentObjectMetadata({
|
|
534
533
|
libraryId: libraryId,
|
|
535
534
|
objectId: objectId,
|
|
536
|
-
metadataSubtree: "live_recording_config
|
|
535
|
+
metadataSubtree: "live_recording_config"
|
|
537
536
|
});
|
|
538
537
|
case 61:
|
|
539
|
-
|
|
538
|
+
_context8.t3 = _context8.sent;
|
|
539
|
+
if (_context8.t3) {
|
|
540
|
+
_context8.next = 64;
|
|
541
|
+
break;
|
|
542
|
+
}
|
|
543
|
+
_context8.t3 = {};
|
|
544
|
+
case 64:
|
|
545
|
+
currentLiveRecordingConfig = _context8.t3;
|
|
546
|
+
oldProfile = currentLiveRecordingConfig.name;
|
|
540
547
|
if ((_liveRecordingConfig2 = liveRecordingConfig) !== null && _liveRecordingConfig2 !== void 0 && _liveRecordingConfig2.name && liveRecordingConfig.name !== oldProfile) {
|
|
541
548
|
metadata["public"].asset_metadata.profile_last_updated = new Date().toISOString();
|
|
542
549
|
}
|
|
543
|
-
_context8.next =
|
|
550
|
+
_context8.next = 69;
|
|
544
551
|
return this.MergeMetadata({
|
|
545
552
|
libraryId: libraryId,
|
|
546
553
|
objectId: objectId,
|
|
547
554
|
writeToken: writeToken,
|
|
548
555
|
metadata: metadata
|
|
549
556
|
});
|
|
550
|
-
case
|
|
551
|
-
_context8.
|
|
552
|
-
|
|
557
|
+
case 69:
|
|
558
|
+
_context8.next = 71;
|
|
559
|
+
return this.ReplaceMetadata({
|
|
560
|
+
libraryId: libraryId,
|
|
561
|
+
objectId: objectId,
|
|
562
|
+
writeToken: writeToken,
|
|
563
|
+
metadataSubtree: "live_recording_config",
|
|
564
|
+
metadata: R.mergeDeepRight(currentLiveRecordingConfig, liveRecordingConfig)
|
|
565
|
+
});
|
|
566
|
+
case 71:
|
|
567
|
+
_context8.prev = 71;
|
|
568
|
+
_context8.next = 74;
|
|
553
569
|
return this.CreateLinks({
|
|
554
570
|
libraryId: libraryId,
|
|
555
571
|
objectId: objectId,
|
|
@@ -560,31 +576,31 @@ exports.StreamCreate = /*#__PURE__*/function () {
|
|
|
560
576
|
target: "playout/default/options.json"
|
|
561
577
|
}]
|
|
562
578
|
});
|
|
563
|
-
case
|
|
564
|
-
_context8.next =
|
|
579
|
+
case 74:
|
|
580
|
+
_context8.next = 79;
|
|
565
581
|
break;
|
|
566
|
-
case
|
|
567
|
-
_context8.prev =
|
|
568
|
-
_context8.
|
|
569
|
-
console.log("Failed to create links", _context8.
|
|
570
|
-
case
|
|
571
|
-
_context8.next =
|
|
582
|
+
case 76:
|
|
583
|
+
_context8.prev = 76;
|
|
584
|
+
_context8.t4 = _context8["catch"](71);
|
|
585
|
+
console.log("Failed to create links", _context8.t4);
|
|
586
|
+
case 79:
|
|
587
|
+
_context8.next = 81;
|
|
572
588
|
return this.SetPermission({
|
|
573
589
|
objectId: objectId,
|
|
574
590
|
permission: permission,
|
|
575
591
|
writeToken: writeToken
|
|
576
592
|
});
|
|
577
|
-
case
|
|
593
|
+
case 81:
|
|
578
594
|
returnResponse = {
|
|
579
595
|
objectId: objectId,
|
|
580
596
|
libraryId: libraryId,
|
|
581
597
|
writeToken: writeToken
|
|
582
598
|
}; // If stream info is provided, continue to configure
|
|
583
599
|
if (!((_liveRecordingConfig3 = liveRecordingConfig) !== null && _liveRecordingConfig3 !== void 0 && _liveRecordingConfig3.input_stream_info)) {
|
|
584
|
-
_context8.next =
|
|
600
|
+
_context8.next = 85;
|
|
585
601
|
break;
|
|
586
602
|
}
|
|
587
|
-
_context8.next =
|
|
603
|
+
_context8.next = 85;
|
|
588
604
|
return this.StreamConfig({
|
|
589
605
|
name: objectId,
|
|
590
606
|
liveRecordingConfig: liveRecordingConfig,
|
|
@@ -592,13 +608,13 @@ exports.StreamCreate = /*#__PURE__*/function () {
|
|
|
592
608
|
writeToken: writeToken,
|
|
593
609
|
finalize: false
|
|
594
610
|
});
|
|
595
|
-
case
|
|
611
|
+
case 85:
|
|
596
612
|
if (!initializeDrm) {
|
|
597
|
-
_context8.next =
|
|
613
|
+
_context8.next = 89;
|
|
598
614
|
break;
|
|
599
615
|
}
|
|
600
616
|
formats = (_liveRecordingConfig4 = liveRecordingConfig) === null || _liveRecordingConfig4 === void 0 || (_liveRecordingConfig4 = _liveRecordingConfig4.playout_config) === null || _liveRecordingConfig4 === void 0 ? void 0 : _liveRecordingConfig4.playout_formats;
|
|
601
|
-
_context8.next =
|
|
617
|
+
_context8.next = 89;
|
|
602
618
|
return this.StreamInitialize({
|
|
603
619
|
name: objectId,
|
|
604
620
|
drm: (formats || []).some(function (el) {
|
|
@@ -608,48 +624,48 @@ exports.StreamCreate = /*#__PURE__*/function () {
|
|
|
608
624
|
writeToken: writeToken,
|
|
609
625
|
finalize: false
|
|
610
626
|
});
|
|
611
|
-
case
|
|
627
|
+
case 89:
|
|
612
628
|
if (!finalize) {
|
|
613
|
-
_context8.next =
|
|
629
|
+
_context8.next = 94;
|
|
614
630
|
break;
|
|
615
631
|
}
|
|
616
|
-
_context8.next =
|
|
632
|
+
_context8.next = 92;
|
|
617
633
|
return this.FinalizeContentObject({
|
|
618
634
|
libraryId: libraryId,
|
|
619
635
|
objectId: objectId,
|
|
620
636
|
writeToken: writeToken,
|
|
621
637
|
commitMessage: existingObject ? "Update live stream" : "Create live stream"
|
|
622
638
|
});
|
|
623
|
-
case
|
|
639
|
+
case 92:
|
|
624
640
|
finalizeResponse = _context8.sent;
|
|
625
641
|
returnResponse = _objectSpread(_objectSpread({}, returnResponse), finalizeResponse);
|
|
626
|
-
case
|
|
642
|
+
case 94:
|
|
627
643
|
if (!(finalize && (_liveRecordingConfig5 = liveRecordingConfig) !== null && _liveRecordingConfig5 !== void 0 && _liveRecordingConfig5.name)) {
|
|
628
|
-
_context8.next =
|
|
644
|
+
_context8.next = 98;
|
|
629
645
|
break;
|
|
630
646
|
}
|
|
631
647
|
slug = slugify((_liveRecordingConfig6 = liveRecordingConfig) === null || _liveRecordingConfig6 === void 0 ? void 0 : _liveRecordingConfig6.name);
|
|
632
|
-
_context8.next =
|
|
648
|
+
_context8.next = 98;
|
|
633
649
|
return this.StreamAssignProfile({
|
|
634
650
|
profileSlug: slug,
|
|
635
651
|
streamObjectId: objectId
|
|
636
652
|
});
|
|
637
|
-
case
|
|
653
|
+
case 98:
|
|
638
654
|
if (!options.linkToSite) {
|
|
639
|
-
_context8.next =
|
|
655
|
+
_context8.next = 101;
|
|
640
656
|
break;
|
|
641
657
|
}
|
|
642
|
-
_context8.next =
|
|
658
|
+
_context8.next = 101;
|
|
643
659
|
return this.StreamLinkToSite({
|
|
644
660
|
objectId: objectId
|
|
645
661
|
});
|
|
646
|
-
case
|
|
662
|
+
case 101:
|
|
647
663
|
return _context8.abrupt("return", returnResponse);
|
|
648
|
-
case
|
|
664
|
+
case 102:
|
|
649
665
|
case "end":
|
|
650
666
|
return _context8.stop();
|
|
651
667
|
}
|
|
652
|
-
}, _callee8, this, [[4, 29], [11, 20], [
|
|
668
|
+
}, _callee8, this, [[4, 29], [11, 20], [71, 76]]);
|
|
653
669
|
}));
|
|
654
670
|
return function (_x7) {
|
|
655
671
|
return _ref13.apply(this, arguments);
|
|
@@ -1285,7 +1301,7 @@ var StreamGenerateOffering = /*#__PURE__*/function () {
|
|
|
1285
1301
|
*/
|
|
1286
1302
|
exports.StreamStatus = /*#__PURE__*/function () {
|
|
1287
1303
|
var _ref24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref23) {
|
|
1288
|
-
var name, _ref23$showParams, showParams, writeToken, objectId, status, _mainMeta$live_record, _mainMeta$live_record2, libraryId, mainMeta, fabURI, edgeWriteToken, edgeMeta, recordings, sequence, period, tlro, videoLastFinalizationTimeEpochSec, videoFinalizedParts, sinceLastFinalize, recordingPeriod, insertions, i, insertionTimeSinceEpoch, state, lroStatus, retrievePlayoutOptions, playoutUrls, playout_options, hls_clear_enabled, hls_aes128_enabled, hls_sample_aes_enabled, networkInfo, token, embed_net;
|
|
1304
|
+
var name, _ref23$showParams, showParams, writeToken, objectId, status, _mainMeta$live_record, _mainMeta$live_record2, libraryId, mainMeta, fabURI, edgeWriteToken, edgeMeta, recordings, sequence, period, tlro, videoLastFinalizationTimeEpochSec, videoFinalizedParts, sinceLastFinalize, recordingPeriod, insertions, i, insertionTimeSinceEpoch, state, lroStatus, _error$response, retrievePlayoutOptions, playoutUrls, playout_options, hls_clear_enabled, hls_aes128_enabled, hls_sample_aes_enabled, networkInfo, token, embed_net;
|
|
1289
1305
|
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
1290
1306
|
while (1) switch (_context13.prev = _context13.next) {
|
|
1291
1307
|
case 0:
|
|
@@ -1466,9 +1482,9 @@ exports.StreamStatus = /*#__PURE__*/function () {
|
|
|
1466
1482
|
case 83:
|
|
1467
1483
|
_context13.prev = 83;
|
|
1468
1484
|
_context13.t3 = _context13["catch"](68);
|
|
1469
|
-
console.log("LRO Status (failed): ", _context13.t3.response.statusCode);
|
|
1485
|
+
console.log("LRO Status (failed): ", (_error$response = _context13.t3.response) === null || _error$response === void 0 ? void 0 : _error$response.statusCode);
|
|
1470
1486
|
status.state = "stopped";
|
|
1471
|
-
status.error = _context13.t3.response;
|
|
1487
|
+
status.error = _context13.t3.response || _context13.t3.message;
|
|
1472
1488
|
return _context13.abrupt("return", status);
|
|
1473
1489
|
case 89:
|
|
1474
1490
|
// Convert LRO 'state' to desired 'state'
|
|
@@ -4751,12 +4767,24 @@ exports.OutputsList = /*#__PURE__*/function () {
|
|
|
4751
4767
|
});
|
|
4752
4768
|
case 13:
|
|
4753
4769
|
outputs = _context39.sent;
|
|
4754
|
-
|
|
4755
|
-
|
|
4770
|
+
_context39.next = 21;
|
|
4771
|
+
break;
|
|
4772
|
+
case 16:
|
|
4773
|
+
_context39.prev = 16;
|
|
4774
|
+
_context39.t0 = _context39["catch"](10);
|
|
4775
|
+
if (!(_context39.t0.status === 404)) {
|
|
4776
|
+
_context39.next = 20;
|
|
4777
|
+
break;
|
|
4778
|
+
}
|
|
4779
|
+
return _context39.abrupt("return", {});
|
|
4780
|
+
case 20:
|
|
4781
|
+
throw _context39.t0;
|
|
4782
|
+
case 21:
|
|
4783
|
+
_context39.prev = 21;
|
|
4756
4784
|
restore();
|
|
4757
|
-
return _context39.finish(
|
|
4758
|
-
case
|
|
4759
|
-
_context39.next =
|
|
4785
|
+
return _context39.finish(21);
|
|
4786
|
+
case 24:
|
|
4787
|
+
_context39.next = 26;
|
|
4760
4788
|
return this.utils.LimitedMap(10, Object.values(outputs), /*#__PURE__*/function () {
|
|
4761
4789
|
var _ref73 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee36(value) {
|
|
4762
4790
|
var _value$input;
|
|
@@ -4771,83 +4799,97 @@ exports.OutputsList = /*#__PURE__*/function () {
|
|
|
4771
4799
|
}
|
|
4772
4800
|
return _context36.abrupt("return");
|
|
4773
4801
|
case 3:
|
|
4774
|
-
_context36.
|
|
4802
|
+
_context36.prev = 3;
|
|
4803
|
+
_context36.next = 6;
|
|
4775
4804
|
return Promise.all([_this7.ContentObjectLibraryId({
|
|
4776
4805
|
objectId: streamId
|
|
4777
4806
|
}), _this7.StreamStatus({
|
|
4778
4807
|
name: streamId
|
|
4779
4808
|
})]);
|
|
4780
|
-
case
|
|
4809
|
+
case 6:
|
|
4781
4810
|
_yield$Promise$all3 = _context36.sent;
|
|
4782
4811
|
_yield$Promise$all4 = _slicedToArray(_yield$Promise$all3, 2);
|
|
4783
4812
|
streamLibraryId = _yield$Promise$all4[0];
|
|
4784
4813
|
streamStatus = _yield$Promise$all4[1];
|
|
4785
|
-
_context36.next =
|
|
4814
|
+
_context36.next = 12;
|
|
4786
4815
|
return _this7.ContentObjectMetadata({
|
|
4787
4816
|
libraryId: streamLibraryId,
|
|
4788
4817
|
objectId: streamId,
|
|
4789
4818
|
metadataSubtree: "/public/name"
|
|
4790
4819
|
});
|
|
4791
|
-
case
|
|
4820
|
+
case 12:
|
|
4792
4821
|
value.input.name = _context36.sent;
|
|
4793
4822
|
value.input.status = streamStatus === null || streamStatus === void 0 ? void 0 : streamStatus.state;
|
|
4794
|
-
|
|
4823
|
+
_context36.next = 19;
|
|
4824
|
+
break;
|
|
4825
|
+
case 16:
|
|
4826
|
+
_context36.prev = 16;
|
|
4827
|
+
_context36.t0 = _context36["catch"](3);
|
|
4828
|
+
// Stream object may have been deleted
|
|
4829
|
+
value.input.status = "unavailable";
|
|
4830
|
+
case 19:
|
|
4795
4831
|
case "end":
|
|
4796
4832
|
return _context36.stop();
|
|
4797
4833
|
}
|
|
4798
|
-
}, _callee36);
|
|
4834
|
+
}, _callee36, null, [[3, 16]]);
|
|
4799
4835
|
}));
|
|
4800
4836
|
return function (_x34) {
|
|
4801
4837
|
return _ref73.apply(this, arguments);
|
|
4802
4838
|
};
|
|
4803
4839
|
}());
|
|
4804
|
-
case
|
|
4840
|
+
case 26:
|
|
4805
4841
|
if (includeState) {
|
|
4806
|
-
_context39.next =
|
|
4842
|
+
_context39.next = 28;
|
|
4807
4843
|
break;
|
|
4808
4844
|
}
|
|
4809
4845
|
return _context39.abrupt("return", outputs);
|
|
4810
|
-
case
|
|
4846
|
+
case 28:
|
|
4811
4847
|
// Resolve each distinct egress node's fabric URL once (concurrent, read-only)
|
|
4812
4848
|
nodeIds = _toConsumableArray(new Set(Object.values(outputs).map(function (value) {
|
|
4813
4849
|
return OutputDeliveryNodeId(value);
|
|
4814
4850
|
}).filter(Boolean)));
|
|
4815
4851
|
nodeUrls = {};
|
|
4816
|
-
_context39.next =
|
|
4852
|
+
_context39.next = 32;
|
|
4817
4853
|
return this.utils.LimitedMap(10, nodeIds, /*#__PURE__*/function () {
|
|
4818
4854
|
var _ref74 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee37(nodeId) {
|
|
4819
|
-
var _nodes$2;
|
|
4820
|
-
var nodes, fabricUrl;
|
|
4855
|
+
var _nodes$2, nodes, fabricUrl;
|
|
4821
4856
|
return _regeneratorRuntime.wrap(function _callee37$(_context37) {
|
|
4822
4857
|
while (1) switch (_context37.prev = _context37.next) {
|
|
4823
4858
|
case 0:
|
|
4824
|
-
_context37.
|
|
4859
|
+
_context37.prev = 0;
|
|
4860
|
+
_context37.next = 3;
|
|
4825
4861
|
return _this7.SpaceNodes({
|
|
4826
4862
|
matchNodeId: nodeId
|
|
4827
4863
|
});
|
|
4828
|
-
case
|
|
4864
|
+
case 3:
|
|
4829
4865
|
nodes = _context37.sent;
|
|
4830
4866
|
fabricUrl = nodes === null || nodes === void 0 || (_nodes$2 = nodes[0]) === null || _nodes$2 === void 0 || (_nodes$2 = _nodes$2.services) === null || _nodes$2 === void 0 || (_nodes$2 = _nodes$2.fabric_api) === null || _nodes$2 === void 0 || (_nodes$2 = _nodes$2.urls) === null || _nodes$2 === void 0 ? void 0 : _nodes$2[0];
|
|
4831
4867
|
if (fabricUrl) {
|
|
4832
4868
|
nodeUrls[nodeId] = fabricUrl;
|
|
4833
4869
|
}
|
|
4834
|
-
|
|
4870
|
+
_context37.next = 11;
|
|
4871
|
+
break;
|
|
4872
|
+
case 8:
|
|
4873
|
+
_context37.prev = 8;
|
|
4874
|
+
_context37.t0 = _context37["catch"](0);
|
|
4875
|
+
_this7.Log("Failed to resolve node ".concat(nodeId, ": ").concat(_context37.t0.message), true);
|
|
4876
|
+
case 11:
|
|
4835
4877
|
case "end":
|
|
4836
4878
|
return _context37.stop();
|
|
4837
4879
|
}
|
|
4838
|
-
}, _callee37);
|
|
4880
|
+
}, _callee37, null, [[0, 8]]);
|
|
4839
4881
|
}));
|
|
4840
4882
|
return function (_x35) {
|
|
4841
4883
|
return _ref74.apply(this, arguments);
|
|
4842
4884
|
};
|
|
4843
4885
|
}());
|
|
4844
|
-
case
|
|
4886
|
+
case 32:
|
|
4845
4887
|
// Rewrite fabric-generated srt_pull URLs to the egress host, and group outputs by node
|
|
4846
4888
|
outputsByNode = {};
|
|
4847
4889
|
_i3 = 0, _Object$entries = Object.entries(outputs);
|
|
4848
|
-
case
|
|
4890
|
+
case 34:
|
|
4849
4891
|
if (!(_i3 < _Object$entries.length)) {
|
|
4850
|
-
_context39.next =
|
|
4892
|
+
_context39.next = 46;
|
|
4851
4893
|
break;
|
|
4852
4894
|
}
|
|
4853
4895
|
_Object$entries$_i = _slicedToArray(_Object$entries[_i3], 2), key = _Object$entries$_i[0], value = _Object$entries$_i[1];
|
|
@@ -4855,32 +4897,32 @@ exports.OutputsList = /*#__PURE__*/function () {
|
|
|
4855
4897
|
fabricUrl = nodeId && nodeUrls[nodeId];
|
|
4856
4898
|
RewriteSrtPullUrls(value, fabricUrl);
|
|
4857
4899
|
if (fabricUrl) {
|
|
4858
|
-
_context39.next =
|
|
4900
|
+
_context39.next = 42;
|
|
4859
4901
|
break;
|
|
4860
4902
|
}
|
|
4861
4903
|
value.state = {};
|
|
4862
|
-
return _context39.abrupt("continue",
|
|
4863
|
-
case
|
|
4904
|
+
return _context39.abrupt("continue", 43);
|
|
4905
|
+
case 42:
|
|
4864
4906
|
(outputsByNode[nodeId] = outputsByNode[nodeId] || []).push(key);
|
|
4865
|
-
case
|
|
4907
|
+
case 43:
|
|
4866
4908
|
_i3++;
|
|
4867
|
-
_context39.next =
|
|
4909
|
+
_context39.next = 34;
|
|
4868
4910
|
break;
|
|
4869
|
-
case
|
|
4911
|
+
case 46:
|
|
4870
4912
|
// Fetch state per node: route to the node once, fetch its outputs concurrently, then restore
|
|
4871
4913
|
savedURIs = _toConsumableArray(this.fabricURIs);
|
|
4872
|
-
_context39.prev =
|
|
4914
|
+
_context39.prev = 47;
|
|
4873
4915
|
_i4 = 0, _Object$entries2 = Object.entries(outputsByNode);
|
|
4874
|
-
case
|
|
4916
|
+
case 49:
|
|
4875
4917
|
if (!(_i4 < _Object$entries2.length)) {
|
|
4876
|
-
_context39.next =
|
|
4918
|
+
_context39.next = 57;
|
|
4877
4919
|
break;
|
|
4878
4920
|
}
|
|
4879
4921
|
_Object$entries2$_i = _slicedToArray(_Object$entries2[_i4], 2), _nodeId = _Object$entries2$_i[0], outputIds = _Object$entries2$_i[1];
|
|
4880
4922
|
this.SetNodes({
|
|
4881
4923
|
fabricURIs: [nodeUrls[_nodeId]]
|
|
4882
4924
|
});
|
|
4883
|
-
_context39.next =
|
|
4925
|
+
_context39.next = 54;
|
|
4884
4926
|
return this.utils.LimitedMap(10, outputIds, /*#__PURE__*/function () {
|
|
4885
4927
|
var _ref75 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee38(outputId) {
|
|
4886
4928
|
return _regeneratorRuntime.wrap(function _callee38$(_context38) {
|
|
@@ -4917,23 +4959,23 @@ exports.OutputsList = /*#__PURE__*/function () {
|
|
|
4917
4959
|
return _ref75.apply(this, arguments);
|
|
4918
4960
|
};
|
|
4919
4961
|
}());
|
|
4920
|
-
case
|
|
4962
|
+
case 54:
|
|
4921
4963
|
_i4++;
|
|
4922
|
-
_context39.next =
|
|
4964
|
+
_context39.next = 49;
|
|
4923
4965
|
break;
|
|
4924
|
-
case
|
|
4925
|
-
_context39.prev =
|
|
4966
|
+
case 57:
|
|
4967
|
+
_context39.prev = 57;
|
|
4926
4968
|
this.SetNodes({
|
|
4927
4969
|
fabricURIs: savedURIs
|
|
4928
4970
|
});
|
|
4929
|
-
return _context39.finish(
|
|
4930
|
-
case
|
|
4971
|
+
return _context39.finish(57);
|
|
4972
|
+
case 60:
|
|
4931
4973
|
return _context39.abrupt("return", outputs);
|
|
4932
|
-
case
|
|
4974
|
+
case 61:
|
|
4933
4975
|
case "end":
|
|
4934
4976
|
return _context39.stop();
|
|
4935
4977
|
}
|
|
4936
|
-
}, _callee39, this, [[10
|
|
4978
|
+
}, _callee39, this, [[10, 16, 21, 24], [47,, 57, 60]]);
|
|
4937
4979
|
}));
|
|
4938
4980
|
return function (_x33) {
|
|
4939
4981
|
return _ref72.apply(this, arguments);
|