@eluvio/elv-client-js 4.0.83 → 4.0.84
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 +6 -6
- package/dist/ElvClient-node-min.js +6 -6
- package/dist/ElvWalletClient-min.js +1 -1
- package/dist/ElvWalletClient-node-min.js +1 -1
- package/dist/src/client/LiveConf.js +118 -31
- package/dist/src/client/LiveStream.js +411 -467
- package/package.json +1 -1
- package/src/client/LiveConf.js +113 -28
- package/src/client/LiveStream.js +120 -145
|
@@ -426,61 +426,56 @@ var StreamGenerateOffering = /*#__PURE__*/function () {
|
|
|
426
426
|
*/
|
|
427
427
|
exports.StreamStatus = /*#__PURE__*/function () {
|
|
428
428
|
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref7) {
|
|
429
|
-
var name, _ref7$stopLro, stopLro, _ref7$showParams, showParams,
|
|
429
|
+
var name, _ref7$stopLro, stopLro, _ref7$showParams, showParams, objectId, status, libraryId, mainMeta, fabURI, edgeWriteToken, edgeMeta, recordings, sequence, period, tlro, videoLastFinalizationTimeEpochSec, videoFinalizedParts, sinceLastFinalize, recording_period, insertions, i, insertionTimeSinceEpoch, state, lroStatus, playout_urls, playout_options, hls_clear_enabled, hls_aes128_enabled, hls_sample_aes_enabled, networkInfo, token, embed_net, embed_url;
|
|
430
430
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
431
431
|
while (1) switch (_context4.prev = _context4.next) {
|
|
432
432
|
case 0:
|
|
433
433
|
name = _ref7.name, _ref7$stopLro = _ref7.stopLro, stopLro = _ref7$stopLro === void 0 ? false : _ref7$stopLro, _ref7$showParams = _ref7.showParams, showParams = _ref7$showParams === void 0 ? false : _ref7$showParams;
|
|
434
|
-
|
|
435
|
-
return this.LoadConf({
|
|
436
|
-
name: name
|
|
437
|
-
});
|
|
438
|
-
case 3:
|
|
439
|
-
conf = _context4.sent;
|
|
434
|
+
objectId = name;
|
|
440
435
|
status = {
|
|
441
436
|
name: name
|
|
442
437
|
};
|
|
443
|
-
_context4.prev =
|
|
444
|
-
_context4.next =
|
|
438
|
+
_context4.prev = 3;
|
|
439
|
+
_context4.next = 6;
|
|
445
440
|
return this.ContentObjectLibraryId({
|
|
446
|
-
objectId:
|
|
441
|
+
objectId: objectId
|
|
447
442
|
});
|
|
448
|
-
case
|
|
443
|
+
case 6:
|
|
449
444
|
libraryId = _context4.sent;
|
|
450
445
|
status.library_id = libraryId;
|
|
451
|
-
status.object_id =
|
|
452
|
-
_context4.next =
|
|
446
|
+
status.object_id = objectId;
|
|
447
|
+
_context4.next = 11;
|
|
453
448
|
return this.ContentObjectMetadata({
|
|
454
449
|
libraryId: libraryId,
|
|
455
|
-
objectId:
|
|
450
|
+
objectId: objectId,
|
|
456
451
|
select: ["live_recording_config", "live_recording"]
|
|
457
452
|
});
|
|
458
|
-
case
|
|
453
|
+
case 11:
|
|
459
454
|
mainMeta = _context4.sent;
|
|
460
455
|
status.reference_url = mainMeta.live_recording_config.reference_url;
|
|
461
456
|
if (!(mainMeta.live_recording_config == undefined || mainMeta.live_recording_config.url == undefined)) {
|
|
462
|
-
_context4.next =
|
|
457
|
+
_context4.next = 16;
|
|
463
458
|
break;
|
|
464
459
|
}
|
|
465
460
|
status.state = "unconfigured";
|
|
466
461
|
return _context4.abrupt("return", status);
|
|
467
|
-
case
|
|
462
|
+
case 16:
|
|
468
463
|
if (!(mainMeta.live_recording == undefined || mainMeta.live_recording.fabric_config == undefined || mainMeta.live_recording.playout_config == undefined || mainMeta.live_recording.recording_config == undefined)) {
|
|
469
|
-
_context4.next =
|
|
464
|
+
_context4.next = 19;
|
|
470
465
|
break;
|
|
471
466
|
}
|
|
472
467
|
status.state = "uninitialized";
|
|
473
468
|
return _context4.abrupt("return", status);
|
|
474
|
-
case
|
|
469
|
+
case 19:
|
|
475
470
|
fabURI = mainMeta.live_recording.fabric_config.ingress_node_api;
|
|
476
471
|
if (!(fabURI === undefined)) {
|
|
477
|
-
_context4.next =
|
|
472
|
+
_context4.next = 24;
|
|
478
473
|
break;
|
|
479
474
|
}
|
|
480
475
|
console.log("bad fabric config - missing ingress node API");
|
|
481
476
|
status.state = "uninitialized";
|
|
482
477
|
return _context4.abrupt("return", status);
|
|
483
|
-
case
|
|
478
|
+
case 24:
|
|
484
479
|
// Support both hostname and URL ingress_node_api
|
|
485
480
|
if (!fabURI.startsWith("http")) {
|
|
486
481
|
// Assume https
|
|
@@ -490,63 +485,70 @@ exports.StreamStatus = /*#__PURE__*/function () {
|
|
|
490
485
|
status.url = mainMeta.live_recording.recording_config.recording_params.origin_url;
|
|
491
486
|
edgeWriteToken = mainMeta.live_recording.fabric_config.edge_write_token;
|
|
492
487
|
if (edgeWriteToken) {
|
|
493
|
-
_context4.next =
|
|
488
|
+
_context4.next = 31;
|
|
494
489
|
break;
|
|
495
490
|
}
|
|
496
491
|
status.state = "inactive";
|
|
497
492
|
return _context4.abrupt("return", status);
|
|
498
|
-
case
|
|
493
|
+
case 31:
|
|
499
494
|
this.RecordWriteToken({
|
|
500
495
|
writeToken: edgeWriteToken,
|
|
501
496
|
fabricNodeUrl: fabURI
|
|
502
497
|
});
|
|
503
498
|
status.edge_write_token = edgeWriteToken;
|
|
504
499
|
status.stream_id = edgeWriteToken; // By convention the stream ID is its write token
|
|
505
|
-
_context4.next =
|
|
500
|
+
_context4.next = 36;
|
|
506
501
|
return this.ContentObjectMetadata({
|
|
507
502
|
libraryId: libraryId,
|
|
508
|
-
objectId:
|
|
503
|
+
objectId: objectId,
|
|
509
504
|
writeToken: edgeWriteToken,
|
|
510
505
|
select: ["live_recording"]
|
|
511
506
|
});
|
|
512
|
-
case
|
|
507
|
+
case 36:
|
|
513
508
|
edgeMeta = _context4.sent;
|
|
514
509
|
status.edge_meta_size = JSON.stringify(edgeMeta).length;
|
|
515
510
|
|
|
516
511
|
// If a stream has never been started return state 'inactive'
|
|
517
512
|
if (!(edgeMeta.live_recording === undefined || edgeMeta.live_recording.recordings === undefined || edgeMeta.live_recording.recordings.recording_sequence === undefined)) {
|
|
518
|
-
_context4.next =
|
|
513
|
+
_context4.next = 41;
|
|
519
514
|
break;
|
|
520
515
|
}
|
|
521
516
|
status.state = "stopped";
|
|
522
517
|
return _context4.abrupt("return", status);
|
|
523
|
-
case
|
|
518
|
+
case 41:
|
|
524
519
|
recordings = edgeMeta.live_recording.recordings;
|
|
525
520
|
status.recording_period_sequence = recordings.recording_sequence;
|
|
526
521
|
sequence = recordings.recording_sequence;
|
|
527
522
|
period = recordings.live_offering[sequence - 1];
|
|
528
523
|
tlro = period.live_recording_handle;
|
|
529
524
|
status.tlro = tlro;
|
|
530
|
-
|
|
525
|
+
videoLastFinalizationTimeEpochSec = -1;
|
|
526
|
+
videoFinalizedParts = 0;
|
|
527
|
+
sinceLastFinalize = -1;
|
|
528
|
+
if (period.finalized_parts_info && period.finalized_parts_info.video && period.finalized_parts_info.video.last_finalization_time) {
|
|
529
|
+
videoLastFinalizationTimeEpochSec = period.finalized_parts_info.video.last_finalization_time / 1000000;
|
|
530
|
+
videoFinalizedParts = period.finalized_parts_info.video.n_parts;
|
|
531
|
+
sinceLastFinalize = Math.floor(new Date().getTime() / 1000) - videoLastFinalizationTimeEpochSec;
|
|
532
|
+
}
|
|
531
533
|
recording_period = {
|
|
532
534
|
activation_time_epoch_sec: period.recording_start_time_epoch_sec,
|
|
533
535
|
start_time_epoch_sec: period.start_time_epoch_sec,
|
|
534
536
|
start_time_text: new Date(period.start_time_epoch_sec * 1000).toLocaleString(),
|
|
535
537
|
end_time_epoch_sec: period.end_time_epoch_sec,
|
|
536
538
|
end_time_text: period.end_time_epoch_sec === 0 ? null : new Date(period.end_time_epoch_sec * 1000).toLocaleString(),
|
|
537
|
-
video_parts:
|
|
538
|
-
video_last_part_finalized_epoch_sec:
|
|
539
|
+
video_parts: videoFinalizedParts,
|
|
540
|
+
video_last_part_finalized_epoch_sec: videoLastFinalizationTimeEpochSec,
|
|
539
541
|
video_since_last_finalize_sec: sinceLastFinalize
|
|
540
542
|
};
|
|
541
543
|
status.recording_period = recording_period;
|
|
542
|
-
_context4.next =
|
|
544
|
+
_context4.next = 55;
|
|
543
545
|
return this.FabricUrl({
|
|
544
546
|
libraryId: libraryId,
|
|
545
|
-
objectId:
|
|
547
|
+
objectId: objectId,
|
|
546
548
|
writeToken: edgeWriteToken,
|
|
547
549
|
call: "live/status/" + tlro
|
|
548
550
|
});
|
|
549
|
-
case
|
|
551
|
+
case 55:
|
|
550
552
|
status.lro_status_url = _context4.sent;
|
|
551
553
|
status.insertions = [];
|
|
552
554
|
if (edgeMeta.live_recording.playout_config.interleaves != undefined && edgeMeta.live_recording.playout_config.interleaves[sequence] != undefined) {
|
|
@@ -566,31 +568,31 @@ exports.StreamStatus = /*#__PURE__*/function () {
|
|
|
566
568
|
}
|
|
567
569
|
state = "stopped";
|
|
568
570
|
lroStatus = "";
|
|
569
|
-
_context4.prev =
|
|
571
|
+
_context4.prev = 61;
|
|
570
572
|
_context4.t0 = this.utils;
|
|
571
|
-
_context4.next =
|
|
573
|
+
_context4.next = 65;
|
|
572
574
|
return HttpClient.Fetch(status.lro_status_url);
|
|
573
|
-
case
|
|
575
|
+
case 65:
|
|
574
576
|
_context4.t1 = _context4.sent;
|
|
575
|
-
_context4.next =
|
|
577
|
+
_context4.next = 68;
|
|
576
578
|
return _context4.t0.ResponseToJson.call(_context4.t0, _context4.t1);
|
|
577
|
-
case
|
|
579
|
+
case 68:
|
|
578
580
|
lroStatus = _context4.sent;
|
|
579
581
|
state = lroStatus.state;
|
|
580
582
|
status.warnings = lroStatus.custom && lroStatus.custom.warnings;
|
|
581
583
|
status.quality = lroStatus.custom && lroStatus.custom.quality;
|
|
582
|
-
_context4.next =
|
|
584
|
+
_context4.next = 80;
|
|
583
585
|
break;
|
|
584
|
-
case
|
|
585
|
-
_context4.prev =
|
|
586
|
-
_context4.t2 = _context4["catch"](
|
|
586
|
+
case 74:
|
|
587
|
+
_context4.prev = 74;
|
|
588
|
+
_context4.t2 = _context4["catch"](61);
|
|
587
589
|
console.log("LRO Status (failed): ", _context4.t2.response.statusCode);
|
|
588
590
|
status.state = "stopped";
|
|
589
591
|
status.error = _context4.t2.response;
|
|
590
592
|
return _context4.abrupt("return", status);
|
|
591
|
-
case
|
|
593
|
+
case 80:
|
|
592
594
|
// Convert LRO 'state' to desired 'state'
|
|
593
|
-
if (state === "running" &&
|
|
595
|
+
if (state === "running" && videoLastFinalizationTimeEpochSec <= 0) {
|
|
594
596
|
state = "starting";
|
|
595
597
|
} else if (state === "running" && sinceLastFinalize > 32.9) {
|
|
596
598
|
state = "stalled";
|
|
@@ -599,44 +601,43 @@ exports.StreamStatus = /*#__PURE__*/function () {
|
|
|
599
601
|
}
|
|
600
602
|
status.state = state;
|
|
601
603
|
if (!((state === "running" || state === "stalled" || state === "starting") && stopLro)) {
|
|
602
|
-
_context4.next =
|
|
604
|
+
_context4.next = 101;
|
|
603
605
|
break;
|
|
604
606
|
}
|
|
605
|
-
_context4.next =
|
|
607
|
+
_context4.next = 85;
|
|
606
608
|
return this.FabricUrl({
|
|
607
609
|
libraryId: libraryId,
|
|
608
|
-
objectId:
|
|
610
|
+
objectId: objectId,
|
|
609
611
|
writeToken: edgeWriteToken,
|
|
610
612
|
call: "live/stop/" + tlro
|
|
611
613
|
});
|
|
612
|
-
case
|
|
614
|
+
case 85:
|
|
613
615
|
lroStopUrl = _context4.sent;
|
|
614
|
-
_context4.prev =
|
|
616
|
+
_context4.prev = 86;
|
|
615
617
|
_context4.t3 = this.utils;
|
|
616
|
-
_context4.next =
|
|
618
|
+
_context4.next = 90;
|
|
617
619
|
return HttpClient.Fetch(lroStopUrl);
|
|
618
|
-
case
|
|
620
|
+
case 90:
|
|
619
621
|
_context4.t4 = _context4.sent;
|
|
620
|
-
_context4.next =
|
|
622
|
+
_context4.next = 93;
|
|
621
623
|
return _context4.t3.ResponseToJson.call(_context4.t3, _context4.t4);
|
|
622
|
-
case
|
|
624
|
+
case 93:
|
|
623
625
|
console.log("LRO Stop: ", lroStatus.body);
|
|
624
|
-
_context4.next =
|
|
626
|
+
_context4.next = 99;
|
|
625
627
|
break;
|
|
626
|
-
case
|
|
627
|
-
_context4.prev =
|
|
628
|
-
_context4.t5 = _context4["catch"](
|
|
628
|
+
case 96:
|
|
629
|
+
_context4.prev = 96;
|
|
630
|
+
_context4.t5 = _context4["catch"](86);
|
|
629
631
|
console.log("LRO Stop (failed): ", _context4.t5.response.statusCode);
|
|
630
|
-
case
|
|
632
|
+
case 99:
|
|
631
633
|
state = "stopped";
|
|
632
634
|
status.state = state;
|
|
633
|
-
case
|
|
635
|
+
case 101:
|
|
634
636
|
if (!(state === "running")) {
|
|
635
637
|
_context4.next = 132;
|
|
636
638
|
break;
|
|
637
639
|
}
|
|
638
640
|
playout_urls = {};
|
|
639
|
-
objectId = conf.objectId;
|
|
640
641
|
_context4.next = 105;
|
|
641
642
|
return this.PlayoutOptions({
|
|
642
643
|
objectId: objectId,
|
|
@@ -704,7 +705,7 @@ exports.StreamStatus = /*#__PURE__*/function () {
|
|
|
704
705
|
if (networkInfo.name.includes("demo")) {
|
|
705
706
|
embed_net = "demo";
|
|
706
707
|
}
|
|
707
|
-
embed_url = "https://embed.v3.contentfabric.io/?net=".concat(embed_net, "&p&ct=h&oid=").concat(
|
|
708
|
+
embed_url = "https://embed.v3.contentfabric.io/?net=".concat(embed_net, "&p&ct=h&oid=").concat(objectId, "&mt=lv&ath=").concat(token);
|
|
708
709
|
playout_urls.embed_url = embed_url;
|
|
709
710
|
status.playout_urls = playout_urls;
|
|
710
711
|
case 132:
|
|
@@ -712,7 +713,7 @@ exports.StreamStatus = /*#__PURE__*/function () {
|
|
|
712
713
|
break;
|
|
713
714
|
case 134:
|
|
714
715
|
_context4.prev = 134;
|
|
715
|
-
_context4.t6 = _context4["catch"](
|
|
716
|
+
_context4.t6 = _context4["catch"](3);
|
|
716
717
|
console.error(_context4.t6);
|
|
717
718
|
case 137:
|
|
718
719
|
return _context4.abrupt("return", status);
|
|
@@ -720,7 +721,7 @@ exports.StreamStatus = /*#__PURE__*/function () {
|
|
|
720
721
|
case "end":
|
|
721
722
|
return _context4.stop();
|
|
722
723
|
}
|
|
723
|
-
}, _callee4, this, [[
|
|
724
|
+
}, _callee4, this, [[3, 134], [61, 74], [86, 96]]);
|
|
724
725
|
}));
|
|
725
726
|
return function (_x4) {
|
|
726
727
|
return _ref8.apply(this, arguments);
|
|
@@ -751,7 +752,7 @@ exports.StreamCreate = /*#__PURE__*/function () {
|
|
|
751
752
|
});
|
|
752
753
|
case 3:
|
|
753
754
|
status = _context5.sent;
|
|
754
|
-
if (!(status.state !== "inactive" && status.state !== "terminated" && status.state !== "stopped")) {
|
|
755
|
+
if (!(status.state != "uninitialized" && status.state !== "inactive" && status.state !== "terminated" && status.state !== "stopped")) {
|
|
755
756
|
_context5.next = 6;
|
|
756
757
|
break;
|
|
757
758
|
}
|
|
@@ -1030,32 +1031,26 @@ exports.StreamStartOrStopOrReset = /*#__PURE__*/function () {
|
|
|
1030
1031
|
*/
|
|
1031
1032
|
exports.StreamStopSession = /*#__PURE__*/function () {
|
|
1032
1033
|
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref13) {
|
|
1033
|
-
var name,
|
|
1034
|
+
var name, objectId, libraryId, mainMeta, fabURI, metaEdgeWriteToken, streamMetadata, status, _yield$this$EditConte, writeToken, newState, stopTime, finalizeMetadata, fin;
|
|
1034
1035
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
1035
1036
|
while (1) switch (_context7.prev = _context7.next) {
|
|
1036
1037
|
case 0:
|
|
1037
1038
|
name = _ref13.name;
|
|
1038
1039
|
_context7.prev = 1;
|
|
1039
1040
|
this.Log("Terminating stream session for: ".concat(name));
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
name: name
|
|
1043
|
-
});
|
|
1044
|
-
case 5:
|
|
1045
|
-
conf = _context7.sent;
|
|
1046
|
-
objectId = conf.objectId;
|
|
1047
|
-
_context7.next = 9;
|
|
1041
|
+
objectId = name;
|
|
1042
|
+
_context7.next = 6;
|
|
1048
1043
|
return this.ContentObjectLibraryId({
|
|
1049
1044
|
objectId: objectId
|
|
1050
1045
|
});
|
|
1051
|
-
case
|
|
1046
|
+
case 6:
|
|
1052
1047
|
libraryId = _context7.sent;
|
|
1053
|
-
_context7.next =
|
|
1048
|
+
_context7.next = 9;
|
|
1054
1049
|
return this.ContentObjectMetadata({
|
|
1055
1050
|
libraryId: libraryId,
|
|
1056
1051
|
objectId: objectId
|
|
1057
1052
|
});
|
|
1058
|
-
case
|
|
1053
|
+
case 9:
|
|
1059
1054
|
mainMeta = _context7.sent;
|
|
1060
1055
|
fabURI = mainMeta.live_recording.fabric_config.ingress_node_api; // Support both hostname and URL ingress_node_api
|
|
1061
1056
|
if (!fabURI.startsWith("http")) {
|
|
@@ -1067,57 +1062,57 @@ exports.StreamStopSession = /*#__PURE__*/function () {
|
|
|
1067
1062
|
});
|
|
1068
1063
|
metaEdgeWriteToken = mainMeta.live_recording.fabric_config.edge_write_token;
|
|
1069
1064
|
if (metaEdgeWriteToken) {
|
|
1070
|
-
_context7.next =
|
|
1065
|
+
_context7.next = 16;
|
|
1071
1066
|
break;
|
|
1072
1067
|
}
|
|
1073
1068
|
return _context7.abrupt("return", {
|
|
1074
1069
|
state: "inactive",
|
|
1075
1070
|
error: "The stream is not active"
|
|
1076
1071
|
});
|
|
1077
|
-
case
|
|
1078
|
-
_context7.prev =
|
|
1079
|
-
_context7.next =
|
|
1072
|
+
case 16:
|
|
1073
|
+
_context7.prev = 16;
|
|
1074
|
+
_context7.next = 19;
|
|
1080
1075
|
return this.ContentObjectMetadata({
|
|
1081
1076
|
libraryId: libraryId,
|
|
1082
1077
|
objectId: objectId,
|
|
1083
1078
|
writeToken: metaEdgeWriteToken
|
|
1084
1079
|
});
|
|
1085
|
-
case
|
|
1080
|
+
case 19:
|
|
1086
1081
|
streamMetadata = _context7.sent;
|
|
1087
|
-
_context7.next =
|
|
1082
|
+
_context7.next = 22;
|
|
1088
1083
|
return this.StreamStatus({
|
|
1089
1084
|
name: name
|
|
1090
1085
|
});
|
|
1091
|
-
case
|
|
1086
|
+
case 22:
|
|
1092
1087
|
status = _context7.sent;
|
|
1093
1088
|
if (!(status.state !== "stopped")) {
|
|
1094
|
-
_context7.next =
|
|
1089
|
+
_context7.next = 25;
|
|
1095
1090
|
break;
|
|
1096
1091
|
}
|
|
1097
1092
|
return _context7.abrupt("return", {
|
|
1098
1093
|
state: status.state,
|
|
1099
1094
|
error: "The stream must be stopped before terminating"
|
|
1100
1095
|
});
|
|
1101
|
-
case
|
|
1102
|
-
_context7.next =
|
|
1096
|
+
case 25:
|
|
1097
|
+
_context7.next = 27;
|
|
1103
1098
|
return this.DeleteWriteToken({
|
|
1104
1099
|
libraryId: libraryId,
|
|
1105
1100
|
writeToken: metaEdgeWriteToken
|
|
1106
1101
|
});
|
|
1107
|
-
case
|
|
1108
|
-
_context7.next =
|
|
1102
|
+
case 27:
|
|
1103
|
+
_context7.next = 32;
|
|
1109
1104
|
break;
|
|
1110
|
-
case
|
|
1111
|
-
_context7.prev =
|
|
1112
|
-
_context7.t0 = _context7["catch"](
|
|
1105
|
+
case 29:
|
|
1106
|
+
_context7.prev = 29;
|
|
1107
|
+
_context7.t0 = _context7["catch"](16);
|
|
1113
1108
|
this.Log("Unable to retrieve metadata for edge write token");
|
|
1114
|
-
case
|
|
1115
|
-
_context7.next =
|
|
1109
|
+
case 32:
|
|
1110
|
+
_context7.next = 34;
|
|
1116
1111
|
return this.EditContentObject({
|
|
1117
1112
|
libraryId: libraryId,
|
|
1118
1113
|
objectId: objectId
|
|
1119
1114
|
});
|
|
1120
|
-
case
|
|
1115
|
+
case 34:
|
|
1121
1116
|
_yield$this$EditConte = _context7.sent;
|
|
1122
1117
|
writeToken = _yield$this$EditConte.writeToken;
|
|
1123
1118
|
// Set stop time and inactive state
|
|
@@ -1133,40 +1128,39 @@ exports.StreamStopSession = /*#__PURE__*/function () {
|
|
|
1133
1128
|
fabric_config: {
|
|
1134
1129
|
edge_write_token: ""
|
|
1135
1130
|
}
|
|
1136
|
-
}
|
|
1137
|
-
recording_stop_time: stopTime
|
|
1131
|
+
}
|
|
1138
1132
|
};
|
|
1139
|
-
_context7.next =
|
|
1133
|
+
_context7.next = 41;
|
|
1140
1134
|
return this.MergeMetadata({
|
|
1141
1135
|
libraryId: libraryId,
|
|
1142
1136
|
objectId: objectId,
|
|
1143
1137
|
writeToken: writeToken,
|
|
1144
1138
|
metadata: finalizeMetadata
|
|
1145
1139
|
});
|
|
1146
|
-
case
|
|
1147
|
-
_context7.next =
|
|
1140
|
+
case 41:
|
|
1141
|
+
_context7.next = 43;
|
|
1148
1142
|
return this.FinalizeContentObject({
|
|
1149
1143
|
libraryId: libraryId,
|
|
1150
1144
|
objectId: objectId,
|
|
1151
1145
|
writeToken: writeToken,
|
|
1152
1146
|
commitMessage: "Deactivate live stream - stop time ".concat(stopTime)
|
|
1153
1147
|
});
|
|
1154
|
-
case
|
|
1148
|
+
case 43:
|
|
1155
1149
|
fin = _context7.sent;
|
|
1156
1150
|
return _context7.abrupt("return", {
|
|
1157
1151
|
fin: fin,
|
|
1158
1152
|
name: name,
|
|
1159
1153
|
state: newState
|
|
1160
1154
|
});
|
|
1161
|
-
case
|
|
1162
|
-
_context7.prev =
|
|
1155
|
+
case 47:
|
|
1156
|
+
_context7.prev = 47;
|
|
1163
1157
|
_context7.t1 = _context7["catch"](1);
|
|
1164
1158
|
console.error(_context7.t1);
|
|
1165
|
-
case
|
|
1159
|
+
case 50:
|
|
1166
1160
|
case "end":
|
|
1167
1161
|
return _context7.stop();
|
|
1168
1162
|
}
|
|
1169
|
-
}, _callee7, this, [[1,
|
|
1163
|
+
}, _callee7, this, [[1, 47], [16, 29]]);
|
|
1170
1164
|
}));
|
|
1171
1165
|
return function (_x7) {
|
|
1172
1166
|
return _ref14.apply(this, arguments);
|
|
@@ -1188,26 +1182,26 @@ exports.StreamStopSession = /*#__PURE__*/function () {
|
|
|
1188
1182
|
*/
|
|
1189
1183
|
exports.StreamInitialize = /*#__PURE__*/function () {
|
|
1190
1184
|
var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref15) {
|
|
1191
|
-
var name, _ref15$drm, drm, format, typeAbrMaster, typeLiveStream, tenantContractId,
|
|
1185
|
+
var name, _ref15$drm, drm, format, typeAbrMaster, typeLiveStream, tenantContractId, _yield$this$ContentOb, live_stream, title, res;
|
|
1192
1186
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
1193
1187
|
while (1) switch (_context8.prev = _context8.next) {
|
|
1194
1188
|
case 0:
|
|
1195
1189
|
name = _ref15.name, _ref15$drm = _ref15.drm, drm = _ref15$drm === void 0 ? false : _ref15$drm, format = _ref15.format;
|
|
1196
1190
|
_context8.next = 3;
|
|
1197
|
-
return
|
|
1191
|
+
return this.userProfileClient.TenantContractId();
|
|
1198
1192
|
case 3:
|
|
1199
1193
|
tenantContractId = _context8.sent;
|
|
1200
1194
|
_context8.next = 6;
|
|
1201
|
-
return
|
|
1195
|
+
return this.ContentObjectMetadata({
|
|
1202
1196
|
libraryId: tenantContractId.replace("iten", "ilib"),
|
|
1203
1197
|
objectId: tenantContractId.replace("iten", "iq__"),
|
|
1204
1198
|
metadataSubtree: "public/content_types",
|
|
1205
1199
|
select: ["live_stream", "title"]
|
|
1206
1200
|
});
|
|
1207
1201
|
case 6:
|
|
1208
|
-
_yield$
|
|
1209
|
-
live_stream = _yield$
|
|
1210
|
-
title = _yield$
|
|
1202
|
+
_yield$this$ContentOb = _context8.sent;
|
|
1203
|
+
live_stream = _yield$this$ContentOb.live_stream;
|
|
1204
|
+
title = _yield$this$ContentOb.title;
|
|
1211
1205
|
if (live_stream) {
|
|
1212
1206
|
typeLiveStream = live_stream;
|
|
1213
1207
|
}
|
|
@@ -1244,7 +1238,7 @@ exports.StreamInitialize = /*#__PURE__*/function () {
|
|
|
1244
1238
|
}();
|
|
1245
1239
|
|
|
1246
1240
|
/**
|
|
1247
|
-
*
|
|
1241
|
+
* Create a dummy VoD offering and initialize DRM keys.
|
|
1248
1242
|
*
|
|
1249
1243
|
* @methodGroup Live Stream
|
|
1250
1244
|
* @namedParams
|
|
@@ -1271,7 +1265,7 @@ exports.StreamSetOfferingAndDRM = /*#__PURE__*/function () {
|
|
|
1271
1265
|
});
|
|
1272
1266
|
case 3:
|
|
1273
1267
|
status = _context9.sent;
|
|
1274
|
-
if (!(status.state != "inactive" && status.state != "stopped")) {
|
|
1268
|
+
if (!(status.state != "uninitialized" && status.state != "inactive" && status.state != "stopped")) {
|
|
1275
1269
|
_context9.next = 6;
|
|
1276
1270
|
break;
|
|
1277
1271
|
}
|
|
@@ -1432,7 +1426,7 @@ exports.StreamSetOfferingAndDRM = /*#__PURE__*/function () {
|
|
|
1432
1426
|
*/
|
|
1433
1427
|
exports.StreamInsertion = /*#__PURE__*/function () {
|
|
1434
1428
|
var _ref20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref19) {
|
|
1435
|
-
var name, insertionTime, _ref19$sinceStart, sinceStart, duration, targetHash, _ref19$remove, remove, offeringMeta, insertionInfo, audioAbrDuration, videoAbrDuration,
|
|
1429
|
+
var name, insertionTime, _ref19$sinceStart, sinceStart, duration, targetHash, _ref19$remove, remove, offeringMeta, insertionInfo, audioAbrDuration, videoAbrDuration, objectId, libraryId, mainMeta, fabURI, edgeWriteToken, edgeMeta, recordings, sequence, streamStartTime, period, playoutConfig, insertions, res, errs, currentTime, insertionDone, newInsertion, i;
|
|
1436
1430
|
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
1437
1431
|
while (1) switch (_context10.prev = _context10.next) {
|
|
1438
1432
|
case 0:
|
|
@@ -1481,25 +1475,19 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1481
1475
|
}
|
|
1482
1476
|
throw new Error("Bad duration - larger than insertion object duration", insertionInfo.duration_sec);
|
|
1483
1477
|
case 16:
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
name: name
|
|
1487
|
-
});
|
|
1488
|
-
case 18:
|
|
1489
|
-
conf = _context10.sent;
|
|
1490
|
-
_context10.next = 21;
|
|
1478
|
+
objectId = name;
|
|
1479
|
+
_context10.next = 19;
|
|
1491
1480
|
return this.ContentObjectLibraryId({
|
|
1492
|
-
objectId:
|
|
1481
|
+
objectId: objectId
|
|
1493
1482
|
});
|
|
1494
|
-
case
|
|
1483
|
+
case 19:
|
|
1495
1484
|
libraryId = _context10.sent;
|
|
1496
|
-
|
|
1497
|
-
_context10.next = 25;
|
|
1485
|
+
_context10.next = 22;
|
|
1498
1486
|
return this.ContentObjectMetadata({
|
|
1499
1487
|
libraryId: libraryId,
|
|
1500
|
-
objectId:
|
|
1488
|
+
objectId: objectId
|
|
1501
1489
|
});
|
|
1502
|
-
case
|
|
1490
|
+
case 22:
|
|
1503
1491
|
mainMeta = _context10.sent;
|
|
1504
1492
|
fabURI = mainMeta.live_recording.fabric_config.ingress_node_api; // Support both hostname and URL ingress_node_api
|
|
1505
1493
|
if (!fabURI.startsWith("http")) {
|
|
@@ -1510,13 +1498,13 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1510
1498
|
fabricURIs: [fabURI]
|
|
1511
1499
|
});
|
|
1512
1500
|
edgeWriteToken = mainMeta.live_recording.fabric_config.edge_write_token;
|
|
1513
|
-
_context10.next =
|
|
1501
|
+
_context10.next = 29;
|
|
1514
1502
|
return this.ContentObjectMetadata({
|
|
1515
1503
|
libraryId: libraryId,
|
|
1516
|
-
objectId:
|
|
1504
|
+
objectId: objectId,
|
|
1517
1505
|
writeToken: edgeWriteToken
|
|
1518
1506
|
});
|
|
1519
|
-
case
|
|
1507
|
+
case 29:
|
|
1520
1508
|
edgeMeta = _context10.sent;
|
|
1521
1509
|
// Find stream start time (from the most recent recording section)
|
|
1522
1510
|
recordings = edgeMeta.live_recording.recordings;
|
|
@@ -1535,15 +1523,15 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1535
1523
|
}
|
|
1536
1524
|
}
|
|
1537
1525
|
if (!(streamStartTime === 0)) {
|
|
1538
|
-
_context10.next =
|
|
1526
|
+
_context10.next = 37;
|
|
1539
1527
|
break;
|
|
1540
1528
|
}
|
|
1541
1529
|
if (!(sinceStart === false)) {
|
|
1542
|
-
_context10.next =
|
|
1530
|
+
_context10.next = 37;
|
|
1543
1531
|
break;
|
|
1544
1532
|
}
|
|
1545
1533
|
throw new Error("Stream not running - must use 'time since start'");
|
|
1546
|
-
case
|
|
1534
|
+
case 37:
|
|
1547
1535
|
// Find the current period playout configuration
|
|
1548
1536
|
if (edgeMeta.live_recording.playout_config.interleaves === undefined) {
|
|
1549
1537
|
edgeMeta.live_recording.playout_config.interleaves = {};
|
|
@@ -1570,9 +1558,9 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1570
1558
|
playout: "/qfab/" + targetHash + "/rep/playout" // TO FIX - should be a link
|
|
1571
1559
|
};
|
|
1572
1560
|
i = 0;
|
|
1573
|
-
case
|
|
1561
|
+
case 48:
|
|
1574
1562
|
if (!(i < insertions.length)) {
|
|
1575
|
-
_context10.next =
|
|
1563
|
+
_context10.next = 63;
|
|
1576
1564
|
break;
|
|
1577
1565
|
}
|
|
1578
1566
|
if (insertions[i].insertion_time <= currentTime) {
|
|
@@ -1580,21 +1568,21 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1580
1568
|
append(errs, "Bad insertion - time:", insertions[i].insertion_time);
|
|
1581
1569
|
}
|
|
1582
1570
|
if (!remove) {
|
|
1583
|
-
_context10.next =
|
|
1571
|
+
_context10.next = 56;
|
|
1584
1572
|
break;
|
|
1585
1573
|
}
|
|
1586
1574
|
if (!(insertions[i].insertion_time === insertionTime)) {
|
|
1587
|
-
_context10.next =
|
|
1575
|
+
_context10.next = 54;
|
|
1588
1576
|
break;
|
|
1589
1577
|
}
|
|
1590
1578
|
insertions.splice(i, 1);
|
|
1591
|
-
return _context10.abrupt("break",
|
|
1592
|
-
case
|
|
1593
|
-
_context10.next =
|
|
1579
|
+
return _context10.abrupt("break", 63);
|
|
1580
|
+
case 54:
|
|
1581
|
+
_context10.next = 60;
|
|
1594
1582
|
break;
|
|
1595
|
-
case
|
|
1583
|
+
case 56:
|
|
1596
1584
|
if (!(insertions[i].insertion_time > insertionTime)) {
|
|
1597
|
-
_context10.next =
|
|
1585
|
+
_context10.next = 60;
|
|
1598
1586
|
break;
|
|
1599
1587
|
}
|
|
1600
1588
|
if (i > 0) {
|
|
@@ -1603,12 +1591,12 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1603
1591
|
insertions = [newInsertion].concat(_toConsumableArray(insertions.splice(i)));
|
|
1604
1592
|
}
|
|
1605
1593
|
insertionDone = true;
|
|
1606
|
-
return _context10.abrupt("break",
|
|
1607
|
-
case
|
|
1594
|
+
return _context10.abrupt("break", 63);
|
|
1595
|
+
case 60:
|
|
1608
1596
|
i++;
|
|
1609
|
-
_context10.next =
|
|
1597
|
+
_context10.next = 48;
|
|
1610
1598
|
break;
|
|
1611
|
-
case
|
|
1599
|
+
case 63:
|
|
1612
1600
|
if (!remove && !insertionDone) {
|
|
1613
1601
|
// Add to the end of the insertions list
|
|
1614
1602
|
console.log("Add insertion at the end");
|
|
@@ -1617,7 +1605,7 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1617
1605
|
playoutConfig.interleaves[sequence] = insertions;
|
|
1618
1606
|
|
|
1619
1607
|
// Store the new insertions in the write token
|
|
1620
|
-
_context10.next =
|
|
1608
|
+
_context10.next = 67;
|
|
1621
1609
|
return this.ReplaceMetadata({
|
|
1622
1610
|
libraryId: libraryId,
|
|
1623
1611
|
objectId: objectId,
|
|
@@ -1625,11 +1613,11 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1625
1613
|
metadataSubtree: "/live_recording/playout_config",
|
|
1626
1614
|
metadata: edgeMeta.live_recording.playout_config
|
|
1627
1615
|
});
|
|
1628
|
-
case
|
|
1616
|
+
case 67:
|
|
1629
1617
|
res.errors = errs;
|
|
1630
1618
|
res.insertions = insertions;
|
|
1631
1619
|
return _context10.abrupt("return", res);
|
|
1632
|
-
case
|
|
1620
|
+
case 70:
|
|
1633
1621
|
case "end":
|
|
1634
1622
|
return _context10.stop();
|
|
1635
1623
|
}
|
|
@@ -1641,131 +1629,89 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1641
1629
|
}();
|
|
1642
1630
|
|
|
1643
1631
|
/**
|
|
1644
|
-
*
|
|
1632
|
+
* Configure the stream based on built-in logic and optional custom settings.
|
|
1645
1633
|
*
|
|
1646
|
-
*
|
|
1647
|
-
*
|
|
1648
|
-
*
|
|
1649
|
-
*
|
|
1650
|
-
*
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
name: name,
|
|
1665
|
-
objectId: name
|
|
1666
|
-
});
|
|
1667
|
-
case 3:
|
|
1668
|
-
_context11.prev = 3;
|
|
1669
|
-
streamsBuf = fs.readFileSync(path.resolve(__dirname, "../liveconf.json"));
|
|
1670
|
-
_context11.next = 11;
|
|
1671
|
-
break;
|
|
1672
|
-
case 7:
|
|
1673
|
-
_context11.prev = 7;
|
|
1674
|
-
_context11.t0 = _context11["catch"](3);
|
|
1675
|
-
console.log("Stream name must be a QID or a label in liveconf.json");
|
|
1676
|
-
return _context11.abrupt("return", {});
|
|
1677
|
-
case 11:
|
|
1678
|
-
streams = JSON.parse(streamsBuf);
|
|
1679
|
-
conf = streams[name];
|
|
1680
|
-
if (!(conf === null)) {
|
|
1681
|
-
_context11.next = 16;
|
|
1682
|
-
break;
|
|
1683
|
-
}
|
|
1684
|
-
console.log("Bad name: ", name);
|
|
1685
|
-
return _context11.abrupt("return", {});
|
|
1686
|
-
case 16:
|
|
1687
|
-
return _context11.abrupt("return", conf);
|
|
1688
|
-
case 17:
|
|
1689
|
-
case "end":
|
|
1690
|
-
return _context11.stop();
|
|
1691
|
-
}
|
|
1692
|
-
}, _callee11, null, [[3, 7]]);
|
|
1693
|
-
}));
|
|
1694
|
-
return function (_x11) {
|
|
1695
|
-
return _ref22.apply(this, arguments);
|
|
1696
|
-
};
|
|
1697
|
-
}();
|
|
1698
|
-
|
|
1699
|
-
/**
|
|
1700
|
-
* Configure the stream
|
|
1634
|
+
* Custom settings format:
|
|
1635
|
+
* {
|
|
1636
|
+
* "audio" {
|
|
1637
|
+
* "1" : { // This is the stream index
|
|
1638
|
+
* "tags" : "language: english",
|
|
1639
|
+
* "codec" : "aac",
|
|
1640
|
+
* "bitrate": 204000,
|
|
1641
|
+
* "record": true,
|
|
1642
|
+
* "recording_bitrate" : 192000,
|
|
1643
|
+
* "recording_channels" : 2,
|
|
1644
|
+
* "playout": bool
|
|
1645
|
+
* "playout_label": "English (Stereo)"
|
|
1646
|
+
* },
|
|
1647
|
+
* "3": {
|
|
1648
|
+
* ...
|
|
1649
|
+
* }
|
|
1650
|
+
* }
|
|
1651
|
+
* }
|
|
1701
1652
|
*
|
|
1702
1653
|
* @methodGroup Live Stream
|
|
1703
1654
|
* @namedParams
|
|
1704
1655
|
* @param {string} name - Object ID or name of the live stream object
|
|
1705
1656
|
* @param {Object=} customSettings - Additional options to customize configuration settings
|
|
1706
|
-
* -
|
|
1707
|
-
* - audioIndex
|
|
1708
|
-
* - partTtl
|
|
1709
|
-
* - channelLayout
|
|
1710
|
-
*
|
|
1657
|
+
* @param {Object=} probeMetadata - Metadata for the probe. If not specified, a new probe will be configured
|
|
1711
1658
|
* @return {Promise<Object>} - The status response for the stream
|
|
1712
1659
|
*
|
|
1713
1660
|
*/
|
|
1714
1661
|
exports.StreamConfig = /*#__PURE__*/function () {
|
|
1715
|
-
var
|
|
1716
|
-
var name,
|
|
1717
|
-
return _regeneratorRuntime.wrap(function
|
|
1718
|
-
while (1) switch (
|
|
1662
|
+
var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref21) {
|
|
1663
|
+
var name, _ref21$customSettings, customSettings, probeMetadata, objectId, status, libraryId, probe, mainMeta, userConfig, hostName, streamUrl, nodes, node, endpoint, controller, timeoutId, probeUrl, lc, liveRecordingConfig, e, writeToken;
|
|
1664
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
1665
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1719
1666
|
case 0:
|
|
1720
|
-
name =
|
|
1721
|
-
|
|
1722
|
-
return this.LoadConf({
|
|
1723
|
-
name: name
|
|
1724
|
-
});
|
|
1725
|
-
case 3:
|
|
1726
|
-
conf = _context12.sent;
|
|
1667
|
+
name = _ref21.name, _ref21$customSettings = _ref21.customSettings, customSettings = _ref21$customSettings === void 0 ? {} : _ref21$customSettings, probeMetadata = _ref21.probeMetadata;
|
|
1668
|
+
objectId = name;
|
|
1727
1669
|
status = {
|
|
1728
1670
|
name: name
|
|
1729
1671
|
};
|
|
1730
|
-
|
|
1672
|
+
_context11.next = 5;
|
|
1731
1673
|
return this.ContentObjectLibraryId({
|
|
1732
|
-
objectId:
|
|
1674
|
+
objectId: objectId
|
|
1733
1675
|
});
|
|
1734
|
-
case
|
|
1735
|
-
libraryId =
|
|
1676
|
+
case 5:
|
|
1677
|
+
libraryId = _context11.sent;
|
|
1736
1678
|
status.library_id = libraryId;
|
|
1737
|
-
status.object_id =
|
|
1738
|
-
|
|
1679
|
+
status.object_id = objectId;
|
|
1680
|
+
probe = probeMetadata;
|
|
1681
|
+
_context11.next = 11;
|
|
1739
1682
|
return this.ContentObjectMetadata({
|
|
1740
1683
|
libraryId: libraryId,
|
|
1741
|
-
objectId:
|
|
1684
|
+
objectId: objectId
|
|
1742
1685
|
});
|
|
1743
|
-
case
|
|
1744
|
-
mainMeta =
|
|
1686
|
+
case 11:
|
|
1687
|
+
mainMeta = _context11.sent;
|
|
1745
1688
|
userConfig = mainMeta.live_recording_config;
|
|
1746
1689
|
status.user_config = userConfig;
|
|
1747
|
-
console.log("userConfig", userConfig);
|
|
1748
1690
|
|
|
1749
1691
|
// Get node URI from user config
|
|
1750
1692
|
hostName = userConfig.url.replace("udp://", "").replace("rtmp://", "").replace("srt://", "").split(":")[0];
|
|
1751
1693
|
streamUrl = new URL(userConfig.url);
|
|
1752
1694
|
console.log("Retrieving nodes - matching", hostName);
|
|
1753
|
-
|
|
1695
|
+
_context11.next = 19;
|
|
1754
1696
|
return this.SpaceNodes({
|
|
1755
1697
|
matchEndpoint: hostName
|
|
1756
1698
|
});
|
|
1757
|
-
case
|
|
1758
|
-
nodes =
|
|
1699
|
+
case 19:
|
|
1700
|
+
nodes = _context11.sent;
|
|
1759
1701
|
if (!(nodes.length < 1)) {
|
|
1760
|
-
|
|
1702
|
+
_context11.next = 23;
|
|
1761
1703
|
break;
|
|
1762
1704
|
}
|
|
1763
1705
|
status.error = "No node matching stream URL " + streamUrl.href;
|
|
1764
|
-
return
|
|
1765
|
-
case
|
|
1706
|
+
return _context11.abrupt("return", status);
|
|
1707
|
+
case 23:
|
|
1766
1708
|
node = nodes[0];
|
|
1767
1709
|
status.node = node;
|
|
1768
1710
|
endpoint = node.endpoints[0];
|
|
1711
|
+
if (probe) {
|
|
1712
|
+
_context11.next = 55;
|
|
1713
|
+
break;
|
|
1714
|
+
}
|
|
1769
1715
|
this.SetNodes({
|
|
1770
1716
|
fabricURIs: [endpoint]
|
|
1771
1717
|
});
|
|
@@ -1776,17 +1722,17 @@ exports.StreamConfig = /*#__PURE__*/function () {
|
|
|
1776
1722
|
timeoutId = setTimeout(function () {
|
|
1777
1723
|
controller.abort();
|
|
1778
1724
|
}, 60 * 1000); // milliseconds
|
|
1779
|
-
|
|
1780
|
-
|
|
1725
|
+
_context11.prev = 31;
|
|
1726
|
+
_context11.next = 34;
|
|
1781
1727
|
return this.Rep({
|
|
1782
1728
|
libraryId: libraryId,
|
|
1783
|
-
objectId:
|
|
1729
|
+
objectId: objectId,
|
|
1784
1730
|
rep: "probe"
|
|
1785
1731
|
});
|
|
1786
|
-
case
|
|
1787
|
-
probeUrl =
|
|
1788
|
-
|
|
1789
|
-
|
|
1732
|
+
case 34:
|
|
1733
|
+
probeUrl = _context11.sent;
|
|
1734
|
+
_context11.t0 = this.utils;
|
|
1735
|
+
_context11.next = 38;
|
|
1790
1736
|
return HttpClient.Fetch(probeUrl, {
|
|
1791
1737
|
body: JSON.stringify({
|
|
1792
1738
|
"filename": streamUrl.href,
|
|
@@ -1795,83 +1741,85 @@ exports.StreamConfig = /*#__PURE__*/function () {
|
|
|
1795
1741
|
method: "POST",
|
|
1796
1742
|
signal: controller.signal
|
|
1797
1743
|
});
|
|
1798
|
-
case
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
return
|
|
1802
|
-
case
|
|
1803
|
-
probe =
|
|
1744
|
+
case 38:
|
|
1745
|
+
_context11.t1 = _context11.sent;
|
|
1746
|
+
_context11.next = 41;
|
|
1747
|
+
return _context11.t0.ResponseToJson.call(_context11.t0, _context11.t1);
|
|
1748
|
+
case 41:
|
|
1749
|
+
probe = _context11.sent;
|
|
1804
1750
|
if (probe) {
|
|
1805
1751
|
clearTimeout(timeoutId);
|
|
1806
1752
|
}
|
|
1807
1753
|
if (!probe.errors) {
|
|
1808
|
-
|
|
1754
|
+
_context11.next = 45;
|
|
1809
1755
|
break;
|
|
1810
1756
|
}
|
|
1811
1757
|
throw probe.errors[0];
|
|
1812
|
-
case
|
|
1813
|
-
|
|
1758
|
+
case 45:
|
|
1759
|
+
_context11.next = 54;
|
|
1814
1760
|
break;
|
|
1815
|
-
case
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
if (!(
|
|
1819
|
-
|
|
1761
|
+
case 47:
|
|
1762
|
+
_context11.prev = 47;
|
|
1763
|
+
_context11.t2 = _context11["catch"](31);
|
|
1764
|
+
if (!(_context11.t2.code === "ETIMEDOUT")) {
|
|
1765
|
+
_context11.next = 53;
|
|
1820
1766
|
break;
|
|
1821
1767
|
}
|
|
1822
1768
|
throw "Stream probe time out - make sure the stream source is available";
|
|
1769
|
+
case 53:
|
|
1770
|
+
throw _context11.t2;
|
|
1823
1771
|
case 54:
|
|
1824
|
-
throw _context12.t2;
|
|
1825
|
-
case 55:
|
|
1826
1772
|
probe.format.filename = streamUrl.href;
|
|
1827
|
-
|
|
1773
|
+
case 55:
|
|
1828
1774
|
// Create live recording config
|
|
1829
1775
|
lc = new LiveConf(probe, node.id, endpoint, false, false, true);
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
channelLayout: customSettings.channelLayout
|
|
1835
|
-
});
|
|
1836
|
-
liveRecordingConfig = JSON.parse(liveRecordingConfigStr);
|
|
1837
|
-
console.log("CONFIG", JSON.stringify(liveRecordingConfig.live_recording));
|
|
1838
|
-
|
|
1839
|
-
// Store live recording config into the stream object
|
|
1840
|
-
_context12.next = 62;
|
|
1776
|
+
liveRecordingConfig = lc.generateLiveConf({
|
|
1777
|
+
customSettings: customSettings
|
|
1778
|
+
}); // Store live recording config into the stream object
|
|
1779
|
+
_context11.next = 59;
|
|
1841
1780
|
return this.EditContentObject({
|
|
1842
1781
|
libraryId: libraryId,
|
|
1843
|
-
objectId:
|
|
1782
|
+
objectId: objectId
|
|
1844
1783
|
});
|
|
1845
|
-
case
|
|
1846
|
-
e =
|
|
1784
|
+
case 59:
|
|
1785
|
+
e = _context11.sent;
|
|
1847
1786
|
writeToken = e.write_token;
|
|
1848
|
-
|
|
1787
|
+
_context11.next = 63;
|
|
1849
1788
|
return this.ReplaceMetadata({
|
|
1850
1789
|
libraryId: libraryId,
|
|
1851
|
-
objectId:
|
|
1790
|
+
objectId: objectId,
|
|
1852
1791
|
writeToken: writeToken,
|
|
1853
1792
|
metadataSubtree: "live_recording",
|
|
1854
1793
|
metadata: liveRecordingConfig.live_recording
|
|
1855
1794
|
});
|
|
1856
|
-
case
|
|
1857
|
-
|
|
1795
|
+
case 63:
|
|
1796
|
+
_context11.next = 65;
|
|
1797
|
+
return this.ReplaceMetadata({
|
|
1798
|
+
libraryId: libraryId,
|
|
1799
|
+
objectId: objectId,
|
|
1800
|
+
writeToken: writeToken,
|
|
1801
|
+
metadataSubtree: "live_recording_config/probe_info",
|
|
1802
|
+
metadata: probe
|
|
1803
|
+
});
|
|
1804
|
+
case 65:
|
|
1805
|
+
_context11.next = 67;
|
|
1858
1806
|
return this.FinalizeContentObject({
|
|
1859
1807
|
libraryId: libraryId,
|
|
1860
|
-
objectId:
|
|
1808
|
+
objectId: objectId,
|
|
1861
1809
|
writeToken: writeToken,
|
|
1862
1810
|
commitMessage: "Apply live stream configuration"
|
|
1863
1811
|
});
|
|
1864
|
-
case
|
|
1865
|
-
status.fin =
|
|
1866
|
-
return
|
|
1867
|
-
case
|
|
1812
|
+
case 67:
|
|
1813
|
+
status.fin = _context11.sent;
|
|
1814
|
+
return _context11.abrupt("return", status);
|
|
1815
|
+
case 69:
|
|
1868
1816
|
case "end":
|
|
1869
|
-
return
|
|
1817
|
+
return _context11.stop();
|
|
1870
1818
|
}
|
|
1871
|
-
},
|
|
1819
|
+
}, _callee11, this, [[31, 47]]);
|
|
1872
1820
|
}));
|
|
1873
|
-
return function (
|
|
1874
|
-
return
|
|
1821
|
+
return function (_x11) {
|
|
1822
|
+
return _ref22.apply(this, arguments);
|
|
1875
1823
|
};
|
|
1876
1824
|
}();
|
|
1877
1825
|
|
|
@@ -1884,9 +1832,9 @@ exports.StreamConfig = /*#__PURE__*/function () {
|
|
|
1884
1832
|
*
|
|
1885
1833
|
* @return {Promise<Object>} - The list of stream URLs
|
|
1886
1834
|
*/
|
|
1887
|
-
exports.StreamListUrls = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1835
|
+
exports.StreamListUrls = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
|
|
1888
1836
|
var _this2 = this;
|
|
1889
|
-
var
|
|
1837
|
+
var _ref24,
|
|
1890
1838
|
siteId,
|
|
1891
1839
|
STATUS_MAP,
|
|
1892
1840
|
tenantContractId,
|
|
@@ -1894,12 +1842,12 @@ exports.StreamListUrls = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regenerat
|
|
|
1894
1842
|
activeUrlMap,
|
|
1895
1843
|
streamUrlStatus,
|
|
1896
1844
|
streamUrls,
|
|
1897
|
-
|
|
1898
|
-
return _regeneratorRuntime.wrap(function
|
|
1899
|
-
while (1) switch (
|
|
1845
|
+
_args13 = arguments;
|
|
1846
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
1847
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1900
1848
|
case 0:
|
|
1901
|
-
|
|
1902
|
-
|
|
1849
|
+
_ref24 = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {}, siteId = _ref24.siteId;
|
|
1850
|
+
_context13.prev = 1;
|
|
1903
1851
|
STATUS_MAP = {
|
|
1904
1852
|
UNCONFIGURED: "unconfigured",
|
|
1905
1853
|
UNINITIALIZED: "uninitialized",
|
|
@@ -1910,77 +1858,78 @@ exports.StreamListUrls = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regenerat
|
|
|
1910
1858
|
STALLED: "stalled"
|
|
1911
1859
|
};
|
|
1912
1860
|
if (siteId) {
|
|
1913
|
-
|
|
1861
|
+
_context13.next = 12;
|
|
1914
1862
|
break;
|
|
1915
1863
|
}
|
|
1916
|
-
|
|
1864
|
+
_context13.next = 6;
|
|
1917
1865
|
return this.userProfileClient.TenantContractId();
|
|
1918
1866
|
case 6:
|
|
1919
|
-
tenantContractId =
|
|
1867
|
+
tenantContractId = _context13.sent;
|
|
1920
1868
|
if (tenantContractId) {
|
|
1921
|
-
|
|
1869
|
+
_context13.next = 9;
|
|
1922
1870
|
break;
|
|
1923
1871
|
}
|
|
1924
1872
|
throw Error("No tenant contract ID configured");
|
|
1925
1873
|
case 9:
|
|
1926
|
-
|
|
1874
|
+
_context13.next = 11;
|
|
1927
1875
|
return this.ContentObjectMetadata({
|
|
1928
1876
|
libraryId: tenantContractId.replace("iten", "ilib"),
|
|
1929
1877
|
objectId: tenantContractId.replace("iten", "iq__"),
|
|
1930
1878
|
metadataSubtree: "public/sites/live_streams"
|
|
1931
1879
|
});
|
|
1932
1880
|
case 11:
|
|
1933
|
-
siteId =
|
|
1881
|
+
siteId = _context13.sent;
|
|
1934
1882
|
case 12:
|
|
1935
|
-
|
|
1936
|
-
|
|
1883
|
+
_context13.t0 = this;
|
|
1884
|
+
_context13.next = 15;
|
|
1937
1885
|
return this.ContentObjectLibraryId({
|
|
1938
1886
|
objectId: siteId
|
|
1939
1887
|
});
|
|
1940
1888
|
case 15:
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
libraryId:
|
|
1945
|
-
objectId:
|
|
1889
|
+
_context13.t1 = _context13.sent;
|
|
1890
|
+
_context13.t2 = siteId;
|
|
1891
|
+
_context13.t3 = {
|
|
1892
|
+
libraryId: _context13.t1,
|
|
1893
|
+
objectId: _context13.t2,
|
|
1946
1894
|
metadataSubtree: "public/asset_metadata/live_streams",
|
|
1947
1895
|
resolveLinks: true,
|
|
1948
|
-
resolveIgnoreErrors: true
|
|
1896
|
+
resolveIgnoreErrors: true,
|
|
1897
|
+
resolveIncludeSource: true
|
|
1949
1898
|
};
|
|
1950
|
-
|
|
1951
|
-
return
|
|
1899
|
+
_context13.next = 20;
|
|
1900
|
+
return _context13.t0.ContentObjectMetadata.call(_context13.t0, _context13.t3);
|
|
1952
1901
|
case 20:
|
|
1953
|
-
streamMetadata =
|
|
1902
|
+
streamMetadata = _context13.sent;
|
|
1954
1903
|
activeUrlMap = {};
|
|
1955
|
-
|
|
1904
|
+
_context13.next = 24;
|
|
1956
1905
|
return this.utils.LimitedMap(10, Object.keys(streamMetadata || {}), /*#__PURE__*/function () {
|
|
1957
|
-
var
|
|
1906
|
+
var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(slug) {
|
|
1958
1907
|
var stream, versionHash, objectId, libraryId, status, streamMeta, url, isActive;
|
|
1959
|
-
return _regeneratorRuntime.wrap(function
|
|
1960
|
-
while (1) switch (
|
|
1908
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
1909
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1961
1910
|
case 0:
|
|
1962
1911
|
stream = streamMetadata[slug];
|
|
1963
|
-
if (stream && stream
|
|
1964
|
-
versionHash = stream
|
|
1912
|
+
if (stream && stream["."] && stream["."].source) {
|
|
1913
|
+
versionHash = stream["."].source;
|
|
1965
1914
|
}
|
|
1966
1915
|
if (!versionHash) {
|
|
1967
|
-
|
|
1916
|
+
_context12.next = 16;
|
|
1968
1917
|
break;
|
|
1969
1918
|
}
|
|
1970
1919
|
objectId = _this2.utils.DecodeVersionHash(versionHash).objectId;
|
|
1971
|
-
|
|
1920
|
+
_context12.next = 6;
|
|
1972
1921
|
return _this2.ContentObjectLibraryId({
|
|
1973
1922
|
objectId: objectId
|
|
1974
1923
|
});
|
|
1975
1924
|
case 6:
|
|
1976
|
-
libraryId =
|
|
1977
|
-
|
|
1925
|
+
libraryId = _context12.sent;
|
|
1926
|
+
_context12.next = 9;
|
|
1978
1927
|
return _this2.StreamStatus({
|
|
1979
1928
|
name: objectId
|
|
1980
1929
|
});
|
|
1981
1930
|
case 9:
|
|
1982
|
-
status =
|
|
1983
|
-
|
|
1931
|
+
status = _context12.sent;
|
|
1932
|
+
_context12.next = 12;
|
|
1984
1933
|
return _this2.ContentObjectMetadata({
|
|
1985
1934
|
objectId: objectId,
|
|
1986
1935
|
libraryId: libraryId,
|
|
@@ -1989,7 +1938,7 @@ exports.StreamListUrls = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regenerat
|
|
|
1989
1938
|
"live_recording_config/url"]
|
|
1990
1939
|
});
|
|
1991
1940
|
case 12:
|
|
1992
|
-
streamMeta =
|
|
1941
|
+
streamMeta = _context12.sent;
|
|
1993
1942
|
url = streamMeta.live_recording_config.reference_url || streamMeta.live_recording_config.url;
|
|
1994
1943
|
isActive = [STATUS_MAP.STARTING, STATUS_MAP.RUNNING, STATUS_MAP.STALLED, STATUS_MAP.STOPPED].includes(status.state);
|
|
1995
1944
|
if (url && isActive) {
|
|
@@ -1997,37 +1946,37 @@ exports.StreamListUrls = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regenerat
|
|
|
1997
1946
|
}
|
|
1998
1947
|
case 16:
|
|
1999
1948
|
case "end":
|
|
2000
|
-
return
|
|
1949
|
+
return _context12.stop();
|
|
2001
1950
|
}
|
|
2002
|
-
},
|
|
1951
|
+
}, _callee12);
|
|
2003
1952
|
}));
|
|
2004
|
-
return function (
|
|
2005
|
-
return
|
|
1953
|
+
return function (_x12) {
|
|
1954
|
+
return _ref25.apply(this, arguments);
|
|
2006
1955
|
};
|
|
2007
1956
|
}());
|
|
2008
1957
|
case 24:
|
|
2009
1958
|
streamUrlStatus = {};
|
|
2010
|
-
|
|
2011
|
-
|
|
1959
|
+
_context13.t4 = this;
|
|
1960
|
+
_context13.next = 28;
|
|
2012
1961
|
return this.ContentObjectLibraryId({
|
|
2013
1962
|
objectId: siteId
|
|
2014
1963
|
});
|
|
2015
1964
|
case 28:
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
libraryId:
|
|
2020
|
-
objectId:
|
|
1965
|
+
_context13.t5 = _context13.sent;
|
|
1966
|
+
_context13.t6 = siteId;
|
|
1967
|
+
_context13.t7 = {
|
|
1968
|
+
libraryId: _context13.t5,
|
|
1969
|
+
objectId: _context13.t6,
|
|
2021
1970
|
metadataSubtree: "/live_stream_urls",
|
|
2022
1971
|
resolveLinks: true,
|
|
2023
1972
|
resolveIgnoreErrors: true
|
|
2024
1973
|
};
|
|
2025
|
-
|
|
2026
|
-
return
|
|
1974
|
+
_context13.next = 33;
|
|
1975
|
+
return _context13.t4.ContentObjectMetadata.call(_context13.t4, _context13.t7);
|
|
2027
1976
|
case 33:
|
|
2028
|
-
streamUrls =
|
|
1977
|
+
streamUrls = _context13.sent;
|
|
2029
1978
|
if (streamUrls) {
|
|
2030
|
-
|
|
1979
|
+
_context13.next = 36;
|
|
2031
1980
|
break;
|
|
2032
1981
|
}
|
|
2033
1982
|
throw Error("No pre-allocated URLs configured");
|
|
@@ -2040,16 +1989,16 @@ exports.StreamListUrls = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regenerat
|
|
|
2040
1989
|
};
|
|
2041
1990
|
});
|
|
2042
1991
|
});
|
|
2043
|
-
return
|
|
1992
|
+
return _context13.abrupt("return", streamUrlStatus);
|
|
2044
1993
|
case 40:
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
console.error(
|
|
1994
|
+
_context13.prev = 40;
|
|
1995
|
+
_context13.t8 = _context13["catch"](1);
|
|
1996
|
+
console.error(_context13.t8);
|
|
2048
1997
|
case 43:
|
|
2049
1998
|
case "end":
|
|
2050
|
-
return
|
|
1999
|
+
return _context13.stop();
|
|
2051
2000
|
}
|
|
2052
|
-
},
|
|
2001
|
+
}, _callee13, this, [[1, 40]]);
|
|
2053
2002
|
}));
|
|
2054
2003
|
|
|
2055
2004
|
/**
|
|
@@ -2108,94 +2057,89 @@ exports.StreamListUrls = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regenerat
|
|
|
2108
2057
|
*/
|
|
2109
2058
|
|
|
2110
2059
|
exports.StreamCopyToVod = /*#__PURE__*/function () {
|
|
2111
|
-
var
|
|
2112
|
-
var name, targetObjectId, eventId,
|
|
2113
|
-
return _regeneratorRuntime.wrap(function
|
|
2114
|
-
while (1) switch (
|
|
2060
|
+
var _ref27 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref26) {
|
|
2061
|
+
var name, targetObjectId, eventId, _ref26$streams, streams, _ref26$finalize, finalize, _ref26$recordingPerio, recordingPeriod, _ref26$startTime, startTime, _ref26$endTime, endTime, objectId, abrProfile, status, libraryId, targetLibraryId, kmsAddress, kmsCapId, kmsCap, liveHash, event, _yield$this$EditConte2, writeToken, abrMezInitBody, finalizeResponse;
|
|
2062
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
2063
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
2115
2064
|
case 0:
|
|
2116
|
-
name =
|
|
2117
|
-
|
|
2118
|
-
return this.LoadConf({
|
|
2119
|
-
name: name
|
|
2120
|
-
});
|
|
2121
|
-
case 3:
|
|
2122
|
-
conf = _context15.sent;
|
|
2065
|
+
name = _ref26.name, targetObjectId = _ref26.targetObjectId, eventId = _ref26.eventId, _ref26$streams = _ref26.streams, streams = _ref26$streams === void 0 ? null : _ref26$streams, _ref26$finalize = _ref26.finalize, finalize = _ref26$finalize === void 0 ? true : _ref26$finalize, _ref26$recordingPerio = _ref26.recordingPeriod, recordingPeriod = _ref26$recordingPerio === void 0 ? -1 : _ref26$recordingPerio, _ref26$startTime = _ref26.startTime, startTime = _ref26$startTime === void 0 ? "" : _ref26$startTime, _ref26$endTime = _ref26.endTime, endTime = _ref26$endTime === void 0 ? "" : _ref26$endTime;
|
|
2066
|
+
objectId = name;
|
|
2123
2067
|
abrProfile = require("../abr_profiles/abr_profile_live_to_vod.js");
|
|
2124
|
-
|
|
2068
|
+
_context14.next = 5;
|
|
2125
2069
|
return this.StreamStatus({
|
|
2126
2070
|
name: name
|
|
2127
2071
|
});
|
|
2128
|
-
case
|
|
2129
|
-
status =
|
|
2072
|
+
case 5:
|
|
2073
|
+
status = _context14.sent;
|
|
2130
2074
|
libraryId = status.library_id;
|
|
2131
2075
|
this.Log("Copying stream ".concat(name, " to target ").concat(targetObjectId));
|
|
2132
2076
|
ValidateObject(targetObjectId);
|
|
2133
|
-
|
|
2077
|
+
_context14.next = 11;
|
|
2134
2078
|
return this.ContentObjectLibraryId({
|
|
2135
2079
|
objectId: targetObjectId
|
|
2136
2080
|
});
|
|
2137
|
-
case
|
|
2138
|
-
targetLibraryId =
|
|
2139
|
-
|
|
2081
|
+
case 11:
|
|
2082
|
+
targetLibraryId = _context14.sent;
|
|
2083
|
+
_context14.next = 14;
|
|
2140
2084
|
return this.authClient.KMSAddress({
|
|
2141
2085
|
objectId: targetObjectId
|
|
2142
2086
|
});
|
|
2143
|
-
case
|
|
2144
|
-
kmsAddress =
|
|
2087
|
+
case 14:
|
|
2088
|
+
kmsAddress = _context14.sent;
|
|
2145
2089
|
kmsCapId = "eluv.caps.ikms".concat(this.utils.AddressToHash(kmsAddress));
|
|
2146
|
-
|
|
2090
|
+
_context14.next = 18;
|
|
2147
2091
|
return this.ContentObjectMetadata({
|
|
2148
2092
|
libraryId: targetLibraryId,
|
|
2149
2093
|
objectId: targetObjectId,
|
|
2150
2094
|
metadataSubtree: kmsCapId
|
|
2151
2095
|
});
|
|
2152
|
-
case
|
|
2153
|
-
kmsCap =
|
|
2096
|
+
case 18:
|
|
2097
|
+
kmsCap = _context14.sent;
|
|
2154
2098
|
if (kmsCap) {
|
|
2155
|
-
|
|
2099
|
+
_context14.next = 21;
|
|
2156
2100
|
break;
|
|
2157
2101
|
}
|
|
2158
2102
|
throw Error("No content encryption key set for object ".concat(targetObjectId));
|
|
2159
|
-
case
|
|
2160
|
-
|
|
2161
|
-
status.live_object_id =
|
|
2162
|
-
|
|
2103
|
+
case 21:
|
|
2104
|
+
_context14.prev = 21;
|
|
2105
|
+
status.live_object_id = objectId;
|
|
2106
|
+
_context14.next = 25;
|
|
2163
2107
|
return this.LatestVersionHash({
|
|
2164
|
-
objectId:
|
|
2108
|
+
objectId: objectId,
|
|
2165
2109
|
libraryId: libraryId
|
|
2166
2110
|
});
|
|
2167
|
-
case
|
|
2168
|
-
liveHash =
|
|
2111
|
+
case 25:
|
|
2112
|
+
liveHash = _context14.sent;
|
|
2169
2113
|
status.live_hash = liveHash;
|
|
2170
2114
|
if (!eventId) {
|
|
2171
|
-
|
|
2115
|
+
_context14.next = 32;
|
|
2172
2116
|
break;
|
|
2173
2117
|
}
|
|
2174
|
-
|
|
2118
|
+
_context14.next = 30;
|
|
2175
2119
|
return this.CueInfo({
|
|
2176
2120
|
eventId: eventId,
|
|
2177
2121
|
status: status
|
|
2178
2122
|
});
|
|
2179
|
-
case
|
|
2180
|
-
event =
|
|
2123
|
+
case 30:
|
|
2124
|
+
event = _context14.sent;
|
|
2181
2125
|
if (event.eventStart && event.eventEnd) {
|
|
2182
2126
|
startTime = event.eventStart;
|
|
2183
2127
|
endTime = event.eventEnd;
|
|
2184
2128
|
}
|
|
2185
|
-
case
|
|
2186
|
-
|
|
2129
|
+
case 32:
|
|
2130
|
+
_context14.next = 34;
|
|
2187
2131
|
return this.EditContentObject({
|
|
2188
2132
|
objectId: targetObjectId,
|
|
2189
2133
|
libraryId: targetLibraryId
|
|
2190
2134
|
});
|
|
2191
|
-
case
|
|
2192
|
-
_yield$this$EditConte2 =
|
|
2135
|
+
case 34:
|
|
2136
|
+
_yield$this$EditConte2 = _context14.sent;
|
|
2193
2137
|
writeToken = _yield$this$EditConte2.writeToken;
|
|
2194
2138
|
status.target_object_id = targetObjectId;
|
|
2195
2139
|
status.target_library_id = targetLibraryId;
|
|
2196
2140
|
status.target_write_token = writeToken;
|
|
2197
2141
|
this.Log("Process live source (takes around 20 sec per hour of content)");
|
|
2198
|
-
|
|
2142
|
+
_context14.next = 42;
|
|
2199
2143
|
return this.CallBitcodeMethod({
|
|
2200
2144
|
libraryId: targetLibraryId,
|
|
2201
2145
|
objectId: targetObjectId,
|
|
@@ -2214,7 +2158,7 @@ exports.StreamCopyToVod = /*#__PURE__*/function () {
|
|
|
2214
2158
|
constant: false,
|
|
2215
2159
|
format: "text"
|
|
2216
2160
|
});
|
|
2217
|
-
case
|
|
2161
|
+
case 42:
|
|
2218
2162
|
abrMezInitBody = {
|
|
2219
2163
|
abr_profile: abrProfile,
|
|
2220
2164
|
"offering_key": "default",
|
|
@@ -2222,7 +2166,7 @@ exports.StreamCopyToVod = /*#__PURE__*/function () {
|
|
|
2222
2166
|
"variant_key": "default",
|
|
2223
2167
|
"keep_other_streams": false
|
|
2224
2168
|
};
|
|
2225
|
-
|
|
2169
|
+
_context14.next = 45;
|
|
2226
2170
|
return this.CallBitcodeMethod({
|
|
2227
2171
|
libraryId: targetLibraryId,
|
|
2228
2172
|
objectId: targetObjectId,
|
|
@@ -2232,9 +2176,9 @@ exports.StreamCopyToVod = /*#__PURE__*/function () {
|
|
|
2232
2176
|
constant: false,
|
|
2233
2177
|
format: "text"
|
|
2234
2178
|
});
|
|
2235
|
-
case
|
|
2236
|
-
|
|
2237
|
-
|
|
2179
|
+
case 45:
|
|
2180
|
+
_context14.prev = 45;
|
|
2181
|
+
_context14.next = 48;
|
|
2238
2182
|
return this.CallBitcodeMethod({
|
|
2239
2183
|
libraryId: targetLibraryId,
|
|
2240
2184
|
objectId: targetObjectId,
|
|
@@ -2244,16 +2188,16 @@ exports.StreamCopyToVod = /*#__PURE__*/function () {
|
|
|
2244
2188
|
constant: false,
|
|
2245
2189
|
format: "text"
|
|
2246
2190
|
});
|
|
2247
|
-
case
|
|
2248
|
-
|
|
2191
|
+
case 48:
|
|
2192
|
+
_context14.next = 54;
|
|
2249
2193
|
break;
|
|
2250
|
-
case
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
console.error("Unable to call /media/live_to_vod/copy",
|
|
2254
|
-
throw
|
|
2255
|
-
case
|
|
2256
|
-
|
|
2194
|
+
case 50:
|
|
2195
|
+
_context14.prev = 50;
|
|
2196
|
+
_context14.t0 = _context14["catch"](45);
|
|
2197
|
+
console.error("Unable to call /media/live_to_vod/copy", _context14.t0);
|
|
2198
|
+
throw _context14.t0;
|
|
2199
|
+
case 54:
|
|
2200
|
+
_context14.next = 56;
|
|
2257
2201
|
return this.CallBitcodeMethod({
|
|
2258
2202
|
libraryId: targetLibraryId,
|
|
2259
2203
|
objectId: targetObjectId,
|
|
@@ -2263,22 +2207,22 @@ exports.StreamCopyToVod = /*#__PURE__*/function () {
|
|
|
2263
2207
|
constant: false,
|
|
2264
2208
|
format: "text"
|
|
2265
2209
|
});
|
|
2266
|
-
case
|
|
2210
|
+
case 56:
|
|
2267
2211
|
if (!finalize) {
|
|
2268
|
-
|
|
2212
|
+
_context14.next = 61;
|
|
2269
2213
|
break;
|
|
2270
2214
|
}
|
|
2271
|
-
|
|
2215
|
+
_context14.next = 59;
|
|
2272
2216
|
return this.FinalizeContentObject({
|
|
2273
2217
|
libraryId: targetLibraryId,
|
|
2274
2218
|
objectId: targetObjectId,
|
|
2275
2219
|
writeToken: writeToken,
|
|
2276
2220
|
commitMessage: "Live Stream to VoD"
|
|
2277
2221
|
});
|
|
2278
|
-
case
|
|
2279
|
-
finalizeResponse =
|
|
2222
|
+
case 59:
|
|
2223
|
+
finalizeResponse = _context14.sent;
|
|
2280
2224
|
status.target_hash = finalizeResponse.hash;
|
|
2281
|
-
case
|
|
2225
|
+
case 61:
|
|
2282
2226
|
// Clean up unnecessary status items
|
|
2283
2227
|
delete status.playout_urls;
|
|
2284
2228
|
delete status.lro_status_url;
|
|
@@ -2286,20 +2230,20 @@ exports.StreamCopyToVod = /*#__PURE__*/function () {
|
|
|
2286
2230
|
delete status.recording_period_sequence;
|
|
2287
2231
|
delete status.edge_meta_size;
|
|
2288
2232
|
delete status.insertions;
|
|
2289
|
-
return
|
|
2290
|
-
case
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
this.Log(
|
|
2294
|
-
throw
|
|
2295
|
-
case
|
|
2233
|
+
return _context14.abrupt("return", status);
|
|
2234
|
+
case 70:
|
|
2235
|
+
_context14.prev = 70;
|
|
2236
|
+
_context14.t1 = _context14["catch"](21);
|
|
2237
|
+
this.Log(_context14.t1, true);
|
|
2238
|
+
throw _context14.t1;
|
|
2239
|
+
case 74:
|
|
2296
2240
|
case "end":
|
|
2297
|
-
return
|
|
2241
|
+
return _context14.stop();
|
|
2298
2242
|
}
|
|
2299
|
-
},
|
|
2243
|
+
}, _callee14, this, [[21, 70], [45, 50]]);
|
|
2300
2244
|
}));
|
|
2301
|
-
return function (
|
|
2302
|
-
return
|
|
2245
|
+
return function (_x13) {
|
|
2246
|
+
return _ref27.apply(this, arguments);
|
|
2303
2247
|
};
|
|
2304
2248
|
}();
|
|
2305
2249
|
|
|
@@ -2317,38 +2261,38 @@ exports.StreamCopyToVod = /*#__PURE__*/function () {
|
|
|
2317
2261
|
* @return {Promise<Object>} - The finalize response
|
|
2318
2262
|
*/
|
|
2319
2263
|
exports.StreamRemoveWatermark = /*#__PURE__*/function () {
|
|
2320
|
-
var
|
|
2321
|
-
var objectId, types,
|
|
2322
|
-
return _regeneratorRuntime.wrap(function
|
|
2323
|
-
while (1) switch (
|
|
2264
|
+
var _ref29 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref28) {
|
|
2265
|
+
var objectId, types, _ref28$finalize, finalize, libraryId, _yield$this$EditConte3, writeToken, edgeWriteToken, recordingParamsPath, recordingMetadata, finalizeResponse;
|
|
2266
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
2267
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
2324
2268
|
case 0:
|
|
2325
|
-
objectId =
|
|
2269
|
+
objectId = _ref28.objectId, types = _ref28.types, _ref28$finalize = _ref28.finalize, finalize = _ref28$finalize === void 0 ? true : _ref28$finalize;
|
|
2326
2270
|
ValidateObject(objectId);
|
|
2327
|
-
|
|
2271
|
+
_context15.next = 4;
|
|
2328
2272
|
return this.ContentObjectLibraryId({
|
|
2329
2273
|
objectId: objectId
|
|
2330
2274
|
});
|
|
2331
2275
|
case 4:
|
|
2332
|
-
libraryId =
|
|
2333
|
-
|
|
2276
|
+
libraryId = _context15.sent;
|
|
2277
|
+
_context15.next = 7;
|
|
2334
2278
|
return this.EditContentObject({
|
|
2335
2279
|
objectId: objectId,
|
|
2336
2280
|
libraryId: libraryId
|
|
2337
2281
|
});
|
|
2338
2282
|
case 7:
|
|
2339
|
-
_yield$this$EditConte3 =
|
|
2283
|
+
_yield$this$EditConte3 = _context15.sent;
|
|
2340
2284
|
writeToken = _yield$this$EditConte3.writeToken;
|
|
2341
2285
|
this.Log("Removing watermark types: ".concat(types.join(", "), " ").concat(libraryId, " ").concat(objectId));
|
|
2342
|
-
|
|
2286
|
+
_context15.next = 12;
|
|
2343
2287
|
return this.ContentObjectMetadata({
|
|
2344
2288
|
objectId: objectId,
|
|
2345
2289
|
libraryId: libraryId,
|
|
2346
2290
|
metadataSubtree: "/live_recording/fabric_config/edge_write_token"
|
|
2347
2291
|
});
|
|
2348
2292
|
case 12:
|
|
2349
|
-
edgeWriteToken =
|
|
2293
|
+
edgeWriteToken = _context15.sent;
|
|
2350
2294
|
recordingParamsPath = "live_recording/recording_config/recording_params";
|
|
2351
|
-
|
|
2295
|
+
_context15.next = 16;
|
|
2352
2296
|
return this.ContentObjectMetadata({
|
|
2353
2297
|
libraryId: libraryId,
|
|
2354
2298
|
objectId: objectId,
|
|
@@ -2357,9 +2301,9 @@ exports.StreamRemoveWatermark = /*#__PURE__*/function () {
|
|
|
2357
2301
|
resolveLinks: false
|
|
2358
2302
|
});
|
|
2359
2303
|
case 16:
|
|
2360
|
-
recordingMetadata =
|
|
2304
|
+
recordingMetadata = _context15.sent;
|
|
2361
2305
|
if (recordingMetadata) {
|
|
2362
|
-
|
|
2306
|
+
_context15.next = 19;
|
|
2363
2307
|
break;
|
|
2364
2308
|
}
|
|
2365
2309
|
throw Error("Stream object must be configured");
|
|
@@ -2371,7 +2315,7 @@ exports.StreamRemoveWatermark = /*#__PURE__*/function () {
|
|
|
2371
2315
|
delete recordingMetadata.image_watermark;
|
|
2372
2316
|
}
|
|
2373
2317
|
});
|
|
2374
|
-
|
|
2318
|
+
_context15.next = 22;
|
|
2375
2319
|
return this.ReplaceMetadata({
|
|
2376
2320
|
libraryId: libraryId,
|
|
2377
2321
|
objectId: objectId,
|
|
@@ -2381,10 +2325,10 @@ exports.StreamRemoveWatermark = /*#__PURE__*/function () {
|
|
|
2381
2325
|
});
|
|
2382
2326
|
case 22:
|
|
2383
2327
|
if (!edgeWriteToken) {
|
|
2384
|
-
|
|
2328
|
+
_context15.next = 25;
|
|
2385
2329
|
break;
|
|
2386
2330
|
}
|
|
2387
|
-
|
|
2331
|
+
_context15.next = 25;
|
|
2388
2332
|
return this.ReplaceMetadata({
|
|
2389
2333
|
libraryId: libraryId,
|
|
2390
2334
|
objectId: objectId,
|
|
@@ -2394,10 +2338,10 @@ exports.StreamRemoveWatermark = /*#__PURE__*/function () {
|
|
|
2394
2338
|
});
|
|
2395
2339
|
case 25:
|
|
2396
2340
|
if (!finalize) {
|
|
2397
|
-
|
|
2341
|
+
_context15.next = 30;
|
|
2398
2342
|
break;
|
|
2399
2343
|
}
|
|
2400
|
-
|
|
2344
|
+
_context15.next = 28;
|
|
2401
2345
|
return this.FinalizeContentObject({
|
|
2402
2346
|
libraryId: libraryId,
|
|
2403
2347
|
objectId: objectId,
|
|
@@ -2405,16 +2349,16 @@ exports.StreamRemoveWatermark = /*#__PURE__*/function () {
|
|
|
2405
2349
|
commitMessage: "Watermark removed"
|
|
2406
2350
|
});
|
|
2407
2351
|
case 28:
|
|
2408
|
-
finalizeResponse =
|
|
2409
|
-
return
|
|
2352
|
+
finalizeResponse = _context15.sent;
|
|
2353
|
+
return _context15.abrupt("return", finalizeResponse);
|
|
2410
2354
|
case 30:
|
|
2411
2355
|
case "end":
|
|
2412
|
-
return
|
|
2356
|
+
return _context15.stop();
|
|
2413
2357
|
}
|
|
2414
|
-
},
|
|
2358
|
+
}, _callee15, this);
|
|
2415
2359
|
}));
|
|
2416
|
-
return function (
|
|
2417
|
-
return
|
|
2360
|
+
return function (_x14) {
|
|
2361
|
+
return _ref29.apply(this, arguments);
|
|
2418
2362
|
};
|
|
2419
2363
|
}();
|
|
2420
2364
|
|
|
@@ -2431,38 +2375,38 @@ exports.StreamRemoveWatermark = /*#__PURE__*/function () {
|
|
|
2431
2375
|
* @return {Promise<Object>} - The finalize response
|
|
2432
2376
|
*/
|
|
2433
2377
|
exports.StreamAddWatermark = /*#__PURE__*/function () {
|
|
2434
|
-
var
|
|
2435
|
-
var objectId, simpleWatermark, imageWatermark,
|
|
2436
|
-
return _regeneratorRuntime.wrap(function
|
|
2437
|
-
while (1) switch (
|
|
2378
|
+
var _ref31 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref30) {
|
|
2379
|
+
var objectId, simpleWatermark, imageWatermark, _ref30$finalize, finalize, libraryId, _yield$this$EditConte4, writeToken, edgeWriteToken, recordingParamsPath, recordingMetadata, response, finalizeResponse;
|
|
2380
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
|
2381
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
2438
2382
|
case 0:
|
|
2439
|
-
objectId =
|
|
2383
|
+
objectId = _ref30.objectId, simpleWatermark = _ref30.simpleWatermark, imageWatermark = _ref30.imageWatermark, _ref30$finalize = _ref30.finalize, finalize = _ref30$finalize === void 0 ? true : _ref30$finalize;
|
|
2440
2384
|
ValidateObject(objectId);
|
|
2441
|
-
|
|
2385
|
+
_context16.next = 4;
|
|
2442
2386
|
return this.ContentObjectLibraryId({
|
|
2443
2387
|
objectId: objectId
|
|
2444
2388
|
});
|
|
2445
2389
|
case 4:
|
|
2446
|
-
libraryId =
|
|
2447
|
-
|
|
2390
|
+
libraryId = _context16.sent;
|
|
2391
|
+
_context16.next = 7;
|
|
2448
2392
|
return this.EditContentObject({
|
|
2449
2393
|
objectId: objectId,
|
|
2450
2394
|
libraryId: libraryId
|
|
2451
2395
|
});
|
|
2452
2396
|
case 7:
|
|
2453
|
-
_yield$this$EditConte4 =
|
|
2397
|
+
_yield$this$EditConte4 = _context16.sent;
|
|
2454
2398
|
writeToken = _yield$this$EditConte4.writeToken;
|
|
2455
|
-
|
|
2399
|
+
_context16.next = 11;
|
|
2456
2400
|
return this.ContentObjectMetadata({
|
|
2457
2401
|
objectId: objectId,
|
|
2458
2402
|
libraryId: libraryId,
|
|
2459
2403
|
metadataSubtree: "/live_recording/fabric_config/edge_write_token"
|
|
2460
2404
|
});
|
|
2461
2405
|
case 11:
|
|
2462
|
-
edgeWriteToken =
|
|
2406
|
+
edgeWriteToken = _context16.sent;
|
|
2463
2407
|
this.Log("Adding watermarking type: ".concat(imageWatermark ? "image" : "text", " ").concat(libraryId, " ").concat(objectId));
|
|
2464
2408
|
recordingParamsPath = "live_recording/recording_config/recording_params";
|
|
2465
|
-
|
|
2409
|
+
_context16.next = 16;
|
|
2466
2410
|
return this.ContentObjectMetadata({
|
|
2467
2411
|
libraryId: libraryId,
|
|
2468
2412
|
objectId: objectId,
|
|
@@ -2471,9 +2415,9 @@ exports.StreamAddWatermark = /*#__PURE__*/function () {
|
|
|
2471
2415
|
resolveLinks: false
|
|
2472
2416
|
});
|
|
2473
2417
|
case 16:
|
|
2474
|
-
recordingMetadata =
|
|
2418
|
+
recordingMetadata = _context16.sent;
|
|
2475
2419
|
if (recordingMetadata) {
|
|
2476
|
-
|
|
2420
|
+
_context16.next = 19;
|
|
2477
2421
|
break;
|
|
2478
2422
|
}
|
|
2479
2423
|
throw Error("Stream object must be configured");
|
|
@@ -2483,7 +2427,7 @@ exports.StreamAddWatermark = /*#__PURE__*/function () {
|
|
|
2483
2427
|
} else if (imageWatermark) {
|
|
2484
2428
|
recordingMetadata.image_watermark = imageWatermark;
|
|
2485
2429
|
}
|
|
2486
|
-
|
|
2430
|
+
_context16.next = 22;
|
|
2487
2431
|
return this.ReplaceMetadata({
|
|
2488
2432
|
libraryId: libraryId,
|
|
2489
2433
|
objectId: objectId,
|
|
@@ -2493,10 +2437,10 @@ exports.StreamAddWatermark = /*#__PURE__*/function () {
|
|
|
2493
2437
|
});
|
|
2494
2438
|
case 22:
|
|
2495
2439
|
if (!edgeWriteToken) {
|
|
2496
|
-
|
|
2440
|
+
_context16.next = 25;
|
|
2497
2441
|
break;
|
|
2498
2442
|
}
|
|
2499
|
-
|
|
2443
|
+
_context16.next = 25;
|
|
2500
2444
|
return this.ReplaceMetadata({
|
|
2501
2445
|
libraryId: libraryId,
|
|
2502
2446
|
objectId: objectId,
|
|
@@ -2510,10 +2454,10 @@ exports.StreamAddWatermark = /*#__PURE__*/function () {
|
|
|
2510
2454
|
"textWatermark": recordingMetadata.simple_watermark
|
|
2511
2455
|
};
|
|
2512
2456
|
if (!finalize) {
|
|
2513
|
-
|
|
2457
|
+
_context16.next = 31;
|
|
2514
2458
|
break;
|
|
2515
2459
|
}
|
|
2516
|
-
|
|
2460
|
+
_context16.next = 29;
|
|
2517
2461
|
return this.FinalizeContentObject({
|
|
2518
2462
|
libraryId: libraryId,
|
|
2519
2463
|
objectId: objectId,
|
|
@@ -2521,17 +2465,17 @@ exports.StreamAddWatermark = /*#__PURE__*/function () {
|
|
|
2521
2465
|
commitMessage: "Watermark set"
|
|
2522
2466
|
});
|
|
2523
2467
|
case 29:
|
|
2524
|
-
finalizeResponse =
|
|
2468
|
+
finalizeResponse = _context16.sent;
|
|
2525
2469
|
response.hash = finalizeResponse.hash;
|
|
2526
2470
|
case 31:
|
|
2527
|
-
return
|
|
2471
|
+
return _context16.abrupt("return", response);
|
|
2528
2472
|
case 32:
|
|
2529
2473
|
case "end":
|
|
2530
|
-
return
|
|
2474
|
+
return _context16.stop();
|
|
2531
2475
|
}
|
|
2532
|
-
},
|
|
2476
|
+
}, _callee16, this);
|
|
2533
2477
|
}));
|
|
2534
|
-
return function (
|
|
2535
|
-
return
|
|
2478
|
+
return function (_x15) {
|
|
2479
|
+
return _ref31.apply(this, arguments);
|
|
2536
2480
|
};
|
|
2537
2481
|
}();
|