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