@eluvio/elv-client-js 4.2.6 → 4.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ElvClient-min.js +1 -1
- package/dist/ElvClient-node-min.js +1 -1
- package/dist/ElvFrameClient-min.js +1 -1
- package/dist/ElvPermissionsClient-min.js +1 -1
- package/dist/ElvWalletClient-min.js +1 -1
- package/dist/ElvWalletClient-node-min.js +1 -1
- package/dist/src/AuthorizationClient.js +709 -710
- package/dist/src/ContentObjectAudit.js +56 -56
- package/dist/src/Crypto.js +85 -85
- package/dist/src/ElvClient.js +529 -499
- package/dist/src/ElvWallet.js +30 -28
- package/dist/src/EthClient.js +311 -311
- package/dist/src/FrameClient.js +63 -64
- package/dist/src/HttpClient.js +60 -60
- package/dist/src/Id.js +1 -2
- package/dist/src/PermissionsClient.js +499 -487
- package/dist/src/RemoteSigner.js +82 -83
- package/dist/src/UserProfileClient.js +392 -374
- package/dist/src/Utils.js +69 -66
- package/dist/src/Validation.js +10 -10
- package/dist/src/client/ABRPublishing.js +238 -238
- package/dist/src/client/AccessGroups.js +477 -474
- package/dist/src/client/ContentAccess.js +1707 -1711
- package/dist/src/client/ContentManagement.js +871 -871
- package/dist/src/client/Contracts.js +575 -578
- package/dist/src/client/Files.js +700 -684
- package/dist/src/client/LiveConf.js +1 -3
- package/dist/src/client/LiveStream.js +694 -693
- package/dist/src/client/NFT.js +14 -14
- package/dist/src/client/NTP.js +84 -84
- package/dist/src/client/Shares.js +53 -60
- package/dist/src/walletClient/ClientMethods.js +977 -951
- package/dist/src/walletClient/Notifications.js +14 -14
- package/dist/src/walletClient/Profile.js +66 -66
- package/dist/src/walletClient/Utils.js +15 -15
- package/dist/src/walletClient/index.js +572 -562
- package/package.json +1 -1
- package/src/AuthorizationClient.js +9 -3
- package/src/ElvClient.js +1 -1
- package/src/walletClient/index.js +6 -2
- package/dist/src/ContentObjectVerification.js +0 -281
|
@@ -22,13 +22,13 @@ var _require2 = require("../Validation"),
|
|
|
22
22
|
ValidatePresence = _require2.ValidatePresence;
|
|
23
23
|
var ContentObjectAudit = require("../ContentObjectAudit");
|
|
24
24
|
var MakeTxLessToken = /*#__PURE__*/function () {
|
|
25
|
-
var _ref2 = _asyncToGenerator(
|
|
25
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
|
|
26
26
|
var client, libraryId, objectId, versionHash, tok;
|
|
27
|
-
return _regeneratorRuntime.wrap(function
|
|
27
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
28
28
|
while (1) switch (_context.prev = _context.next) {
|
|
29
29
|
case 0:
|
|
30
30
|
client = _ref.client, libraryId = _ref.libraryId, objectId = _ref.objectId, versionHash = _ref.versionHash;
|
|
31
|
-
_context.next =
|
|
31
|
+
_context.next = 1;
|
|
32
32
|
return client.authClient.AuthorizationToken({
|
|
33
33
|
libraryId: libraryId,
|
|
34
34
|
objectId: objectId,
|
|
@@ -37,10 +37,10 @@ var MakeTxLessToken = /*#__PURE__*/function () {
|
|
|
37
37
|
noCache: true,
|
|
38
38
|
noAuth: true
|
|
39
39
|
});
|
|
40
|
-
case
|
|
40
|
+
case 1:
|
|
41
41
|
tok = _context.sent;
|
|
42
42
|
return _context.abrupt("return", tok);
|
|
43
|
-
case
|
|
43
|
+
case 2:
|
|
44
44
|
case "end":
|
|
45
45
|
return _context.stop();
|
|
46
46
|
}
|
|
@@ -56,81 +56,81 @@ var Sleep = function Sleep(ms) {
|
|
|
56
56
|
});
|
|
57
57
|
};
|
|
58
58
|
var CueInfo = /*#__PURE__*/function () {
|
|
59
|
-
var _ref4 = _asyncToGenerator(
|
|
60
|
-
var eventId, status, cues, lroStatusResponse, eventStart, eventEnd, _i, _Object$values, value, _i2, _Object$values2, event;
|
|
61
|
-
return _regeneratorRuntime.wrap(function
|
|
59
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
|
|
60
|
+
var eventId, status, cues, lroStatusResponse, eventStart, eventEnd, _i, _Object$values, value, _i2, _Object$values2, event, _t, _t2, _t3, _t4;
|
|
61
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
62
62
|
while (1) switch (_context2.prev = _context2.next) {
|
|
63
63
|
case 0:
|
|
64
64
|
eventId = _ref3.eventId, status = _ref3.status;
|
|
65
65
|
_context2.prev = 1;
|
|
66
|
-
|
|
67
|
-
_context2.next =
|
|
66
|
+
_t = _this.utils;
|
|
67
|
+
_context2.next = 2;
|
|
68
68
|
return HttpClient.Fetch(status.lro_status_url);
|
|
69
|
-
case
|
|
70
|
-
|
|
71
|
-
_context2.next =
|
|
72
|
-
return
|
|
73
|
-
case
|
|
69
|
+
case 2:
|
|
70
|
+
_t2 = _context2.sent;
|
|
71
|
+
_context2.next = 3;
|
|
72
|
+
return _t.ResponseToJson.call(_t, _t2);
|
|
73
|
+
case 3:
|
|
74
74
|
lroStatusResponse = _context2.sent;
|
|
75
75
|
console.log("lroStatusResponse", lroStatusResponse);
|
|
76
76
|
cues = lroStatusResponse.custom.cues;
|
|
77
|
-
_context2.next =
|
|
77
|
+
_context2.next = 5;
|
|
78
78
|
break;
|
|
79
|
-
case
|
|
80
|
-
_context2.prev =
|
|
81
|
-
|
|
82
|
-
console.log("LRO status failed",
|
|
79
|
+
case 4:
|
|
80
|
+
_context2.prev = 4;
|
|
81
|
+
_t3 = _context2["catch"](1);
|
|
82
|
+
console.log("LRO status failed", _t3);
|
|
83
83
|
return _context2.abrupt("return", {
|
|
84
84
|
error: "failed to retrieve status",
|
|
85
85
|
eventId: eventId
|
|
86
86
|
});
|
|
87
|
-
case
|
|
87
|
+
case 5:
|
|
88
88
|
_i = 0, _Object$values = Object.values(cues);
|
|
89
|
-
case
|
|
89
|
+
case 6:
|
|
90
90
|
if (!(_i < _Object$values.length)) {
|
|
91
|
-
_context2.next =
|
|
91
|
+
_context2.next = 12;
|
|
92
92
|
break;
|
|
93
93
|
}
|
|
94
94
|
value = _Object$values[_i];
|
|
95
95
|
_i2 = 0, _Object$values2 = Object.values(value.descriptors);
|
|
96
|
-
case
|
|
96
|
+
case 7:
|
|
97
97
|
if (!(_i2 < _Object$values2.length)) {
|
|
98
|
-
_context2.next =
|
|
98
|
+
_context2.next = 11;
|
|
99
99
|
break;
|
|
100
100
|
}
|
|
101
101
|
event = _Object$values2[_i2];
|
|
102
102
|
if (!(event.id == eventId)) {
|
|
103
|
-
_context2.next =
|
|
103
|
+
_context2.next = 10;
|
|
104
104
|
break;
|
|
105
105
|
}
|
|
106
|
-
|
|
107
|
-
_context2.next =
|
|
106
|
+
_t4 = event.type_id;
|
|
107
|
+
_context2.next = _t4 === 32 ? 8 : _t4 === 16 ? 8 : _t4 === 33 ? 9 : _t4 === 17 ? 9 : 10;
|
|
108
108
|
break;
|
|
109
|
-
case
|
|
109
|
+
case 8:
|
|
110
110
|
eventStart = value.insertion_time;
|
|
111
|
-
return _context2.abrupt("
|
|
112
|
-
case
|
|
111
|
+
return _context2.abrupt("continue", 10);
|
|
112
|
+
case 9:
|
|
113
113
|
eventEnd = value.insertion_time;
|
|
114
|
-
return _context2.abrupt("
|
|
115
|
-
case
|
|
114
|
+
return _context2.abrupt("continue", 10);
|
|
115
|
+
case 10:
|
|
116
116
|
_i2++;
|
|
117
|
-
_context2.next =
|
|
117
|
+
_context2.next = 7;
|
|
118
118
|
break;
|
|
119
|
-
case
|
|
119
|
+
case 11:
|
|
120
120
|
_i++;
|
|
121
|
-
_context2.next =
|
|
121
|
+
_context2.next = 6;
|
|
122
122
|
break;
|
|
123
|
-
case
|
|
123
|
+
case 12:
|
|
124
124
|
return _context2.abrupt("return", {
|
|
125
125
|
eventStart: eventStart,
|
|
126
126
|
eventEnd: eventEnd,
|
|
127
127
|
eventId: eventId
|
|
128
128
|
});
|
|
129
|
-
case
|
|
129
|
+
case 13:
|
|
130
130
|
case "end":
|
|
131
131
|
return _context2.stop();
|
|
132
132
|
}
|
|
133
|
-
}, _callee2, null, [[1,
|
|
133
|
+
}, _callee2, null, [[1, 4]]);
|
|
134
134
|
}));
|
|
135
135
|
return function CueInfo(_x2) {
|
|
136
136
|
return _ref4.apply(this, arguments);
|
|
@@ -145,7 +145,6 @@ var CueInfo = /*#__PURE__*/function () {
|
|
|
145
145
|
* @param {Object} client - The client object
|
|
146
146
|
* @param {string} libraryId - ID of the library for the new live stream object
|
|
147
147
|
* @param {string} objectId - ID of the new live stream object
|
|
148
|
-
* @param {string=} writeToken - Write token of the draft
|
|
149
148
|
* @param {string=} typeAbrMaster - Content type hash
|
|
150
149
|
* @param {string=} typeLiveStream - Content type hash
|
|
151
150
|
* @param {string} streamUrl - Live source URL
|
|
@@ -167,12 +166,12 @@ var CueInfo = /*#__PURE__*/function () {
|
|
|
167
166
|
* @return {Promise<string>} - Final hash of the live stream object
|
|
168
167
|
*/
|
|
169
168
|
var StreamGenerateOffering = /*#__PURE__*/function () {
|
|
170
|
-
var _ref6 = _asyncToGenerator(
|
|
171
|
-
var client, libraryId, objectId,
|
|
172
|
-
return _regeneratorRuntime.wrap(function
|
|
169
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref5) {
|
|
170
|
+
var client, libraryId, objectId, typeAbrMaster, typeLiveStream, streamUrl, abrProfile, aBitRate, aChannels, aSampleRate, aStreamIndex, aTimeBase, aChannelLayout, vBitRate, vHeight, vStreamIndex, vWidth, vDisplayAspectRatio, vFrameRate, vTimeBase, DUMMY_DURATION, aDurationTs, vDurationTs, sourceAudioStream, sourceVideoStream, DUMMY_STREAM, sourceStreams, maxStreamIndex, i, sources, variants, production_master, metadata, editResponse, writeToken, finalizeResponse, masterVersionHash, createResponse, versionHash, finalHash;
|
|
171
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
173
172
|
while (1) switch (_context3.prev = _context3.next) {
|
|
174
173
|
case 0:
|
|
175
|
-
client = _ref5.client, libraryId = _ref5.libraryId, objectId = _ref5.objectId,
|
|
174
|
+
client = _ref5.client, libraryId = _ref5.libraryId, objectId = _ref5.objectId, typeAbrMaster = _ref5.typeAbrMaster, typeLiveStream = _ref5.typeLiveStream, streamUrl = _ref5.streamUrl, abrProfile = _ref5.abrProfile, aBitRate = _ref5.aBitRate, aChannels = _ref5.aChannels, aSampleRate = _ref5.aSampleRate, aStreamIndex = _ref5.aStreamIndex, aTimeBase = _ref5.aTimeBase, aChannelLayout = _ref5.aChannelLayout, vBitRate = _ref5.vBitRate, vHeight = _ref5.vHeight, vStreamIndex = _ref5.vStreamIndex, vWidth = _ref5.vWidth, vDisplayAspectRatio = _ref5.vDisplayAspectRatio, vFrameRate = _ref5.vFrameRate, vTimeBase = _ref5.vTimeBase;
|
|
176
175
|
// compute duration_ts
|
|
177
176
|
DUMMY_DURATION = 1001; // should result in integer duration_ts values for both audio and video
|
|
178
177
|
aDurationTs = Fraction(aTimeBase).inverse().mul(DUMMY_DURATION).valueOf();
|
|
@@ -277,26 +276,21 @@ var StreamGenerateOffering = /*#__PURE__*/function () {
|
|
|
277
276
|
production_master = {
|
|
278
277
|
sources: sources,
|
|
279
278
|
variants: variants
|
|
280
|
-
};
|
|
281
|
-
existingWriteToken = !!writeToken; // get existing metadata
|
|
279
|
+
}; // get existing metadata
|
|
282
280
|
console.log("Retrieving current metadata...");
|
|
283
|
-
_context3.next =
|
|
281
|
+
_context3.next = 1;
|
|
284
282
|
return client.ContentObjectMetadata({
|
|
285
283
|
libraryId: libraryId,
|
|
286
|
-
objectId: objectId
|
|
287
|
-
writeToken: writeToken
|
|
284
|
+
objectId: objectId
|
|
288
285
|
});
|
|
289
|
-
case
|
|
286
|
+
case 1:
|
|
290
287
|
metadata = _context3.sent;
|
|
291
288
|
// add /production_master to metadata
|
|
292
289
|
metadata.production_master = production_master;
|
|
293
290
|
|
|
294
291
|
// write back to object
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
break;
|
|
298
|
-
}
|
|
299
|
-
_context3.next = 22;
|
|
292
|
+
console.log("Getting write token...");
|
|
293
|
+
_context3.next = 2;
|
|
300
294
|
return client.EditContentObject({
|
|
301
295
|
libraryId: libraryId,
|
|
302
296
|
objectId: objectId,
|
|
@@ -304,45 +298,42 @@ var StreamGenerateOffering = /*#__PURE__*/function () {
|
|
|
304
298
|
type: typeAbrMaster
|
|
305
299
|
}
|
|
306
300
|
});
|
|
307
|
-
case
|
|
308
|
-
|
|
309
|
-
writeToken =
|
|
310
|
-
|
|
301
|
+
case 2:
|
|
302
|
+
editResponse = _context3.sent;
|
|
303
|
+
writeToken = editResponse.write_token;
|
|
304
|
+
console.log("New write token: ".concat(writeToken));
|
|
311
305
|
console.log("Writing back metadata with /production_master added...");
|
|
312
|
-
_context3.next =
|
|
306
|
+
_context3.next = 3;
|
|
313
307
|
return client.ReplaceMetadata({
|
|
314
308
|
libraryId: libraryId,
|
|
315
309
|
metadata: metadata,
|
|
316
310
|
objectId: objectId,
|
|
317
311
|
writeToken: writeToken
|
|
318
312
|
});
|
|
319
|
-
case
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
break;
|
|
323
|
-
}
|
|
324
|
-
_context3.next = 30;
|
|
313
|
+
case 3:
|
|
314
|
+
console.log("Finalizing...");
|
|
315
|
+
_context3.next = 4;
|
|
325
316
|
return client.FinalizeContentObject({
|
|
326
317
|
libraryId: libraryId,
|
|
327
318
|
objectId: objectId,
|
|
328
319
|
writeToken: writeToken
|
|
329
320
|
});
|
|
330
|
-
case
|
|
321
|
+
case 4:
|
|
331
322
|
finalizeResponse = _context3.sent;
|
|
332
323
|
masterVersionHash = finalizeResponse.hash;
|
|
333
|
-
|
|
334
|
-
|
|
324
|
+
console.log("Finalized, new version hash: ".concat(masterVersionHash));
|
|
325
|
+
|
|
326
|
+
// Generate offering
|
|
327
|
+
_context3.next = 5;
|
|
335
328
|
return client.CreateABRMezzanine({
|
|
336
329
|
libraryId: libraryId,
|
|
337
330
|
objectId: objectId,
|
|
338
|
-
masterVersionHash:
|
|
339
|
-
masterWriteToken: existingWriteToken ? writeToken : undefined,
|
|
340
|
-
writeToken: existingWriteToken ? writeToken : undefined,
|
|
331
|
+
masterVersionHash: masterVersionHash,
|
|
341
332
|
variant: "default",
|
|
342
333
|
offeringKey: "default",
|
|
343
334
|
abrProfile: abrProfile
|
|
344
335
|
});
|
|
345
|
-
case
|
|
336
|
+
case 5:
|
|
346
337
|
createResponse = _context3.sent;
|
|
347
338
|
if (createResponse.warnings.length > 0) {
|
|
348
339
|
console.log("WARNINGS:");
|
|
@@ -352,16 +343,17 @@ var StreamGenerateOffering = /*#__PURE__*/function () {
|
|
|
352
343
|
console.log("ERRORS:");
|
|
353
344
|
console.log(JSON.stringify(createResponse.errors, null, 2));
|
|
354
345
|
}
|
|
355
|
-
versionHash = createResponse.hash;
|
|
346
|
+
versionHash = createResponse.hash;
|
|
347
|
+
console.log("New version hash: ".concat(versionHash));
|
|
348
|
+
|
|
349
|
+
// get new metadata
|
|
356
350
|
console.log("Retrieving revised metadata with offering...");
|
|
357
|
-
_context3.next =
|
|
351
|
+
_context3.next = 6;
|
|
358
352
|
return client.ContentObjectMetadata({
|
|
359
353
|
libraryId: libraryId,
|
|
360
|
-
|
|
361
|
-
writeToken: existingWriteToken ? writeToken : undefined,
|
|
362
|
-
versionHash: existingWriteToken ? undefined : versionHash
|
|
354
|
+
versionHash: versionHash
|
|
363
355
|
});
|
|
364
|
-
case
|
|
356
|
+
case 6:
|
|
365
357
|
metadata = _context3.sent;
|
|
366
358
|
console.log("Moving /abr_mezzanine/offerings to /offerings and removing /abr_mezzanine...");
|
|
367
359
|
metadata.offerings = metadata.abr_mezzanine.offerings;
|
|
@@ -369,33 +361,43 @@ var StreamGenerateOffering = /*#__PURE__*/function () {
|
|
|
369
361
|
|
|
370
362
|
// add items to media_struct needed to use options.json handler
|
|
371
363
|
metadata.offerings["default"].media_struct.duration_rat = "".concat(DUMMY_DURATION);
|
|
364
|
+
|
|
365
|
+
// write back to object
|
|
366
|
+
console.log("Getting write token...");
|
|
367
|
+
_context3.next = 7;
|
|
368
|
+
return client.EditContentObject({
|
|
369
|
+
libraryId: libraryId,
|
|
370
|
+
objectId: objectId,
|
|
371
|
+
options: {
|
|
372
|
+
type: typeLiveStream
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
case 7:
|
|
376
|
+
editResponse = _context3.sent;
|
|
377
|
+
writeToken = editResponse.write_token;
|
|
378
|
+
console.log("New write token: ".concat(writeToken));
|
|
372
379
|
console.log("Writing back metadata with /offerings...");
|
|
373
|
-
_context3.next =
|
|
380
|
+
_context3.next = 8;
|
|
374
381
|
return client.ReplaceMetadata({
|
|
375
382
|
libraryId: libraryId,
|
|
376
383
|
metadata: metadata,
|
|
377
384
|
objectId: objectId,
|
|
378
385
|
writeToken: writeToken
|
|
379
386
|
});
|
|
380
|
-
case
|
|
381
|
-
if (!finalize) {
|
|
382
|
-
_context3.next = 57;
|
|
383
|
-
break;
|
|
384
|
-
}
|
|
387
|
+
case 8:
|
|
385
388
|
console.log("Finalizing...");
|
|
386
|
-
_context3.next =
|
|
389
|
+
_context3.next = 9;
|
|
387
390
|
return client.FinalizeContentObject({
|
|
388
391
|
libraryId: libraryId,
|
|
389
392
|
objectId: objectId,
|
|
390
|
-
writeToken: writeToken
|
|
391
|
-
commitMessage: "Update offering"
|
|
393
|
+
writeToken: writeToken
|
|
392
394
|
});
|
|
393
|
-
case
|
|
395
|
+
case 9:
|
|
394
396
|
finalizeResponse = _context3.sent;
|
|
395
397
|
finalHash = finalizeResponse.hash;
|
|
396
398
|
console.log("Finalized, new version hash: ".concat(finalHash));
|
|
397
399
|
return _context3.abrupt("return", finalHash);
|
|
398
|
-
case
|
|
400
|
+
case 10:
|
|
399
401
|
case "end":
|
|
400
402
|
return _context3.stop();
|
|
401
403
|
}
|
|
@@ -426,9 +428,9 @@ var StreamGenerateOffering = /*#__PURE__*/function () {
|
|
|
426
428
|
* @return {Promise<Object>} - The status response for the object, as well as logs, warnings and errors from the master initialization
|
|
427
429
|
*/
|
|
428
430
|
exports.StreamStatus = /*#__PURE__*/function () {
|
|
429
|
-
var _ref8 = _asyncToGenerator(
|
|
430
|
-
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, segDurationMeta, playout_urls, playout_options, hls_clear_enabled, hls_aes128_enabled, hls_sample_aes_enabled, networkInfo, token, embed_net, embed_url;
|
|
431
|
-
return _regeneratorRuntime.wrap(function
|
|
431
|
+
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref7) {
|
|
432
|
+
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, segDurationMeta, playout_urls, playout_options, hls_clear_enabled, hls_aes128_enabled, hls_sample_aes_enabled, networkInfo, token, embed_net, embed_url, _t5, _t6, _t7, _t8, _t9, _t0, _t1, _t10;
|
|
433
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
432
434
|
while (1) switch (_context4.prev = _context4.next) {
|
|
433
435
|
case 0:
|
|
434
436
|
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;
|
|
@@ -436,47 +438,47 @@ exports.StreamStatus = /*#__PURE__*/function () {
|
|
|
436
438
|
status = {
|
|
437
439
|
name: name
|
|
438
440
|
};
|
|
439
|
-
_context4.prev =
|
|
440
|
-
_context4.next =
|
|
441
|
+
_context4.prev = 1;
|
|
442
|
+
_context4.next = 2;
|
|
441
443
|
return this.ContentObjectLibraryId({
|
|
442
444
|
objectId: objectId
|
|
443
445
|
});
|
|
444
|
-
case
|
|
446
|
+
case 2:
|
|
445
447
|
libraryId = _context4.sent;
|
|
446
448
|
status.library_id = libraryId;
|
|
447
449
|
status.object_id = objectId;
|
|
448
|
-
_context4.next =
|
|
450
|
+
_context4.next = 3;
|
|
449
451
|
return this.ContentObjectMetadata({
|
|
450
452
|
libraryId: libraryId,
|
|
451
453
|
objectId: objectId,
|
|
452
454
|
select: ["live_recording_config", "live_recording"]
|
|
453
455
|
});
|
|
454
|
-
case
|
|
456
|
+
case 3:
|
|
455
457
|
mainMeta = _context4.sent;
|
|
456
458
|
status.reference_url = mainMeta.live_recording_config.reference_url;
|
|
457
459
|
if (!(mainMeta.live_recording_config == undefined || mainMeta.live_recording_config.url == undefined)) {
|
|
458
|
-
_context4.next =
|
|
460
|
+
_context4.next = 4;
|
|
459
461
|
break;
|
|
460
462
|
}
|
|
461
463
|
status.state = "unconfigured";
|
|
462
464
|
return _context4.abrupt("return", status);
|
|
463
|
-
case
|
|
465
|
+
case 4:
|
|
464
466
|
if (!(mainMeta.live_recording == undefined || mainMeta.live_recording.fabric_config == undefined || mainMeta.live_recording.playout_config == undefined || mainMeta.live_recording.recording_config == undefined)) {
|
|
465
|
-
_context4.next =
|
|
467
|
+
_context4.next = 5;
|
|
466
468
|
break;
|
|
467
469
|
}
|
|
468
470
|
status.state = "uninitialized";
|
|
469
471
|
return _context4.abrupt("return", status);
|
|
470
|
-
case
|
|
472
|
+
case 5:
|
|
471
473
|
fabURI = mainMeta.live_recording.fabric_config.ingress_node_api;
|
|
472
474
|
if (!(fabURI === undefined)) {
|
|
473
|
-
_context4.next =
|
|
475
|
+
_context4.next = 6;
|
|
474
476
|
break;
|
|
475
477
|
}
|
|
476
478
|
console.log("bad fabric config - missing ingress node API");
|
|
477
479
|
status.state = "uninitialized";
|
|
478
480
|
return _context4.abrupt("return", status);
|
|
479
|
-
case
|
|
481
|
+
case 6:
|
|
480
482
|
// Support both hostname and URL ingress_node_api
|
|
481
483
|
if (!fabURI.startsWith("http")) {
|
|
482
484
|
// Assume https
|
|
@@ -486,52 +488,52 @@ exports.StreamStatus = /*#__PURE__*/function () {
|
|
|
486
488
|
status.url = mainMeta.live_recording.recording_config.recording_params.origin_url;
|
|
487
489
|
edgeWriteToken = mainMeta.live_recording.fabric_config.edge_write_token;
|
|
488
490
|
if (edgeWriteToken) {
|
|
489
|
-
_context4.next =
|
|
491
|
+
_context4.next = 7;
|
|
490
492
|
break;
|
|
491
493
|
}
|
|
492
494
|
status.state = "inactive";
|
|
493
495
|
return _context4.abrupt("return", status);
|
|
494
|
-
case
|
|
496
|
+
case 7:
|
|
495
497
|
this.RecordWriteToken({
|
|
496
498
|
writeToken: edgeWriteToken,
|
|
497
499
|
fabricNodeUrl: fabURI
|
|
498
500
|
});
|
|
499
501
|
status.edge_write_token = edgeWriteToken;
|
|
500
502
|
status.stream_id = edgeWriteToken; // By convention the stream ID is its write token
|
|
501
|
-
_context4.prev =
|
|
502
|
-
_context4.next =
|
|
503
|
+
_context4.prev = 8;
|
|
504
|
+
_context4.next = 9;
|
|
503
505
|
return this.ContentObjectMetadata({
|
|
504
506
|
libraryId: libraryId,
|
|
505
507
|
objectId: objectId,
|
|
506
508
|
writeToken: edgeWriteToken,
|
|
507
509
|
select: ["live_recording"]
|
|
508
510
|
});
|
|
509
|
-
case
|
|
511
|
+
case 9:
|
|
510
512
|
edgeMeta = _context4.sent;
|
|
511
|
-
_context4.next =
|
|
513
|
+
_context4.next = 11;
|
|
512
514
|
break;
|
|
513
|
-
case
|
|
514
|
-
_context4.prev =
|
|
515
|
-
|
|
516
|
-
if (
|
|
515
|
+
case 10:
|
|
516
|
+
_context4.prev = 10;
|
|
517
|
+
_t5 = _context4["catch"](8);
|
|
518
|
+
if (_t5.message && _t5.message.includes("ERR_TOO_MANY_REDIRECTS")) {
|
|
517
519
|
console.error("Redirect loop detected when trying to read metadata.");
|
|
518
520
|
status.state = "unavailable";
|
|
519
521
|
} else {
|
|
520
|
-
console.error("Unable to read edge write token metadata. Has token been deleted?",
|
|
522
|
+
console.error("Unable to read edge write token metadata. Has token been deleted?", _t5);
|
|
521
523
|
status.state = "inactive";
|
|
522
524
|
}
|
|
523
525
|
return _context4.abrupt("return", status);
|
|
524
|
-
case
|
|
526
|
+
case 11:
|
|
525
527
|
status.edge_meta_size = JSON.stringify(edgeMeta || "").length;
|
|
526
528
|
|
|
527
529
|
// If a stream has never been started return state 'inactive'
|
|
528
530
|
if (!(edgeMeta.live_recording === undefined || edgeMeta.live_recording.recordings === undefined || edgeMeta.live_recording.recordings.recording_sequence === undefined)) {
|
|
529
|
-
_context4.next =
|
|
531
|
+
_context4.next = 12;
|
|
530
532
|
break;
|
|
531
533
|
}
|
|
532
534
|
status.state = "stopped";
|
|
533
535
|
return _context4.abrupt("return", status);
|
|
534
|
-
case
|
|
536
|
+
case 12:
|
|
535
537
|
recordings = edgeMeta.live_recording.recordings;
|
|
536
538
|
status.recording_period_sequence = recordings.recording_sequence;
|
|
537
539
|
sequence = recordings.recording_sequence;
|
|
@@ -557,14 +559,14 @@ exports.StreamStatus = /*#__PURE__*/function () {
|
|
|
557
559
|
video_since_last_finalize_sec: sinceLastFinalize
|
|
558
560
|
};
|
|
559
561
|
status.recording_period = recording_period;
|
|
560
|
-
_context4.next =
|
|
562
|
+
_context4.next = 13;
|
|
561
563
|
return this.FabricUrl({
|
|
562
564
|
libraryId: libraryId,
|
|
563
565
|
objectId: objectId,
|
|
564
566
|
writeToken: edgeWriteToken,
|
|
565
567
|
call: "live/status/" + tlro
|
|
566
568
|
});
|
|
567
|
-
case
|
|
569
|
+
case 13:
|
|
568
570
|
status.lro_status_url = _context4.sent;
|
|
569
571
|
status.insertions = [];
|
|
570
572
|
if (edgeMeta.live_recording.playout_config.interleaves != undefined && edgeMeta.live_recording.playout_config.interleaves[sequence] != undefined) {
|
|
@@ -584,15 +586,15 @@ exports.StreamStatus = /*#__PURE__*/function () {
|
|
|
584
586
|
}
|
|
585
587
|
state = "stopped";
|
|
586
588
|
lroStatus = "";
|
|
587
|
-
_context4.prev =
|
|
588
|
-
|
|
589
|
-
_context4.next =
|
|
589
|
+
_context4.prev = 14;
|
|
590
|
+
_t6 = this.utils;
|
|
591
|
+
_context4.next = 15;
|
|
590
592
|
return HttpClient.Fetch(status.lro_status_url);
|
|
591
|
-
case
|
|
592
|
-
|
|
593
|
-
_context4.next =
|
|
594
|
-
return
|
|
595
|
-
case
|
|
593
|
+
case 15:
|
|
594
|
+
_t7 = _context4.sent;
|
|
595
|
+
_context4.next = 16;
|
|
596
|
+
return _t6.ResponseToJson.call(_t6, _t7);
|
|
597
|
+
case 16:
|
|
596
598
|
lroStatus = _context4.sent;
|
|
597
599
|
state = lroStatus.state;
|
|
598
600
|
status.warnings = lroStatus.custom && lroStatus.custom.warnings;
|
|
@@ -600,16 +602,16 @@ exports.StreamStatus = /*#__PURE__*/function () {
|
|
|
600
602
|
if (lroStatus.custom && lroStatus.custom.status) {
|
|
601
603
|
status.recording_status = lroStatus.custom.status;
|
|
602
604
|
}
|
|
603
|
-
_context4.next =
|
|
605
|
+
_context4.next = 18;
|
|
604
606
|
break;
|
|
605
|
-
case
|
|
606
|
-
_context4.prev =
|
|
607
|
-
|
|
608
|
-
console.log("LRO Status (failed): ",
|
|
607
|
+
case 17:
|
|
608
|
+
_context4.prev = 17;
|
|
609
|
+
_t8 = _context4["catch"](14);
|
|
610
|
+
console.log("LRO Status (failed): ", _t8.response.statusCode);
|
|
609
611
|
status.state = "stopped";
|
|
610
|
-
status.error =
|
|
612
|
+
status.error = _t8.response;
|
|
611
613
|
return _context4.abrupt("return", status);
|
|
612
|
-
case
|
|
614
|
+
case 18:
|
|
613
615
|
segDurationMeta = edgeMeta.live_recording.recording_config.recording_params.xc_params.seg_duration; // Convert LRO 'state' to desired 'state'
|
|
614
616
|
if (state === "running" && videoLastFinalizationTimeEpochSec <= 0) {
|
|
615
617
|
state = "starting";
|
|
@@ -620,97 +622,97 @@ exports.StreamStatus = /*#__PURE__*/function () {
|
|
|
620
622
|
}
|
|
621
623
|
status.state = state;
|
|
622
624
|
if (!((state === "running" || state === "stalled" || state === "starting") && stopLro)) {
|
|
623
|
-
_context4.next =
|
|
625
|
+
_context4.next = 25;
|
|
624
626
|
break;
|
|
625
627
|
}
|
|
626
|
-
_context4.next =
|
|
628
|
+
_context4.next = 19;
|
|
627
629
|
return this.FabricUrl({
|
|
628
630
|
libraryId: libraryId,
|
|
629
631
|
objectId: objectId,
|
|
630
632
|
writeToken: edgeWriteToken,
|
|
631
633
|
call: "live/stop/" + tlro
|
|
632
634
|
});
|
|
633
|
-
case
|
|
635
|
+
case 19:
|
|
634
636
|
lroStopUrl = _context4.sent;
|
|
635
|
-
_context4.prev =
|
|
636
|
-
|
|
637
|
-
_context4.next =
|
|
637
|
+
_context4.prev = 20;
|
|
638
|
+
_t9 = this.utils;
|
|
639
|
+
_context4.next = 21;
|
|
638
640
|
return HttpClient.Fetch(lroStopUrl);
|
|
639
|
-
case
|
|
640
|
-
|
|
641
|
-
_context4.next =
|
|
642
|
-
return
|
|
643
|
-
case
|
|
641
|
+
case 21:
|
|
642
|
+
_t0 = _context4.sent;
|
|
643
|
+
_context4.next = 22;
|
|
644
|
+
return _t9.ResponseToJson.call(_t9, _t0);
|
|
645
|
+
case 22:
|
|
644
646
|
console.log("LRO Stop: ", lroStatus.body);
|
|
645
|
-
_context4.next =
|
|
647
|
+
_context4.next = 24;
|
|
646
648
|
break;
|
|
647
|
-
case
|
|
648
|
-
_context4.prev =
|
|
649
|
-
|
|
650
|
-
console.log("LRO Stop (failed): ",
|
|
651
|
-
case
|
|
649
|
+
case 23:
|
|
650
|
+
_context4.prev = 23;
|
|
651
|
+
_t1 = _context4["catch"](20);
|
|
652
|
+
console.log("LRO Stop (failed): ", _t1.response.statusCode);
|
|
653
|
+
case 24:
|
|
652
654
|
state = "stopped";
|
|
653
655
|
status.state = state;
|
|
654
|
-
case
|
|
656
|
+
case 25:
|
|
655
657
|
if (!(state === "running")) {
|
|
656
|
-
_context4.next =
|
|
658
|
+
_context4.next = 35;
|
|
657
659
|
break;
|
|
658
660
|
}
|
|
659
661
|
playout_urls = {};
|
|
660
|
-
_context4.next =
|
|
662
|
+
_context4.next = 26;
|
|
661
663
|
return this.PlayoutOptions({
|
|
662
664
|
objectId: objectId,
|
|
663
665
|
linkPath: "public/asset_metadata/sources/default"
|
|
664
666
|
});
|
|
665
|
-
case
|
|
667
|
+
case 26:
|
|
666
668
|
playout_options = _context4.sent;
|
|
667
669
|
hls_clear_enabled = playout_options && playout_options.hls && playout_options.hls.playoutMethods && playout_options.hls.playoutMethods.clear !== undefined;
|
|
668
670
|
if (!hls_clear_enabled) {
|
|
669
|
-
_context4.next =
|
|
671
|
+
_context4.next = 28;
|
|
670
672
|
break;
|
|
671
673
|
}
|
|
672
|
-
_context4.next =
|
|
674
|
+
_context4.next = 27;
|
|
673
675
|
return this.FabricUrl({
|
|
674
676
|
libraryId: libraryId,
|
|
675
677
|
objectId: objectId,
|
|
676
678
|
rep: "playout/default/hls-clear/playlist.m3u8"
|
|
677
679
|
});
|
|
678
|
-
case
|
|
680
|
+
case 27:
|
|
679
681
|
playout_urls.hls_clear = _context4.sent;
|
|
680
|
-
case
|
|
682
|
+
case 28:
|
|
681
683
|
hls_aes128_enabled = playout_options && playout_options.hls && playout_options.hls.playoutMethods && playout_options.hls.playoutMethods["aes-128"] !== undefined;
|
|
682
684
|
if (!hls_aes128_enabled) {
|
|
683
|
-
_context4.next =
|
|
685
|
+
_context4.next = 30;
|
|
684
686
|
break;
|
|
685
687
|
}
|
|
686
|
-
_context4.next =
|
|
688
|
+
_context4.next = 29;
|
|
687
689
|
return this.FabricUrl({
|
|
688
690
|
libraryId: libraryId,
|
|
689
691
|
objectId: objectId,
|
|
690
692
|
rep: "playout/default/hls-aes128/playlist.m3u8"
|
|
691
693
|
});
|
|
692
|
-
case
|
|
694
|
+
case 29:
|
|
693
695
|
playout_urls.hls_aes128 = _context4.sent;
|
|
694
|
-
case
|
|
696
|
+
case 30:
|
|
695
697
|
hls_sample_aes_enabled = playout_options && playout_options.hls && playout_options.hls.playoutMethods && playout_options.hls.playoutMethods["sample-aes"] !== undefined;
|
|
696
698
|
if (!hls_sample_aes_enabled) {
|
|
697
|
-
_context4.next =
|
|
699
|
+
_context4.next = 32;
|
|
698
700
|
break;
|
|
699
701
|
}
|
|
700
|
-
_context4.next =
|
|
702
|
+
_context4.next = 31;
|
|
701
703
|
return this.FabricUrl({
|
|
702
704
|
libraryId: libraryId,
|
|
703
705
|
objectId: objectId,
|
|
704
706
|
rep: "playout/default/hls-sample-aes/playlist.m3u8"
|
|
705
707
|
});
|
|
706
|
-
case
|
|
708
|
+
case 31:
|
|
707
709
|
playout_urls.hls_sample_aes = _context4.sent;
|
|
708
|
-
case
|
|
709
|
-
_context4.next =
|
|
710
|
+
case 32:
|
|
711
|
+
_context4.next = 33;
|
|
710
712
|
return this.NetworkInfo();
|
|
711
|
-
case
|
|
713
|
+
case 33:
|
|
712
714
|
networkInfo = _context4.sent;
|
|
713
|
-
_context4.next =
|
|
715
|
+
_context4.next = 34;
|
|
714
716
|
return this.authClient.AuthorizationToken({
|
|
715
717
|
libraryId: libraryId,
|
|
716
718
|
objectId: objectId,
|
|
@@ -718,7 +720,7 @@ exports.StreamStatus = /*#__PURE__*/function () {
|
|
|
718
720
|
noCache: true,
|
|
719
721
|
noAuth: true
|
|
720
722
|
});
|
|
721
|
-
case
|
|
723
|
+
case 34:
|
|
722
724
|
token = _context4.sent;
|
|
723
725
|
embed_net = "main";
|
|
724
726
|
if (networkInfo.name.includes("demo")) {
|
|
@@ -727,20 +729,20 @@ exports.StreamStatus = /*#__PURE__*/function () {
|
|
|
727
729
|
embed_url = "https://embed.v3.contentfabric.io/?net=".concat(embed_net, "&p&ct=h&oid=").concat(objectId, "&mt=lv&ath=").concat(token);
|
|
728
730
|
playout_urls.embed_url = embed_url;
|
|
729
731
|
status.playout_urls = playout_urls;
|
|
730
|
-
case
|
|
731
|
-
_context4.next =
|
|
732
|
+
case 35:
|
|
733
|
+
_context4.next = 37;
|
|
732
734
|
break;
|
|
733
|
-
case
|
|
734
|
-
_context4.prev =
|
|
735
|
-
|
|
736
|
-
console.error(
|
|
737
|
-
case
|
|
735
|
+
case 36:
|
|
736
|
+
_context4.prev = 36;
|
|
737
|
+
_t10 = _context4["catch"](1);
|
|
738
|
+
console.error(_t10);
|
|
739
|
+
case 37:
|
|
738
740
|
return _context4.abrupt("return", status);
|
|
739
|
-
case
|
|
741
|
+
case 38:
|
|
740
742
|
case "end":
|
|
741
743
|
return _context4.stop();
|
|
742
744
|
}
|
|
743
|
-
}, _callee4, this, [[
|
|
745
|
+
}, _callee4, this, [[1, 36], [8, 10], [14, 17], [20, 23]]);
|
|
744
746
|
}));
|
|
745
747
|
return function (_x4) {
|
|
746
748
|
return _ref8.apply(this, arguments);
|
|
@@ -759,42 +761,42 @@ exports.StreamStatus = /*#__PURE__*/function () {
|
|
|
759
761
|
*
|
|
760
762
|
*/
|
|
761
763
|
exports.StreamCreate = /*#__PURE__*/function () {
|
|
762
|
-
var
|
|
764
|
+
var _ref0 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref9) {
|
|
763
765
|
var name, _ref9$start, start, status, objectId, libraryId, liveRecording, fabURI, response, edgeToken, writeToken, objectHash;
|
|
764
|
-
return _regeneratorRuntime.wrap(function
|
|
766
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
765
767
|
while (1) switch (_context5.prev = _context5.next) {
|
|
766
768
|
case 0:
|
|
767
769
|
name = _ref9.name, _ref9$start = _ref9.start, start = _ref9$start === void 0 ? false : _ref9$start;
|
|
768
|
-
_context5.next =
|
|
770
|
+
_context5.next = 1;
|
|
769
771
|
return this.StreamStatus({
|
|
770
772
|
name: name
|
|
771
773
|
});
|
|
772
|
-
case
|
|
774
|
+
case 1:
|
|
773
775
|
status = _context5.sent;
|
|
774
776
|
if (!(status.state != "uninitialized" && status.state !== "inactive" && status.state !== "terminated" && status.state !== "stopped")) {
|
|
775
|
-
_context5.next =
|
|
777
|
+
_context5.next = 2;
|
|
776
778
|
break;
|
|
777
779
|
}
|
|
778
780
|
return _context5.abrupt("return", {
|
|
779
781
|
state: status.state,
|
|
780
782
|
error: "stream still active - must terminate first"
|
|
781
783
|
});
|
|
782
|
-
case
|
|
784
|
+
case 2:
|
|
783
785
|
objectId = status.object_id;
|
|
784
786
|
console.log("START: ", name, "start", start);
|
|
785
|
-
_context5.next =
|
|
787
|
+
_context5.next = 3;
|
|
786
788
|
return this.ContentObjectLibraryId({
|
|
787
789
|
objectId: objectId
|
|
788
790
|
});
|
|
789
|
-
case
|
|
791
|
+
case 3:
|
|
790
792
|
libraryId = _context5.sent;
|
|
791
|
-
_context5.next =
|
|
793
|
+
_context5.next = 4;
|
|
792
794
|
return this.ContentObjectMetadata({
|
|
793
795
|
libraryId: libraryId,
|
|
794
796
|
objectId: objectId,
|
|
795
797
|
metadataSubtree: "/live_recording"
|
|
796
798
|
});
|
|
797
|
-
case
|
|
799
|
+
case 4:
|
|
798
800
|
liveRecording = _context5.sent;
|
|
799
801
|
fabURI = liveRecording.fabric_config.ingress_node_api; // Support both hostname and URL ingress_node_api
|
|
800
802
|
if (!fabURI.startsWith("http")) {
|
|
@@ -805,12 +807,12 @@ exports.StreamCreate = /*#__PURE__*/function () {
|
|
|
805
807
|
fabricURIs: [fabURI]
|
|
806
808
|
});
|
|
807
809
|
console.log("Node URI", fabURI, "ID", liveRecording.fabric_config.ingress_node_id);
|
|
808
|
-
_context5.next =
|
|
810
|
+
_context5.next = 5;
|
|
809
811
|
return this.EditContentObject({
|
|
810
812
|
libraryId: libraryId,
|
|
811
813
|
objectId: objectId
|
|
812
814
|
});
|
|
813
|
-
case
|
|
815
|
+
case 5:
|
|
814
816
|
response = _context5.sent;
|
|
815
817
|
edgeToken = response.write_token;
|
|
816
818
|
console.log("Edge token:", edgeToken);
|
|
@@ -818,16 +820,16 @@ exports.StreamCreate = /*#__PURE__*/function () {
|
|
|
818
820
|
/*
|
|
819
821
|
* Set the metadata, including the edge token.
|
|
820
822
|
*/
|
|
821
|
-
_context5.next =
|
|
823
|
+
_context5.next = 6;
|
|
822
824
|
return this.EditContentObject({
|
|
823
825
|
libraryId: libraryId,
|
|
824
826
|
objectId: objectId
|
|
825
827
|
});
|
|
826
|
-
case
|
|
828
|
+
case 6:
|
|
827
829
|
response = _context5.sent;
|
|
828
830
|
writeToken = response.write_token;
|
|
829
831
|
this.Log("Merging metadata: ", libraryId, objectId, writeToken);
|
|
830
|
-
_context5.next =
|
|
832
|
+
_context5.next = 7;
|
|
831
833
|
return this.MergeMetadata({
|
|
832
834
|
libraryId: libraryId,
|
|
833
835
|
objectId: objectId,
|
|
@@ -838,23 +840,22 @@ exports.StreamCreate = /*#__PURE__*/function () {
|
|
|
838
840
|
edge_write_token: edgeToken,
|
|
839
841
|
state: "active" // indicates there is an active session (set to 'closed' when done)
|
|
840
842
|
},
|
|
841
|
-
|
|
842
843
|
fabric_config: {
|
|
843
844
|
edge_write_token: edgeToken
|
|
844
845
|
}
|
|
845
846
|
}
|
|
846
847
|
}
|
|
847
848
|
});
|
|
848
|
-
case
|
|
849
|
+
case 7:
|
|
849
850
|
this.Log("Finalizing content draft: ", libraryId, objectId, writeToken);
|
|
850
|
-
_context5.next =
|
|
851
|
+
_context5.next = 8;
|
|
851
852
|
return this.FinalizeContentObject({
|
|
852
853
|
libraryId: libraryId,
|
|
853
854
|
objectId: objectId,
|
|
854
855
|
writeToken: writeToken,
|
|
855
856
|
commitMessage: "Create stream edge write token " + edgeToken
|
|
856
857
|
});
|
|
857
|
-
case
|
|
858
|
+
case 8:
|
|
858
859
|
response = _context5.sent;
|
|
859
860
|
objectHash = response.hash;
|
|
860
861
|
this.Log("Finalized object: ", objectHash);
|
|
@@ -874,14 +875,14 @@ exports.StreamCreate = /*#__PURE__*/function () {
|
|
|
874
875
|
});
|
|
875
876
|
}
|
|
876
877
|
return _context5.abrupt("return", status);
|
|
877
|
-
case
|
|
878
|
+
case 9:
|
|
878
879
|
case "end":
|
|
879
880
|
return _context5.stop();
|
|
880
881
|
}
|
|
881
882
|
}, _callee5, this);
|
|
882
883
|
}));
|
|
883
884
|
return function (_x5) {
|
|
884
|
-
return
|
|
885
|
+
return _ref0.apply(this, arguments);
|
|
885
886
|
};
|
|
886
887
|
}();
|
|
887
888
|
|
|
@@ -902,36 +903,36 @@ exports.StreamCreate = /*#__PURE__*/function () {
|
|
|
902
903
|
*
|
|
903
904
|
*/
|
|
904
905
|
exports.StreamStartOrStopOrReset = /*#__PURE__*/function () {
|
|
905
|
-
var
|
|
906
|
-
var name, op, status, _tries, tries;
|
|
907
|
-
return _regeneratorRuntime.wrap(function
|
|
906
|
+
var _ref10 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref1) {
|
|
907
|
+
var name, op, status, _tries, tries, _t11, _t12, _t13;
|
|
908
|
+
return _regeneratorRuntime.wrap(function (_context6) {
|
|
908
909
|
while (1) switch (_context6.prev = _context6.next) {
|
|
909
910
|
case 0:
|
|
910
|
-
name =
|
|
911
|
+
name = _ref1.name, op = _ref1.op;
|
|
911
912
|
_context6.prev = 1;
|
|
912
|
-
_context6.next =
|
|
913
|
+
_context6.next = 2;
|
|
913
914
|
return this.StreamStatus({
|
|
914
915
|
name: name
|
|
915
916
|
});
|
|
916
|
-
case
|
|
917
|
+
case 2:
|
|
917
918
|
status = _context6.sent;
|
|
918
919
|
if (!(status.state != "stopped")) {
|
|
919
|
-
_context6.next =
|
|
920
|
+
_context6.next = 3;
|
|
920
921
|
break;
|
|
921
922
|
}
|
|
922
923
|
if (!(op === "start")) {
|
|
923
|
-
_context6.next =
|
|
924
|
+
_context6.next = 3;
|
|
924
925
|
break;
|
|
925
926
|
}
|
|
926
927
|
status.error = "Unable to start stream - state: " + status.state;
|
|
927
928
|
return _context6.abrupt("return", status);
|
|
928
|
-
case
|
|
929
|
+
case 3:
|
|
929
930
|
if (!(status.state == "running" || status.state == "starting" || status.state == "stalled")) {
|
|
930
|
-
_context6.next =
|
|
931
|
+
_context6.next = 12;
|
|
931
932
|
break;
|
|
932
933
|
}
|
|
933
|
-
_context6.prev =
|
|
934
|
-
_context6.next =
|
|
934
|
+
_context6.prev = 4;
|
|
935
|
+
_context6.next = 5;
|
|
935
936
|
return this.CallBitcodeMethod({
|
|
936
937
|
libraryId: status.library_id,
|
|
937
938
|
objectId: status.object_id,
|
|
@@ -939,50 +940,50 @@ exports.StreamStartOrStopOrReset = /*#__PURE__*/function () {
|
|
|
939
940
|
method: "/live/stop/" + status.tlro,
|
|
940
941
|
constant: false
|
|
941
942
|
});
|
|
942
|
-
case
|
|
943
|
-
_context6.next =
|
|
943
|
+
case 5:
|
|
944
|
+
_context6.next = 7;
|
|
944
945
|
break;
|
|
945
|
-
case
|
|
946
|
-
_context6.prev =
|
|
947
|
-
|
|
948
|
-
case
|
|
946
|
+
case 6:
|
|
947
|
+
_context6.prev = 6;
|
|
948
|
+
_t11 = _context6["catch"](4);
|
|
949
|
+
case 7:
|
|
949
950
|
// Wait until LRO is terminated
|
|
950
951
|
_tries = 10;
|
|
951
|
-
case
|
|
952
|
+
case 8:
|
|
952
953
|
if (!(status.state != "stopped" && _tries-- > 0)) {
|
|
953
|
-
_context6.next =
|
|
954
|
+
_context6.next = 11;
|
|
954
955
|
break;
|
|
955
956
|
}
|
|
956
957
|
console.log("Wait to terminate - ", status.state);
|
|
957
|
-
_context6.next =
|
|
958
|
+
_context6.next = 9;
|
|
958
959
|
return Sleep(1000);
|
|
959
|
-
case
|
|
960
|
-
_context6.next =
|
|
960
|
+
case 9:
|
|
961
|
+
_context6.next = 10;
|
|
961
962
|
return this.StreamStatus({
|
|
962
963
|
name: name
|
|
963
964
|
});
|
|
964
|
-
case
|
|
965
|
+
case 10:
|
|
965
966
|
status = _context6.sent;
|
|
966
|
-
_context6.next =
|
|
967
|
+
_context6.next = 8;
|
|
967
968
|
break;
|
|
968
|
-
case
|
|
969
|
+
case 11:
|
|
969
970
|
console.log("Status after stop - ", status.state);
|
|
970
971
|
if (!(_tries <= 0)) {
|
|
971
|
-
_context6.next =
|
|
972
|
+
_context6.next = 12;
|
|
972
973
|
break;
|
|
973
974
|
}
|
|
974
975
|
console.log("Failed to stop");
|
|
975
976
|
return _context6.abrupt("return", status);
|
|
976
|
-
case
|
|
977
|
+
case 12:
|
|
977
978
|
if (!(op === "stop")) {
|
|
978
|
-
_context6.next =
|
|
979
|
+
_context6.next = 13;
|
|
979
980
|
break;
|
|
980
981
|
}
|
|
981
982
|
return _context6.abrupt("return", status);
|
|
982
|
-
case
|
|
983
|
+
case 13:
|
|
983
984
|
console.log("STARTING", "edge_write_token", status.edge_write_token);
|
|
984
|
-
_context6.prev =
|
|
985
|
-
_context6.next =
|
|
985
|
+
_context6.prev = 14;
|
|
986
|
+
_context6.next = 15;
|
|
986
987
|
return this.CallBitcodeMethod({
|
|
987
988
|
libraryId: status.library_id,
|
|
988
989
|
objectId: status.object_id,
|
|
@@ -990,52 +991,52 @@ exports.StreamStartOrStopOrReset = /*#__PURE__*/function () {
|
|
|
990
991
|
method: "/live/start",
|
|
991
992
|
constant: false
|
|
992
993
|
});
|
|
993
|
-
case
|
|
994
|
-
_context6.next =
|
|
994
|
+
case 15:
|
|
995
|
+
_context6.next = 17;
|
|
995
996
|
break;
|
|
996
|
-
case
|
|
997
|
-
_context6.prev =
|
|
998
|
-
|
|
999
|
-
console.log("LRO Start (failed): ",
|
|
997
|
+
case 16:
|
|
998
|
+
_context6.prev = 16;
|
|
999
|
+
_t12 = _context6["catch"](14);
|
|
1000
|
+
console.log("LRO Start (failed): ", _t12);
|
|
1000
1001
|
return _context6.abrupt("return", {
|
|
1001
1002
|
state: status.state,
|
|
1002
1003
|
error: "LRO start failed - must create a stream first"
|
|
1003
1004
|
});
|
|
1004
|
-
case
|
|
1005
|
+
case 17:
|
|
1005
1006
|
// Wait until LRO is 'starting'
|
|
1006
1007
|
tries = 10;
|
|
1007
|
-
case
|
|
1008
|
+
case 18:
|
|
1008
1009
|
if (!(status.state != "starting" && tries-- > 0)) {
|
|
1009
|
-
_context6.next =
|
|
1010
|
+
_context6.next = 21;
|
|
1010
1011
|
break;
|
|
1011
1012
|
}
|
|
1012
1013
|
console.log("Wait to start - ", status.state);
|
|
1013
|
-
_context6.next =
|
|
1014
|
+
_context6.next = 19;
|
|
1014
1015
|
return Sleep(1000);
|
|
1015
|
-
case
|
|
1016
|
-
_context6.next =
|
|
1016
|
+
case 19:
|
|
1017
|
+
_context6.next = 20;
|
|
1017
1018
|
return this.StreamStatus({
|
|
1018
1019
|
name: name
|
|
1019
1020
|
});
|
|
1020
|
-
case
|
|
1021
|
+
case 20:
|
|
1021
1022
|
status = _context6.sent;
|
|
1022
|
-
_context6.next =
|
|
1023
|
+
_context6.next = 18;
|
|
1023
1024
|
break;
|
|
1024
|
-
case
|
|
1025
|
+
case 21:
|
|
1025
1026
|
console.log("Status after restart - ", status.state);
|
|
1026
1027
|
return _context6.abrupt("return", status);
|
|
1027
|
-
case
|
|
1028
|
-
_context6.prev =
|
|
1029
|
-
|
|
1030
|
-
console.error(
|
|
1031
|
-
case
|
|
1028
|
+
case 22:
|
|
1029
|
+
_context6.prev = 22;
|
|
1030
|
+
_t13 = _context6["catch"](1);
|
|
1031
|
+
console.error(_t13);
|
|
1032
|
+
case 23:
|
|
1032
1033
|
case "end":
|
|
1033
1034
|
return _context6.stop();
|
|
1034
1035
|
}
|
|
1035
|
-
}, _callee6, this, [[1,
|
|
1036
|
+
}, _callee6, this, [[1, 22], [4, 6], [14, 16]]);
|
|
1036
1037
|
}));
|
|
1037
1038
|
return function (_x6) {
|
|
1038
|
-
return
|
|
1039
|
+
return _ref10.apply(this, arguments);
|
|
1039
1040
|
};
|
|
1040
1041
|
}();
|
|
1041
1042
|
|
|
@@ -1049,27 +1050,27 @@ exports.StreamStartOrStopOrReset = /*#__PURE__*/function () {
|
|
|
1049
1050
|
* @return {Promise<Object>} - The finalize response for the stream object
|
|
1050
1051
|
*/
|
|
1051
1052
|
exports.StreamStopSession = /*#__PURE__*/function () {
|
|
1052
|
-
var
|
|
1053
|
-
var name, objectId, libraryId, mainMeta, fabURI, metaEdgeWriteToken, streamMetadata, status, _yield$this$EditConte, writeToken, newState, stopTime, finalizeMetadata, fin;
|
|
1054
|
-
return _regeneratorRuntime.wrap(function
|
|
1053
|
+
var _ref12 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref11) {
|
|
1054
|
+
var name, objectId, libraryId, mainMeta, fabURI, metaEdgeWriteToken, streamMetadata, status, _yield$this$EditConte, writeToken, newState, stopTime, finalizeMetadata, fin, _t14, _t15;
|
|
1055
|
+
return _regeneratorRuntime.wrap(function (_context7) {
|
|
1055
1056
|
while (1) switch (_context7.prev = _context7.next) {
|
|
1056
1057
|
case 0:
|
|
1057
|
-
name =
|
|
1058
|
+
name = _ref11.name;
|
|
1058
1059
|
_context7.prev = 1;
|
|
1059
1060
|
this.Log("Terminating stream session for: ".concat(name));
|
|
1060
1061
|
objectId = name;
|
|
1061
|
-
_context7.next =
|
|
1062
|
+
_context7.next = 2;
|
|
1062
1063
|
return this.ContentObjectLibraryId({
|
|
1063
1064
|
objectId: objectId
|
|
1064
1065
|
});
|
|
1065
|
-
case
|
|
1066
|
+
case 2:
|
|
1066
1067
|
libraryId = _context7.sent;
|
|
1067
|
-
_context7.next =
|
|
1068
|
+
_context7.next = 3;
|
|
1068
1069
|
return this.ContentObjectMetadata({
|
|
1069
1070
|
libraryId: libraryId,
|
|
1070
1071
|
objectId: objectId
|
|
1071
1072
|
});
|
|
1072
|
-
case
|
|
1073
|
+
case 3:
|
|
1073
1074
|
mainMeta = _context7.sent;
|
|
1074
1075
|
fabURI = mainMeta.live_recording.fabric_config.ingress_node_api; // Support both hostname and URL ingress_node_api
|
|
1075
1076
|
if (!fabURI.startsWith("http")) {
|
|
@@ -1081,56 +1082,56 @@ exports.StreamStopSession = /*#__PURE__*/function () {
|
|
|
1081
1082
|
});
|
|
1082
1083
|
metaEdgeWriteToken = mainMeta.live_recording.fabric_config.edge_write_token;
|
|
1083
1084
|
if (metaEdgeWriteToken) {
|
|
1084
|
-
_context7.next =
|
|
1085
|
+
_context7.next = 4;
|
|
1085
1086
|
break;
|
|
1086
1087
|
}
|
|
1087
1088
|
return _context7.abrupt("return", {
|
|
1088
1089
|
state: "inactive",
|
|
1089
1090
|
error: "The stream is not active"
|
|
1090
1091
|
});
|
|
1091
|
-
case
|
|
1092
|
-
_context7.prev =
|
|
1093
|
-
_context7.next =
|
|
1092
|
+
case 4:
|
|
1093
|
+
_context7.prev = 4;
|
|
1094
|
+
_context7.next = 5;
|
|
1094
1095
|
return this.ContentObjectMetadata({
|
|
1095
1096
|
libraryId: libraryId,
|
|
1096
1097
|
objectId: objectId,
|
|
1097
1098
|
writeToken: metaEdgeWriteToken
|
|
1098
1099
|
});
|
|
1099
|
-
case
|
|
1100
|
+
case 5:
|
|
1100
1101
|
streamMetadata = _context7.sent;
|
|
1101
|
-
_context7.next =
|
|
1102
|
+
_context7.next = 6;
|
|
1102
1103
|
return this.StreamStatus({
|
|
1103
1104
|
name: name
|
|
1104
1105
|
});
|
|
1105
|
-
case
|
|
1106
|
+
case 6:
|
|
1106
1107
|
status = _context7.sent;
|
|
1107
1108
|
if (!(status.state !== "stopped")) {
|
|
1108
|
-
_context7.next =
|
|
1109
|
+
_context7.next = 7;
|
|
1109
1110
|
break;
|
|
1110
1111
|
}
|
|
1111
1112
|
return _context7.abrupt("return", {
|
|
1112
1113
|
state: status.state,
|
|
1113
1114
|
error: "The stream must be stopped before terminating"
|
|
1114
1115
|
});
|
|
1115
|
-
case
|
|
1116
|
-
_context7.next =
|
|
1116
|
+
case 7:
|
|
1117
|
+
_context7.next = 8;
|
|
1117
1118
|
return this.DeleteWriteToken({
|
|
1118
1119
|
writeToken: metaEdgeWriteToken
|
|
1119
1120
|
});
|
|
1120
|
-
case
|
|
1121
|
-
_context7.next =
|
|
1121
|
+
case 8:
|
|
1122
|
+
_context7.next = 10;
|
|
1122
1123
|
break;
|
|
1123
|
-
case
|
|
1124
|
-
_context7.prev =
|
|
1125
|
-
|
|
1124
|
+
case 9:
|
|
1125
|
+
_context7.prev = 9;
|
|
1126
|
+
_t14 = _context7["catch"](4);
|
|
1126
1127
|
this.Log("Unable to retrieve metadata for edge write token");
|
|
1127
|
-
case
|
|
1128
|
-
_context7.next =
|
|
1128
|
+
case 10:
|
|
1129
|
+
_context7.next = 11;
|
|
1129
1130
|
return this.EditContentObject({
|
|
1130
1131
|
libraryId: libraryId,
|
|
1131
1132
|
objectId: objectId
|
|
1132
1133
|
});
|
|
1133
|
-
case
|
|
1134
|
+
case 11:
|
|
1134
1135
|
_yield$this$EditConte = _context7.sent;
|
|
1135
1136
|
writeToken = _yield$this$EditConte.writeToken;
|
|
1136
1137
|
// Set stop time and inactive state
|
|
@@ -1148,40 +1149,40 @@ exports.StreamStopSession = /*#__PURE__*/function () {
|
|
|
1148
1149
|
}
|
|
1149
1150
|
}
|
|
1150
1151
|
};
|
|
1151
|
-
_context7.next =
|
|
1152
|
+
_context7.next = 12;
|
|
1152
1153
|
return this.MergeMetadata({
|
|
1153
1154
|
libraryId: libraryId,
|
|
1154
1155
|
objectId: objectId,
|
|
1155
1156
|
writeToken: writeToken,
|
|
1156
1157
|
metadata: finalizeMetadata
|
|
1157
1158
|
});
|
|
1158
|
-
case
|
|
1159
|
-
_context7.next =
|
|
1159
|
+
case 12:
|
|
1160
|
+
_context7.next = 13;
|
|
1160
1161
|
return this.FinalizeContentObject({
|
|
1161
1162
|
libraryId: libraryId,
|
|
1162
1163
|
objectId: objectId,
|
|
1163
1164
|
writeToken: writeToken,
|
|
1164
1165
|
commitMessage: "Deactivate live stream - stop time ".concat(stopTime)
|
|
1165
1166
|
});
|
|
1166
|
-
case
|
|
1167
|
+
case 13:
|
|
1167
1168
|
fin = _context7.sent;
|
|
1168
1169
|
return _context7.abrupt("return", {
|
|
1169
1170
|
fin: fin,
|
|
1170
1171
|
name: name,
|
|
1171
1172
|
state: newState
|
|
1172
1173
|
});
|
|
1173
|
-
case
|
|
1174
|
-
_context7.prev =
|
|
1175
|
-
|
|
1176
|
-
console.error(
|
|
1177
|
-
case
|
|
1174
|
+
case 14:
|
|
1175
|
+
_context7.prev = 14;
|
|
1176
|
+
_t15 = _context7["catch"](1);
|
|
1177
|
+
console.error(_t15);
|
|
1178
|
+
case 15:
|
|
1178
1179
|
case "end":
|
|
1179
1180
|
return _context7.stop();
|
|
1180
1181
|
}
|
|
1181
|
-
}, _callee7, this, [[1,
|
|
1182
|
+
}, _callee7, this, [[1, 14], [4, 9]]);
|
|
1182
1183
|
}));
|
|
1183
1184
|
return function (_x7) {
|
|
1184
|
-
return
|
|
1185
|
+
return _ref12.apply(this, arguments);
|
|
1185
1186
|
};
|
|
1186
1187
|
}();
|
|
1187
1188
|
|
|
@@ -1195,30 +1196,28 @@ exports.StreamStopSession = /*#__PURE__*/function () {
|
|
|
1195
1196
|
* @param {string=} format - Specify the list of playout formats and DRM to support,
|
|
1196
1197
|
comma-separated (hls-clear, hls-aes128, hls-sample-aes,
|
|
1197
1198
|
hls-fairplay)
|
|
1198
|
-
* @param {string=} writeToken - Write token of the draft
|
|
1199
|
-
* @param {boolean=} finalize - If enabled, target object will be finalized after configuration
|
|
1200
1199
|
*
|
|
1201
1200
|
* @return {Promise<Object>} - The name, object ID, and state of the stream
|
|
1202
1201
|
*/
|
|
1203
1202
|
exports.StreamInitialize = /*#__PURE__*/function () {
|
|
1204
|
-
var
|
|
1205
|
-
var name,
|
|
1206
|
-
return _regeneratorRuntime.wrap(function
|
|
1203
|
+
var _ref14 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref13) {
|
|
1204
|
+
var name, _ref13$drm, drm, format, typeAbrMaster, typeLiveStream, tenantContractId, _yield$this$ContentOb, live_stream, title, res;
|
|
1205
|
+
return _regeneratorRuntime.wrap(function (_context8) {
|
|
1207
1206
|
while (1) switch (_context8.prev = _context8.next) {
|
|
1208
1207
|
case 0:
|
|
1209
|
-
name =
|
|
1210
|
-
_context8.next =
|
|
1208
|
+
name = _ref13.name, _ref13$drm = _ref13.drm, drm = _ref13$drm === void 0 ? false : _ref13$drm, format = _ref13.format;
|
|
1209
|
+
_context8.next = 1;
|
|
1211
1210
|
return this.userProfileClient.TenantContractId();
|
|
1212
|
-
case
|
|
1211
|
+
case 1:
|
|
1213
1212
|
tenantContractId = _context8.sent;
|
|
1214
|
-
_context8.next =
|
|
1213
|
+
_context8.next = 2;
|
|
1215
1214
|
return this.ContentObjectMetadata({
|
|
1216
1215
|
libraryId: tenantContractId.replace("iten", "ilib"),
|
|
1217
1216
|
objectId: tenantContractId.replace("iten", "iq__"),
|
|
1218
1217
|
metadataSubtree: "public/content_types",
|
|
1219
1218
|
select: ["live_stream", "title"]
|
|
1220
1219
|
});
|
|
1221
|
-
case
|
|
1220
|
+
case 2:
|
|
1222
1221
|
_yield$this$ContentOb = _context8.sent;
|
|
1223
1222
|
live_stream = _yield$this$ContentOb.live_stream;
|
|
1224
1223
|
title = _yield$this$ContentOb.title;
|
|
@@ -1229,33 +1228,31 @@ exports.StreamInitialize = /*#__PURE__*/function () {
|
|
|
1229
1228
|
typeAbrMaster = title;
|
|
1230
1229
|
}
|
|
1231
1230
|
if (!(typeAbrMaster === undefined || typeLiveStream === undefined)) {
|
|
1232
|
-
_context8.next =
|
|
1231
|
+
_context8.next = 3;
|
|
1233
1232
|
break;
|
|
1234
1233
|
}
|
|
1235
1234
|
console.log("ERROR - unable to find content types", "ABR Master", typeAbrMaster, "Live Stream", typeLiveStream);
|
|
1236
1235
|
return _context8.abrupt("return", {});
|
|
1237
|
-
case
|
|
1238
|
-
_context8.next =
|
|
1236
|
+
case 3:
|
|
1237
|
+
_context8.next = 4;
|
|
1239
1238
|
return this.StreamSetOfferingAndDRM({
|
|
1240
1239
|
name: name,
|
|
1241
1240
|
typeAbrMaster: typeAbrMaster,
|
|
1242
1241
|
typeLiveStream: typeLiveStream,
|
|
1243
1242
|
drm: drm,
|
|
1244
|
-
format: format
|
|
1245
|
-
writeToken: writeToken,
|
|
1246
|
-
finalize: finalize
|
|
1243
|
+
format: format
|
|
1247
1244
|
});
|
|
1248
|
-
case
|
|
1245
|
+
case 4:
|
|
1249
1246
|
res = _context8.sent;
|
|
1250
1247
|
return _context8.abrupt("return", res);
|
|
1251
|
-
case
|
|
1248
|
+
case 5:
|
|
1252
1249
|
case "end":
|
|
1253
1250
|
return _context8.stop();
|
|
1254
1251
|
}
|
|
1255
1252
|
}, _callee8, this);
|
|
1256
1253
|
}));
|
|
1257
1254
|
return function (_x8) {
|
|
1258
|
-
return
|
|
1255
|
+
return _ref14.apply(this, arguments);
|
|
1259
1256
|
};
|
|
1260
1257
|
}();
|
|
1261
1258
|
|
|
@@ -1271,32 +1268,31 @@ exports.StreamInitialize = /*#__PURE__*/function () {
|
|
|
1271
1268
|
* @param {string=} format - A list of playout formats and DRM to support, comma-separated
|
|
1272
1269
|
* (hls-clear, hls-aes128, hls-sample-aes, hls-fairplay). If specified,
|
|
1273
1270
|
* this will take precedence over the drm value
|
|
1274
|
-
* @param {string=} writeToken - Write token of the draft
|
|
1275
1271
|
*
|
|
1276
1272
|
* @return {Promise<Object>} - The name, object ID, and state of the stream
|
|
1277
1273
|
*/
|
|
1278
1274
|
exports.StreamSetOfferingAndDRM = /*#__PURE__*/function () {
|
|
1279
|
-
var
|
|
1280
|
-
var name, typeAbrMaster, typeLiveStream,
|
|
1281
|
-
return _regeneratorRuntime.wrap(function
|
|
1275
|
+
var _ref16 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref15) {
|
|
1276
|
+
var name, typeAbrMaster, typeLiveStream, _ref15$drm, drm, format, status, objectId, aBitRate, aChannels, aSampleRate, aStreamIndex, aTimeBase, aChannelLayout, vBitRate, vHeight, vStreamIndex, vWidth, vDisplayAspectRatio, vFrameRate, vTimeBase, abrProfileDefault, playoutFormats, abrProfile, formats, i, libraryId, mainMeta, fabURI, streamUrl, _t16;
|
|
1277
|
+
return _regeneratorRuntime.wrap(function (_context9) {
|
|
1282
1278
|
while (1) switch (_context9.prev = _context9.next) {
|
|
1283
1279
|
case 0:
|
|
1284
|
-
name =
|
|
1285
|
-
_context9.next =
|
|
1280
|
+
name = _ref15.name, typeAbrMaster = _ref15.typeAbrMaster, typeLiveStream = _ref15.typeLiveStream, _ref15$drm = _ref15.drm, drm = _ref15$drm === void 0 ? false : _ref15$drm, format = _ref15.format;
|
|
1281
|
+
_context9.next = 1;
|
|
1286
1282
|
return this.StreamStatus({
|
|
1287
1283
|
name: name
|
|
1288
1284
|
});
|
|
1289
|
-
case
|
|
1285
|
+
case 1:
|
|
1290
1286
|
status = _context9.sent;
|
|
1291
1287
|
if (!(status.state != "uninitialized" && status.state != "inactive" && status.state != "stopped")) {
|
|
1292
|
-
_context9.next =
|
|
1288
|
+
_context9.next = 2;
|
|
1293
1289
|
break;
|
|
1294
1290
|
}
|
|
1295
1291
|
return _context9.abrupt("return", {
|
|
1296
1292
|
state: status.state,
|
|
1297
1293
|
error: "stream still active - must terminate first"
|
|
1298
1294
|
});
|
|
1299
|
-
case
|
|
1295
|
+
case 2:
|
|
1300
1296
|
objectId = status.object_id;
|
|
1301
1297
|
console.log("INIT: ", name, objectId);
|
|
1302
1298
|
aBitRate = 128000;
|
|
@@ -1315,20 +1311,20 @@ exports.StreamSetOfferingAndDRM = /*#__PURE__*/function () {
|
|
|
1315
1311
|
abrProfileDefault = require("../abr_profiles/abr_profile_live_drm.js");
|
|
1316
1312
|
abrProfile = JSON.parse(JSON.stringify(abrProfileDefault));
|
|
1317
1313
|
if (!format) {
|
|
1318
|
-
_context9.next =
|
|
1314
|
+
_context9.next = 8;
|
|
1319
1315
|
break;
|
|
1320
1316
|
}
|
|
1321
1317
|
drm = true; // Override DRM parameter
|
|
1322
1318
|
playoutFormats = {};
|
|
1323
1319
|
formats = format.split(",");
|
|
1324
1320
|
i = 0;
|
|
1325
|
-
case
|
|
1321
|
+
case 3:
|
|
1326
1322
|
if (!(i < formats.length)) {
|
|
1327
|
-
_context9.next =
|
|
1323
|
+
_context9.next = 7;
|
|
1328
1324
|
break;
|
|
1329
1325
|
}
|
|
1330
1326
|
if (!(formats[i] === "hls-clear")) {
|
|
1331
|
-
_context9.next =
|
|
1327
|
+
_context9.next = 4;
|
|
1332
1328
|
break;
|
|
1333
1329
|
}
|
|
1334
1330
|
abrProfile.drm_optional = true;
|
|
@@ -1338,10 +1334,10 @@ exports.StreamSetOfferingAndDRM = /*#__PURE__*/function () {
|
|
|
1338
1334
|
"type": "ProtoHls"
|
|
1339
1335
|
}
|
|
1340
1336
|
};
|
|
1341
|
-
return _context9.abrupt("continue",
|
|
1342
|
-
case
|
|
1337
|
+
return _context9.abrupt("continue", 6);
|
|
1338
|
+
case 4:
|
|
1343
1339
|
if (!(formats[i] === "dash-clear")) {
|
|
1344
|
-
_context9.next =
|
|
1340
|
+
_context9.next = 5;
|
|
1345
1341
|
break;
|
|
1346
1342
|
}
|
|
1347
1343
|
abrProfile.drm_optional = true;
|
|
@@ -1352,17 +1348,17 @@ exports.StreamSetOfferingAndDRM = /*#__PURE__*/function () {
|
|
|
1352
1348
|
"type": "ProtoDash"
|
|
1353
1349
|
}
|
|
1354
1350
|
};
|
|
1355
|
-
return _context9.abrupt("continue",
|
|
1356
|
-
case
|
|
1351
|
+
return _context9.abrupt("continue", 6);
|
|
1352
|
+
case 5:
|
|
1357
1353
|
playoutFormats[formats[i]] = abrProfile.playout_formats[formats[i]];
|
|
1358
|
-
case
|
|
1354
|
+
case 6:
|
|
1359
1355
|
i++;
|
|
1360
|
-
_context9.next =
|
|
1356
|
+
_context9.next = 3;
|
|
1361
1357
|
break;
|
|
1362
|
-
case
|
|
1363
|
-
_context9.next =
|
|
1358
|
+
case 7:
|
|
1359
|
+
_context9.next = 9;
|
|
1364
1360
|
break;
|
|
1365
|
-
case
|
|
1361
|
+
case 8:
|
|
1366
1362
|
if (!drm) {
|
|
1367
1363
|
abrProfile.drm_optional = true;
|
|
1368
1364
|
playoutFormats = {
|
|
@@ -1383,22 +1379,21 @@ exports.StreamSetOfferingAndDRM = /*#__PURE__*/function () {
|
|
|
1383
1379
|
} else {
|
|
1384
1380
|
playoutFormats = Object.assign({}, abrProfile.playout_formats);
|
|
1385
1381
|
}
|
|
1386
|
-
case
|
|
1382
|
+
case 9:
|
|
1387
1383
|
abrProfile.playout_formats = playoutFormats;
|
|
1388
|
-
_context9.next =
|
|
1384
|
+
_context9.next = 10;
|
|
1389
1385
|
return this.ContentObjectLibraryId({
|
|
1390
1386
|
objectId: objectId
|
|
1391
1387
|
});
|
|
1392
|
-
case
|
|
1388
|
+
case 10:
|
|
1393
1389
|
libraryId = _context9.sent;
|
|
1394
|
-
_context9.prev =
|
|
1395
|
-
_context9.next =
|
|
1390
|
+
_context9.prev = 11;
|
|
1391
|
+
_context9.next = 12;
|
|
1396
1392
|
return this.ContentObjectMetadata({
|
|
1397
1393
|
libraryId: libraryId,
|
|
1398
|
-
objectId: objectId
|
|
1399
|
-
writeToken: writeToken
|
|
1394
|
+
objectId: objectId
|
|
1400
1395
|
});
|
|
1401
|
-
case
|
|
1396
|
+
case 12:
|
|
1402
1397
|
mainMeta = _context9.sent;
|
|
1403
1398
|
fabURI = mainMeta.live_recording.fabric_config.ingress_node_api; // Support both hostname and URL ingress_node_api
|
|
1404
1399
|
if (!fabURI.startsWith("http")) {
|
|
@@ -1409,7 +1404,7 @@ exports.StreamSetOfferingAndDRM = /*#__PURE__*/function () {
|
|
|
1409
1404
|
fabricURIs: [fabURI]
|
|
1410
1405
|
});
|
|
1411
1406
|
streamUrl = mainMeta.live_recording.recording_config.recording_params.origin_url;
|
|
1412
|
-
_context9.next =
|
|
1407
|
+
_context9.next = 13;
|
|
1413
1408
|
return StreamGenerateOffering({
|
|
1414
1409
|
client: this,
|
|
1415
1410
|
libraryId: libraryId,
|
|
@@ -1430,29 +1425,27 @@ exports.StreamSetOfferingAndDRM = /*#__PURE__*/function () {
|
|
|
1430
1425
|
vWidth: vWidth,
|
|
1431
1426
|
vDisplayAspectRatio: vDisplayAspectRatio,
|
|
1432
1427
|
vFrameRate: vFrameRate,
|
|
1433
|
-
vTimeBase: vTimeBase
|
|
1434
|
-
writeToken: writeToken,
|
|
1435
|
-
finalize: finalize
|
|
1428
|
+
vTimeBase: vTimeBase
|
|
1436
1429
|
});
|
|
1437
|
-
case
|
|
1430
|
+
case 13:
|
|
1438
1431
|
console.log("Finished generating offering");
|
|
1439
1432
|
return _context9.abrupt("return", {
|
|
1440
1433
|
name: name,
|
|
1441
1434
|
object_id: objectId,
|
|
1442
1435
|
state: "initialized"
|
|
1443
1436
|
});
|
|
1444
|
-
case
|
|
1445
|
-
_context9.prev =
|
|
1446
|
-
|
|
1447
|
-
console.error(
|
|
1448
|
-
case
|
|
1437
|
+
case 14:
|
|
1438
|
+
_context9.prev = 14;
|
|
1439
|
+
_t16 = _context9["catch"](11);
|
|
1440
|
+
console.error(_t16);
|
|
1441
|
+
case 15:
|
|
1449
1442
|
case "end":
|
|
1450
1443
|
return _context9.stop();
|
|
1451
1444
|
}
|
|
1452
|
-
}, _callee9, this, [[
|
|
1445
|
+
}, _callee9, this, [[11, 14]]);
|
|
1453
1446
|
}));
|
|
1454
1447
|
return function (_x9) {
|
|
1455
|
-
return
|
|
1448
|
+
return _ref16.apply(this, arguments);
|
|
1456
1449
|
};
|
|
1457
1450
|
}();
|
|
1458
1451
|
|
|
@@ -1472,23 +1465,22 @@ exports.StreamSetOfferingAndDRM = /*#__PURE__*/function () {
|
|
|
1472
1465
|
* @return {Promise<Object>} - Insertions, as well as any errors from bad insertions
|
|
1473
1466
|
*/
|
|
1474
1467
|
exports.StreamInsertion = /*#__PURE__*/function () {
|
|
1475
|
-
var
|
|
1476
|
-
var name, insertionTime,
|
|
1477
|
-
return _regeneratorRuntime.wrap(function
|
|
1478
|
-
while (1) switch (
|
|
1468
|
+
var _ref18 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(_ref17) {
|
|
1469
|
+
var name, insertionTime, _ref17$sinceStart, sinceStart, duration, targetHash, _ref17$remove, remove, offeringMeta, insertionInfo, audioAbrDuration, videoAbrDuration, objectId, libraryId, mainMeta, fabURI, edgeWriteToken, edgeMeta, recordings, sequence, streamStartTime, period, playoutConfig, insertions, res, errs, currentTime, insertionDone, newInsertion, i;
|
|
1470
|
+
return _regeneratorRuntime.wrap(function (_context0) {
|
|
1471
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
1479
1472
|
case 0:
|
|
1480
|
-
name =
|
|
1481
|
-
|
|
1473
|
+
name = _ref17.name, insertionTime = _ref17.insertionTime, _ref17$sinceStart = _ref17.sinceStart, sinceStart = _ref17$sinceStart === void 0 ? false : _ref17$sinceStart, duration = _ref17.duration, targetHash = _ref17.targetHash, _ref17$remove = _ref17.remove, remove = _ref17$remove === void 0 ? false : _ref17$remove;
|
|
1474
|
+
_context0.next = 1;
|
|
1482
1475
|
return this.ContentObjectMetadata({
|
|
1483
1476
|
versionHash: targetHash,
|
|
1484
1477
|
metadataSubtree: "/offerings/default"
|
|
1485
1478
|
});
|
|
1486
|
-
case
|
|
1487
|
-
offeringMeta =
|
|
1479
|
+
case 1:
|
|
1480
|
+
offeringMeta = _context0.sent;
|
|
1488
1481
|
insertionInfo = {
|
|
1489
1482
|
duration_sec: 0 // Minimum of video and audio duration
|
|
1490
1483
|
};
|
|
1491
|
-
|
|
1492
1484
|
["video", "audio"].forEach(function (mt) {
|
|
1493
1485
|
var stream = offeringMeta.media_struct.streams[mt];
|
|
1494
1486
|
insertionInfo[mt] = {
|
|
@@ -1503,39 +1495,39 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1503
1495
|
audioAbrDuration = insertionInfo.audio.seg_duration_sec;
|
|
1504
1496
|
videoAbrDuration = insertionInfo.video.seg_duration_sec;
|
|
1505
1497
|
if (!(audioAbrDuration === 0 || videoAbrDuration === 0)) {
|
|
1506
|
-
|
|
1498
|
+
_context0.next = 2;
|
|
1507
1499
|
break;
|
|
1508
1500
|
}
|
|
1509
1501
|
throw new Error("Bad segment duration hash:", targetHash);
|
|
1510
|
-
case
|
|
1502
|
+
case 2:
|
|
1511
1503
|
if (!(duration === undefined)) {
|
|
1512
|
-
|
|
1504
|
+
_context0.next = 3;
|
|
1513
1505
|
break;
|
|
1514
1506
|
}
|
|
1515
1507
|
duration = insertionInfo.duration_sec; // Use full duration of the insertion
|
|
1516
|
-
|
|
1508
|
+
_context0.next = 4;
|
|
1517
1509
|
break;
|
|
1518
|
-
case
|
|
1510
|
+
case 3:
|
|
1519
1511
|
if (!(duration > insertionInfo.duration_sec)) {
|
|
1520
|
-
|
|
1512
|
+
_context0.next = 4;
|
|
1521
1513
|
break;
|
|
1522
1514
|
}
|
|
1523
1515
|
throw new Error("Bad duration - larger than insertion object duration", insertionInfo.duration_sec);
|
|
1524
|
-
case
|
|
1516
|
+
case 4:
|
|
1525
1517
|
objectId = name;
|
|
1526
|
-
|
|
1518
|
+
_context0.next = 5;
|
|
1527
1519
|
return this.ContentObjectLibraryId({
|
|
1528
1520
|
objectId: objectId
|
|
1529
1521
|
});
|
|
1530
|
-
case
|
|
1531
|
-
libraryId =
|
|
1532
|
-
|
|
1522
|
+
case 5:
|
|
1523
|
+
libraryId = _context0.sent;
|
|
1524
|
+
_context0.next = 6;
|
|
1533
1525
|
return this.ContentObjectMetadata({
|
|
1534
1526
|
libraryId: libraryId,
|
|
1535
1527
|
objectId: objectId
|
|
1536
1528
|
});
|
|
1537
|
-
case
|
|
1538
|
-
mainMeta =
|
|
1529
|
+
case 6:
|
|
1530
|
+
mainMeta = _context0.sent;
|
|
1539
1531
|
fabURI = mainMeta.live_recording.fabric_config.ingress_node_api; // Support both hostname and URL ingress_node_api
|
|
1540
1532
|
if (!fabURI.startsWith("http")) {
|
|
1541
1533
|
// Assume https
|
|
@@ -1545,14 +1537,14 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1545
1537
|
fabricURIs: [fabURI]
|
|
1546
1538
|
});
|
|
1547
1539
|
edgeWriteToken = mainMeta.live_recording.fabric_config.edge_write_token;
|
|
1548
|
-
|
|
1540
|
+
_context0.next = 7;
|
|
1549
1541
|
return this.ContentObjectMetadata({
|
|
1550
1542
|
libraryId: libraryId,
|
|
1551
1543
|
objectId: objectId,
|
|
1552
1544
|
writeToken: edgeWriteToken
|
|
1553
1545
|
});
|
|
1554
|
-
case
|
|
1555
|
-
edgeMeta =
|
|
1546
|
+
case 7:
|
|
1547
|
+
edgeMeta = _context0.sent;
|
|
1556
1548
|
// Find stream start time (from the most recent recording section)
|
|
1557
1549
|
recordings = edgeMeta.live_recording.recordings;
|
|
1558
1550
|
sequence = 1;
|
|
@@ -1570,15 +1562,15 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1570
1562
|
}
|
|
1571
1563
|
}
|
|
1572
1564
|
if (!(streamStartTime === 0)) {
|
|
1573
|
-
|
|
1565
|
+
_context0.next = 8;
|
|
1574
1566
|
break;
|
|
1575
1567
|
}
|
|
1576
1568
|
if (!(sinceStart === false)) {
|
|
1577
|
-
|
|
1569
|
+
_context0.next = 8;
|
|
1578
1570
|
break;
|
|
1579
1571
|
}
|
|
1580
1572
|
throw new Error("Stream not running - must use 'time since start'");
|
|
1581
|
-
case
|
|
1573
|
+
case 8:
|
|
1582
1574
|
// Find the current period playout configuration
|
|
1583
1575
|
if (edgeMeta.live_recording.playout_config.interleaves === undefined) {
|
|
1584
1576
|
edgeMeta.live_recording.playout_config.interleaves = {};
|
|
@@ -1605,9 +1597,9 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1605
1597
|
playout: "/qfab/" + targetHash + "/rep/playout" // TO FIX - should be a link
|
|
1606
1598
|
};
|
|
1607
1599
|
i = 0;
|
|
1608
|
-
case
|
|
1600
|
+
case 9:
|
|
1609
1601
|
if (!(i < insertions.length)) {
|
|
1610
|
-
|
|
1602
|
+
_context0.next = 13;
|
|
1611
1603
|
break;
|
|
1612
1604
|
}
|
|
1613
1605
|
if (insertions[i].insertion_time <= currentTime) {
|
|
@@ -1615,21 +1607,21 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1615
1607
|
append(errs, "Bad insertion - time:", insertions[i].insertion_time);
|
|
1616
1608
|
}
|
|
1617
1609
|
if (!remove) {
|
|
1618
|
-
|
|
1610
|
+
_context0.next = 11;
|
|
1619
1611
|
break;
|
|
1620
1612
|
}
|
|
1621
1613
|
if (!(insertions[i].insertion_time === insertionTime)) {
|
|
1622
|
-
|
|
1614
|
+
_context0.next = 10;
|
|
1623
1615
|
break;
|
|
1624
1616
|
}
|
|
1625
1617
|
insertions.splice(i, 1);
|
|
1626
|
-
return
|
|
1627
|
-
case
|
|
1628
|
-
|
|
1618
|
+
return _context0.abrupt("continue", 13);
|
|
1619
|
+
case 10:
|
|
1620
|
+
_context0.next = 12;
|
|
1629
1621
|
break;
|
|
1630
|
-
case
|
|
1622
|
+
case 11:
|
|
1631
1623
|
if (!(insertions[i].insertion_time > insertionTime)) {
|
|
1632
|
-
|
|
1624
|
+
_context0.next = 12;
|
|
1633
1625
|
break;
|
|
1634
1626
|
}
|
|
1635
1627
|
if (i > 0) {
|
|
@@ -1638,12 +1630,12 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1638
1630
|
insertions = [newInsertion].concat(_toConsumableArray(insertions.splice(i)));
|
|
1639
1631
|
}
|
|
1640
1632
|
insertionDone = true;
|
|
1641
|
-
return
|
|
1642
|
-
case
|
|
1633
|
+
return _context0.abrupt("continue", 13);
|
|
1634
|
+
case 12:
|
|
1643
1635
|
i++;
|
|
1644
|
-
|
|
1636
|
+
_context0.next = 9;
|
|
1645
1637
|
break;
|
|
1646
|
-
case
|
|
1638
|
+
case 13:
|
|
1647
1639
|
if (!remove && !insertionDone) {
|
|
1648
1640
|
// Add to the end of the insertions list
|
|
1649
1641
|
console.log("Add insertion at the end");
|
|
@@ -1652,7 +1644,7 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1652
1644
|
playoutConfig.interleaves[sequence] = insertions;
|
|
1653
1645
|
|
|
1654
1646
|
// Store the new insertions in the write token
|
|
1655
|
-
|
|
1647
|
+
_context0.next = 14;
|
|
1656
1648
|
return this.ReplaceMetadata({
|
|
1657
1649
|
libraryId: libraryId,
|
|
1658
1650
|
objectId: objectId,
|
|
@@ -1660,18 +1652,18 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1660
1652
|
metadataSubtree: "/live_recording/playout_config",
|
|
1661
1653
|
metadata: edgeMeta.live_recording.playout_config
|
|
1662
1654
|
});
|
|
1663
|
-
case
|
|
1655
|
+
case 14:
|
|
1664
1656
|
res.errors = errs;
|
|
1665
1657
|
res.insertions = insertions;
|
|
1666
|
-
return
|
|
1667
|
-
case
|
|
1658
|
+
return _context0.abrupt("return", res);
|
|
1659
|
+
case 15:
|
|
1668
1660
|
case "end":
|
|
1669
|
-
return
|
|
1661
|
+
return _context0.stop();
|
|
1670
1662
|
}
|
|
1671
|
-
},
|
|
1663
|
+
}, _callee0, this);
|
|
1672
1664
|
}));
|
|
1673
|
-
return function (
|
|
1674
|
-
return
|
|
1665
|
+
return function (_x0) {
|
|
1666
|
+
return _ref18.apply(this, arguments);
|
|
1675
1667
|
};
|
|
1676
1668
|
}();
|
|
1677
1669
|
|
|
@@ -1709,32 +1701,32 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1709
1701
|
*
|
|
1710
1702
|
*/
|
|
1711
1703
|
exports.StreamConfig = /*#__PURE__*/function () {
|
|
1712
|
-
var
|
|
1713
|
-
var name,
|
|
1714
|
-
return _regeneratorRuntime.wrap(function
|
|
1715
|
-
while (1) switch (
|
|
1704
|
+
var _ref20 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee1(_ref19) {
|
|
1705
|
+
var name, _ref19$customSettings, customSettings, _ref19$customMetaValu, customMetaValues, probeMetadata, writeToken, _ref19$finalize, finalize, objectId, status, libraryId, probe, mainMeta, userConfig, parsedName, hostName, streamUrl, nodes, node, endpoint, probeUrl, lc, liveRecordingConfig, e, _t17, _t18, _t19;
|
|
1706
|
+
return _regeneratorRuntime.wrap(function (_context1) {
|
|
1707
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
1716
1708
|
case 0:
|
|
1717
|
-
name =
|
|
1709
|
+
name = _ref19.name, _ref19$customSettings = _ref19.customSettings, customSettings = _ref19$customSettings === void 0 ? {} : _ref19$customSettings, _ref19$customMetaValu = _ref19.customMetaValues, customMetaValues = _ref19$customMetaValu === void 0 ? {} : _ref19$customMetaValu, probeMetadata = _ref19.probeMetadata, writeToken = _ref19.writeToken, _ref19$finalize = _ref19.finalize, finalize = _ref19$finalize === void 0 ? true : _ref19$finalize;
|
|
1718
1710
|
objectId = name;
|
|
1719
1711
|
status = {
|
|
1720
1712
|
name: name
|
|
1721
1713
|
};
|
|
1722
|
-
|
|
1714
|
+
_context1.next = 1;
|
|
1723
1715
|
return this.ContentObjectLibraryId({
|
|
1724
1716
|
objectId: objectId
|
|
1725
1717
|
});
|
|
1726
|
-
case
|
|
1727
|
-
libraryId =
|
|
1718
|
+
case 1:
|
|
1719
|
+
libraryId = _context1.sent;
|
|
1728
1720
|
status.library_id = libraryId;
|
|
1729
1721
|
status.object_id = objectId;
|
|
1730
1722
|
probe = probeMetadata;
|
|
1731
|
-
|
|
1723
|
+
_context1.next = 2;
|
|
1732
1724
|
return this.ContentObjectMetadata({
|
|
1733
1725
|
libraryId: libraryId,
|
|
1734
1726
|
objectId: objectId
|
|
1735
1727
|
});
|
|
1736
|
-
case
|
|
1737
|
-
mainMeta =
|
|
1728
|
+
case 2:
|
|
1729
|
+
mainMeta = _context1.sent;
|
|
1738
1730
|
userConfig = mainMeta.live_recording_config;
|
|
1739
1731
|
status.user_config = userConfig;
|
|
1740
1732
|
|
|
@@ -1743,19 +1735,19 @@ exports.StreamConfig = /*#__PURE__*/function () {
|
|
|
1743
1735
|
hostName = new URL(parsedName).hostname;
|
|
1744
1736
|
streamUrl = new URL(userConfig.url);
|
|
1745
1737
|
this.Log("Retrieving nodes - matching: ".concat(hostName));
|
|
1746
|
-
|
|
1738
|
+
_context1.next = 3;
|
|
1747
1739
|
return this.SpaceNodes({
|
|
1748
1740
|
matchEndpoint: hostName
|
|
1749
1741
|
});
|
|
1750
|
-
case
|
|
1751
|
-
nodes =
|
|
1742
|
+
case 3:
|
|
1743
|
+
nodes = _context1.sent;
|
|
1752
1744
|
if (!(nodes.length < 1)) {
|
|
1753
|
-
|
|
1745
|
+
_context1.next = 4;
|
|
1754
1746
|
break;
|
|
1755
1747
|
}
|
|
1756
1748
|
status.error = "No node matching stream URL " + streamUrl.href;
|
|
1757
|
-
return
|
|
1758
|
-
case
|
|
1749
|
+
return _context1.abrupt("return", status);
|
|
1750
|
+
case 4:
|
|
1759
1751
|
node = {
|
|
1760
1752
|
endpoints: nodes[0].services.fabric_api.urls,
|
|
1761
1753
|
id: nodes[0].id
|
|
@@ -1763,7 +1755,7 @@ exports.StreamConfig = /*#__PURE__*/function () {
|
|
|
1763
1755
|
status.node = node;
|
|
1764
1756
|
endpoint = node.endpoints[0];
|
|
1765
1757
|
if (probe) {
|
|
1766
|
-
|
|
1758
|
+
_context1.next = 13;
|
|
1767
1759
|
break;
|
|
1768
1760
|
}
|
|
1769
1761
|
this.SetNodes({
|
|
@@ -1772,17 +1764,17 @@ exports.StreamConfig = /*#__PURE__*/function () {
|
|
|
1772
1764
|
|
|
1773
1765
|
// Probe the stream
|
|
1774
1766
|
probe = {};
|
|
1775
|
-
|
|
1776
|
-
|
|
1767
|
+
_context1.prev = 5;
|
|
1768
|
+
_context1.next = 6;
|
|
1777
1769
|
return this.Rep({
|
|
1778
1770
|
libraryId: libraryId,
|
|
1779
1771
|
objectId: objectId,
|
|
1780
1772
|
rep: "probe"
|
|
1781
1773
|
});
|
|
1782
|
-
case
|
|
1783
|
-
probeUrl =
|
|
1784
|
-
|
|
1785
|
-
|
|
1774
|
+
case 6:
|
|
1775
|
+
probeUrl = _context1.sent;
|
|
1776
|
+
_t17 = this.utils;
|
|
1777
|
+
_context1.next = 7;
|
|
1786
1778
|
return HttpClient.Fetch(probeUrl, {
|
|
1787
1779
|
body: JSON.stringify({
|
|
1788
1780
|
"filename": streamUrl.href,
|
|
@@ -1790,52 +1782,52 @@ exports.StreamConfig = /*#__PURE__*/function () {
|
|
|
1790
1782
|
}),
|
|
1791
1783
|
method: "POST"
|
|
1792
1784
|
});
|
|
1793
|
-
case
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
return
|
|
1797
|
-
case
|
|
1798
|
-
probe =
|
|
1785
|
+
case 7:
|
|
1786
|
+
_t18 = _context1.sent;
|
|
1787
|
+
_context1.next = 8;
|
|
1788
|
+
return _t17.ResponseToJson.call(_t17, _t18);
|
|
1789
|
+
case 8:
|
|
1790
|
+
probe = _context1.sent;
|
|
1799
1791
|
if (!probe.errors) {
|
|
1800
|
-
|
|
1792
|
+
_context1.next = 9;
|
|
1801
1793
|
break;
|
|
1802
1794
|
}
|
|
1803
1795
|
throw probe.errors[0];
|
|
1804
|
-
case
|
|
1805
|
-
|
|
1796
|
+
case 9:
|
|
1797
|
+
_context1.next = 12;
|
|
1806
1798
|
break;
|
|
1807
|
-
case
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
if (!(
|
|
1811
|
-
|
|
1799
|
+
case 10:
|
|
1800
|
+
_context1.prev = 10;
|
|
1801
|
+
_t19 = _context1["catch"](5);
|
|
1802
|
+
if (!(_t19.code === "ETIMEDOUT")) {
|
|
1803
|
+
_context1.next = 11;
|
|
1812
1804
|
break;
|
|
1813
1805
|
}
|
|
1814
1806
|
throw "Stream probe time out - make sure the stream source is available";
|
|
1815
|
-
case
|
|
1816
|
-
throw
|
|
1817
|
-
case
|
|
1807
|
+
case 11:
|
|
1808
|
+
throw _t19;
|
|
1809
|
+
case 12:
|
|
1818
1810
|
probe.format.filename = streamUrl.href;
|
|
1819
|
-
case
|
|
1811
|
+
case 13:
|
|
1820
1812
|
// Create live recording config
|
|
1821
1813
|
lc = new LiveConf(probe, node.id, endpoint, false, false, true);
|
|
1822
1814
|
liveRecordingConfig = lc.generateLiveConf({
|
|
1823
1815
|
customSettings: customSettings
|
|
1824
1816
|
}); // Store live recording config into the stream object
|
|
1825
1817
|
if (writeToken) {
|
|
1826
|
-
|
|
1818
|
+
_context1.next = 15;
|
|
1827
1819
|
break;
|
|
1828
1820
|
}
|
|
1829
|
-
|
|
1821
|
+
_context1.next = 14;
|
|
1830
1822
|
return this.EditContentObject({
|
|
1831
1823
|
libraryId: libraryId,
|
|
1832
1824
|
objectId: objectId
|
|
1833
1825
|
});
|
|
1834
|
-
case
|
|
1835
|
-
e =
|
|
1826
|
+
case 14:
|
|
1827
|
+
e = _context1.sent;
|
|
1836
1828
|
writeToken = e.write_token;
|
|
1837
|
-
case
|
|
1838
|
-
|
|
1829
|
+
case 15:
|
|
1830
|
+
_context1.next = 16;
|
|
1839
1831
|
return this.ReplaceMetadata({
|
|
1840
1832
|
libraryId: libraryId,
|
|
1841
1833
|
objectId: objectId,
|
|
@@ -1843,8 +1835,8 @@ exports.StreamConfig = /*#__PURE__*/function () {
|
|
|
1843
1835
|
metadataSubtree: "live_recording",
|
|
1844
1836
|
metadata: liveRecordingConfig.live_recording
|
|
1845
1837
|
});
|
|
1846
|
-
case
|
|
1847
|
-
|
|
1838
|
+
case 16:
|
|
1839
|
+
_context1.next = 17;
|
|
1848
1840
|
return this.ReplaceMetadata({
|
|
1849
1841
|
libraryId: libraryId,
|
|
1850
1842
|
objectId: objectId,
|
|
@@ -1852,30 +1844,30 @@ exports.StreamConfig = /*#__PURE__*/function () {
|
|
|
1852
1844
|
metadataSubtree: "live_recording_config/probe_info",
|
|
1853
1845
|
metadata: probe
|
|
1854
1846
|
});
|
|
1855
|
-
case
|
|
1847
|
+
case 17:
|
|
1856
1848
|
if (!finalize) {
|
|
1857
|
-
|
|
1849
|
+
_context1.next = 19;
|
|
1858
1850
|
break;
|
|
1859
1851
|
}
|
|
1860
|
-
|
|
1852
|
+
_context1.next = 18;
|
|
1861
1853
|
return this.FinalizeContentObject({
|
|
1862
1854
|
libraryId: libraryId,
|
|
1863
1855
|
objectId: objectId,
|
|
1864
1856
|
writeToken: writeToken,
|
|
1865
1857
|
commitMessage: "Apply live stream configuration"
|
|
1866
1858
|
});
|
|
1867
|
-
case
|
|
1868
|
-
status.fin =
|
|
1869
|
-
case
|
|
1870
|
-
return
|
|
1871
|
-
case
|
|
1859
|
+
case 18:
|
|
1860
|
+
status.fin = _context1.sent;
|
|
1861
|
+
case 19:
|
|
1862
|
+
return _context1.abrupt("return", status);
|
|
1863
|
+
case 20:
|
|
1872
1864
|
case "end":
|
|
1873
|
-
return
|
|
1865
|
+
return _context1.stop();
|
|
1874
1866
|
}
|
|
1875
|
-
},
|
|
1867
|
+
}, _callee1, this, [[5, 10]]);
|
|
1876
1868
|
}));
|
|
1877
|
-
return function (
|
|
1878
|
-
return
|
|
1869
|
+
return function (_x1) {
|
|
1870
|
+
return _ref20.apply(this, arguments);
|
|
1879
1871
|
};
|
|
1880
1872
|
}();
|
|
1881
1873
|
|
|
@@ -1888,9 +1880,9 @@ exports.StreamConfig = /*#__PURE__*/function () {
|
|
|
1888
1880
|
*
|
|
1889
1881
|
* @return {Promise<Object>} - The list of stream URLs
|
|
1890
1882
|
*/
|
|
1891
|
-
exports.StreamListUrls = /*#__PURE__*/_asyncToGenerator(
|
|
1883
|
+
exports.StreamListUrls = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
|
|
1892
1884
|
var _this2 = this;
|
|
1893
|
-
var
|
|
1885
|
+
var _ref22,
|
|
1894
1886
|
siteId,
|
|
1895
1887
|
STATUS_MAP,
|
|
1896
1888
|
tenantContractId,
|
|
@@ -1898,12 +1890,21 @@ exports.StreamListUrls = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regenerat
|
|
|
1898
1890
|
activeUrlMap,
|
|
1899
1891
|
streamUrlStatus,
|
|
1900
1892
|
streamUrls,
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1893
|
+
_args11 = arguments,
|
|
1894
|
+
_t20,
|
|
1895
|
+
_t21,
|
|
1896
|
+
_t22,
|
|
1897
|
+
_t23,
|
|
1898
|
+
_t24,
|
|
1899
|
+
_t25,
|
|
1900
|
+
_t26,
|
|
1901
|
+
_t27,
|
|
1902
|
+
_t28;
|
|
1903
|
+
return _regeneratorRuntime.wrap(function (_context11) {
|
|
1904
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1904
1905
|
case 0:
|
|
1905
|
-
|
|
1906
|
-
|
|
1906
|
+
_ref22 = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {}, siteId = _ref22.siteId;
|
|
1907
|
+
_context11.prev = 1;
|
|
1907
1908
|
STATUS_MAP = {
|
|
1908
1909
|
UNCONFIGURED: "unconfigured",
|
|
1909
1910
|
UNINITIALIZED: "uninitialized",
|
|
@@ -1914,78 +1915,78 @@ exports.StreamListUrls = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regenerat
|
|
|
1914
1915
|
STALLED: "stalled"
|
|
1915
1916
|
};
|
|
1916
1917
|
if (siteId) {
|
|
1917
|
-
|
|
1918
|
+
_context11.next = 5;
|
|
1918
1919
|
break;
|
|
1919
1920
|
}
|
|
1920
|
-
|
|
1921
|
+
_context11.next = 2;
|
|
1921
1922
|
return this.userProfileClient.TenantContractId();
|
|
1922
|
-
case
|
|
1923
|
-
tenantContractId =
|
|
1923
|
+
case 2:
|
|
1924
|
+
tenantContractId = _context11.sent;
|
|
1924
1925
|
if (tenantContractId) {
|
|
1925
|
-
|
|
1926
|
+
_context11.next = 3;
|
|
1926
1927
|
break;
|
|
1927
1928
|
}
|
|
1928
1929
|
throw Error("No tenant contract ID configured");
|
|
1929
|
-
case
|
|
1930
|
-
|
|
1930
|
+
case 3:
|
|
1931
|
+
_context11.next = 4;
|
|
1931
1932
|
return this.ContentObjectMetadata({
|
|
1932
1933
|
libraryId: tenantContractId.replace("iten", "ilib"),
|
|
1933
1934
|
objectId: tenantContractId.replace("iten", "iq__"),
|
|
1934
1935
|
metadataSubtree: "public/sites/live_streams"
|
|
1935
1936
|
});
|
|
1936
|
-
case
|
|
1937
|
-
siteId =
|
|
1938
|
-
case
|
|
1939
|
-
|
|
1940
|
-
|
|
1937
|
+
case 4:
|
|
1938
|
+
siteId = _context11.sent;
|
|
1939
|
+
case 5:
|
|
1940
|
+
_t20 = this;
|
|
1941
|
+
_context11.next = 6;
|
|
1941
1942
|
return this.ContentObjectLibraryId({
|
|
1942
1943
|
objectId: siteId
|
|
1943
1944
|
});
|
|
1944
|
-
case
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
libraryId:
|
|
1949
|
-
objectId:
|
|
1945
|
+
case 6:
|
|
1946
|
+
_t21 = _context11.sent;
|
|
1947
|
+
_t22 = siteId;
|
|
1948
|
+
_t23 = {
|
|
1949
|
+
libraryId: _t21,
|
|
1950
|
+
objectId: _t22,
|
|
1950
1951
|
metadataSubtree: "public/asset_metadata/live_streams",
|
|
1951
1952
|
resolveLinks: true,
|
|
1952
1953
|
resolveIgnoreErrors: true,
|
|
1953
1954
|
resolveIncludeSource: true
|
|
1954
1955
|
};
|
|
1955
|
-
|
|
1956
|
-
return
|
|
1957
|
-
case
|
|
1958
|
-
streamMetadata =
|
|
1956
|
+
_context11.next = 7;
|
|
1957
|
+
return _t20.ContentObjectMetadata.call(_t20, _t23);
|
|
1958
|
+
case 7:
|
|
1959
|
+
streamMetadata = _context11.sent;
|
|
1959
1960
|
activeUrlMap = {};
|
|
1960
|
-
|
|
1961
|
+
_context11.next = 8;
|
|
1961
1962
|
return this.utils.LimitedMap(10, Object.keys(streamMetadata || {}), /*#__PURE__*/function () {
|
|
1962
|
-
var
|
|
1963
|
+
var _ref23 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10(slug) {
|
|
1963
1964
|
var stream, versionHash, objectId, libraryId, status, streamMeta, url, isActive;
|
|
1964
|
-
return _regeneratorRuntime.wrap(function
|
|
1965
|
-
while (1) switch (
|
|
1965
|
+
return _regeneratorRuntime.wrap(function (_context10) {
|
|
1966
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
1966
1967
|
case 0:
|
|
1967
1968
|
stream = streamMetadata[slug];
|
|
1968
1969
|
if (stream && stream["."] && stream["."].source) {
|
|
1969
1970
|
versionHash = stream["."].source;
|
|
1970
1971
|
}
|
|
1971
1972
|
if (!versionHash) {
|
|
1972
|
-
|
|
1973
|
+
_context10.next = 4;
|
|
1973
1974
|
break;
|
|
1974
1975
|
}
|
|
1975
1976
|
objectId = _this2.utils.DecodeVersionHash(versionHash).objectId;
|
|
1976
|
-
|
|
1977
|
+
_context10.next = 1;
|
|
1977
1978
|
return _this2.ContentObjectLibraryId({
|
|
1978
1979
|
objectId: objectId
|
|
1979
1980
|
});
|
|
1980
|
-
case
|
|
1981
|
-
libraryId =
|
|
1982
|
-
|
|
1981
|
+
case 1:
|
|
1982
|
+
libraryId = _context10.sent;
|
|
1983
|
+
_context10.next = 2;
|
|
1983
1984
|
return _this2.StreamStatus({
|
|
1984
1985
|
name: objectId
|
|
1985
1986
|
});
|
|
1986
|
-
case
|
|
1987
|
-
status =
|
|
1988
|
-
|
|
1987
|
+
case 2:
|
|
1988
|
+
status = _context10.sent;
|
|
1989
|
+
_context10.next = 3;
|
|
1989
1990
|
return _this2.ContentObjectMetadata({
|
|
1990
1991
|
objectId: objectId,
|
|
1991
1992
|
libraryId: libraryId,
|
|
@@ -1993,50 +1994,50 @@ exports.StreamListUrls = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regenerat
|
|
|
1993
1994
|
// live_recording_config/url is the old path
|
|
1994
1995
|
"live_recording_config/url"]
|
|
1995
1996
|
});
|
|
1996
|
-
case
|
|
1997
|
-
streamMeta =
|
|
1997
|
+
case 3:
|
|
1998
|
+
streamMeta = _context10.sent;
|
|
1998
1999
|
url = streamMeta.live_recording_config.reference_url || streamMeta.live_recording_config.url;
|
|
1999
2000
|
isActive = [STATUS_MAP.STARTING, STATUS_MAP.RUNNING, STATUS_MAP.STALLED, STATUS_MAP.STOPPED].includes(status.state);
|
|
2000
2001
|
if (url && isActive) {
|
|
2001
2002
|
activeUrlMap[url] = true;
|
|
2002
2003
|
}
|
|
2003
|
-
case
|
|
2004
|
+
case 4:
|
|
2004
2005
|
case "end":
|
|
2005
|
-
return
|
|
2006
|
+
return _context10.stop();
|
|
2006
2007
|
}
|
|
2007
|
-
},
|
|
2008
|
+
}, _callee10);
|
|
2008
2009
|
}));
|
|
2009
|
-
return function (
|
|
2010
|
-
return
|
|
2010
|
+
return function (_x10) {
|
|
2011
|
+
return _ref23.apply(this, arguments);
|
|
2011
2012
|
};
|
|
2012
2013
|
}());
|
|
2013
|
-
case
|
|
2014
|
+
case 8:
|
|
2014
2015
|
streamUrlStatus = {};
|
|
2015
|
-
|
|
2016
|
-
|
|
2016
|
+
_t24 = this;
|
|
2017
|
+
_context11.next = 9;
|
|
2017
2018
|
return this.ContentObjectLibraryId({
|
|
2018
2019
|
objectId: siteId
|
|
2019
2020
|
});
|
|
2020
|
-
case
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
libraryId:
|
|
2025
|
-
objectId:
|
|
2021
|
+
case 9:
|
|
2022
|
+
_t25 = _context11.sent;
|
|
2023
|
+
_t26 = siteId;
|
|
2024
|
+
_t27 = {
|
|
2025
|
+
libraryId: _t25,
|
|
2026
|
+
objectId: _t26,
|
|
2026
2027
|
metadataSubtree: "/live_stream_urls",
|
|
2027
2028
|
resolveLinks: true,
|
|
2028
2029
|
resolveIgnoreErrors: true
|
|
2029
2030
|
};
|
|
2030
|
-
|
|
2031
|
-
return
|
|
2032
|
-
case
|
|
2033
|
-
streamUrls =
|
|
2031
|
+
_context11.next = 10;
|
|
2032
|
+
return _t24.ContentObjectMetadata.call(_t24, _t27);
|
|
2033
|
+
case 10:
|
|
2034
|
+
streamUrls = _context11.sent;
|
|
2034
2035
|
if (streamUrls) {
|
|
2035
|
-
|
|
2036
|
+
_context11.next = 11;
|
|
2036
2037
|
break;
|
|
2037
2038
|
}
|
|
2038
2039
|
throw Error("No pre-allocated URLs configured");
|
|
2039
|
-
case
|
|
2040
|
+
case 11:
|
|
2040
2041
|
Object.keys(streamUrls || {}).forEach(function (protocol) {
|
|
2041
2042
|
streamUrlStatus[protocol] = streamUrls[protocol].map(function (url) {
|
|
2042
2043
|
return {
|
|
@@ -2045,16 +2046,16 @@ exports.StreamListUrls = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regenerat
|
|
|
2045
2046
|
};
|
|
2046
2047
|
});
|
|
2047
2048
|
});
|
|
2048
|
-
return
|
|
2049
|
-
case
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
console.error(
|
|
2053
|
-
case
|
|
2049
|
+
return _context11.abrupt("return", streamUrlStatus);
|
|
2050
|
+
case 12:
|
|
2051
|
+
_context11.prev = 12;
|
|
2052
|
+
_t28 = _context11["catch"](1);
|
|
2053
|
+
console.error(_t28);
|
|
2054
|
+
case 13:
|
|
2054
2055
|
case "end":
|
|
2055
|
-
return
|
|
2056
|
+
return _context11.stop();
|
|
2056
2057
|
}
|
|
2057
|
-
},
|
|
2058
|
+
}, _callee11, this, [[1, 12]]);
|
|
2058
2059
|
}));
|
|
2059
2060
|
|
|
2060
2061
|
/**
|
|
@@ -2113,89 +2114,89 @@ exports.StreamListUrls = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regenerat
|
|
|
2113
2114
|
*/
|
|
2114
2115
|
|
|
2115
2116
|
exports.StreamCopyToVod = /*#__PURE__*/function () {
|
|
2116
|
-
var
|
|
2117
|
-
var name, targetObjectId, eventId,
|
|
2118
|
-
return _regeneratorRuntime.wrap(function
|
|
2119
|
-
while (1) switch (
|
|
2117
|
+
var _ref25 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref24) {
|
|
2118
|
+
var name, targetObjectId, eventId, _ref24$streams, streams, _ref24$finalize, finalize, _ref24$recordingPerio, recordingPeriod, _ref24$startTime, startTime, _ref24$endTime, endTime, objectId, abrProfile, status, libraryId, targetLibraryId, kmsAddress, kmsCapId, kmsCap, liveHash, event, _yield$this$EditConte2, writeToken, abrMezInitBody, finalizeResponse, _t29, _t30;
|
|
2119
|
+
return _regeneratorRuntime.wrap(function (_context12) {
|
|
2120
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
2120
2121
|
case 0:
|
|
2121
|
-
name =
|
|
2122
|
+
name = _ref24.name, targetObjectId = _ref24.targetObjectId, eventId = _ref24.eventId, _ref24$streams = _ref24.streams, streams = _ref24$streams === void 0 ? null : _ref24$streams, _ref24$finalize = _ref24.finalize, finalize = _ref24$finalize === void 0 ? true : _ref24$finalize, _ref24$recordingPerio = _ref24.recordingPeriod, recordingPeriod = _ref24$recordingPerio === void 0 ? -1 : _ref24$recordingPerio, _ref24$startTime = _ref24.startTime, startTime = _ref24$startTime === void 0 ? "" : _ref24$startTime, _ref24$endTime = _ref24.endTime, endTime = _ref24$endTime === void 0 ? "" : _ref24$endTime;
|
|
2122
2123
|
objectId = name;
|
|
2123
2124
|
abrProfile = require("../abr_profiles/abr_profile_live_to_vod.js");
|
|
2124
|
-
|
|
2125
|
+
_context12.next = 1;
|
|
2125
2126
|
return this.StreamStatus({
|
|
2126
2127
|
name: name
|
|
2127
2128
|
});
|
|
2128
|
-
case
|
|
2129
|
-
status =
|
|
2129
|
+
case 1:
|
|
2130
|
+
status = _context12.sent;
|
|
2130
2131
|
libraryId = status.library_id;
|
|
2131
2132
|
this.Log("Copying stream ".concat(name, " to target ").concat(targetObjectId));
|
|
2132
2133
|
ValidateObject(targetObjectId);
|
|
2133
|
-
|
|
2134
|
+
_context12.next = 2;
|
|
2134
2135
|
return this.ContentObjectLibraryId({
|
|
2135
2136
|
objectId: targetObjectId
|
|
2136
2137
|
});
|
|
2137
|
-
case
|
|
2138
|
-
targetLibraryId =
|
|
2139
|
-
|
|
2138
|
+
case 2:
|
|
2139
|
+
targetLibraryId = _context12.sent;
|
|
2140
|
+
_context12.next = 3;
|
|
2140
2141
|
return this.authClient.KMSAddress({
|
|
2141
2142
|
objectId: targetObjectId
|
|
2142
2143
|
});
|
|
2143
|
-
case
|
|
2144
|
-
kmsAddress =
|
|
2144
|
+
case 3:
|
|
2145
|
+
kmsAddress = _context12.sent;
|
|
2145
2146
|
kmsCapId = "eluv.caps.ikms".concat(this.utils.AddressToHash(kmsAddress));
|
|
2146
|
-
|
|
2147
|
+
_context12.next = 4;
|
|
2147
2148
|
return this.ContentObjectMetadata({
|
|
2148
2149
|
libraryId: targetLibraryId,
|
|
2149
2150
|
objectId: targetObjectId,
|
|
2150
2151
|
metadataSubtree: kmsCapId
|
|
2151
2152
|
});
|
|
2152
|
-
case
|
|
2153
|
-
kmsCap =
|
|
2153
|
+
case 4:
|
|
2154
|
+
kmsCap = _context12.sent;
|
|
2154
2155
|
if (kmsCap) {
|
|
2155
|
-
|
|
2156
|
+
_context12.next = 5;
|
|
2156
2157
|
break;
|
|
2157
2158
|
}
|
|
2158
2159
|
throw Error("No content encryption key set for object ".concat(targetObjectId));
|
|
2159
|
-
case
|
|
2160
|
-
|
|
2160
|
+
case 5:
|
|
2161
|
+
_context12.prev = 5;
|
|
2161
2162
|
status.live_object_id = objectId;
|
|
2162
|
-
|
|
2163
|
+
_context12.next = 6;
|
|
2163
2164
|
return this.LatestVersionHash({
|
|
2164
2165
|
objectId: objectId,
|
|
2165
2166
|
libraryId: libraryId
|
|
2166
2167
|
});
|
|
2167
|
-
case
|
|
2168
|
-
liveHash =
|
|
2168
|
+
case 6:
|
|
2169
|
+
liveHash = _context12.sent;
|
|
2169
2170
|
status.live_hash = liveHash;
|
|
2170
2171
|
if (!eventId) {
|
|
2171
|
-
|
|
2172
|
+
_context12.next = 8;
|
|
2172
2173
|
break;
|
|
2173
2174
|
}
|
|
2174
|
-
|
|
2175
|
+
_context12.next = 7;
|
|
2175
2176
|
return this.CueInfo({
|
|
2176
2177
|
eventId: eventId,
|
|
2177
2178
|
status: status
|
|
2178
2179
|
});
|
|
2179
|
-
case
|
|
2180
|
-
event =
|
|
2180
|
+
case 7:
|
|
2181
|
+
event = _context12.sent;
|
|
2181
2182
|
if (event.eventStart && event.eventEnd) {
|
|
2182
2183
|
startTime = event.eventStart;
|
|
2183
2184
|
endTime = event.eventEnd;
|
|
2184
2185
|
}
|
|
2185
|
-
case
|
|
2186
|
-
|
|
2186
|
+
case 8:
|
|
2187
|
+
_context12.next = 9;
|
|
2187
2188
|
return this.EditContentObject({
|
|
2188
2189
|
objectId: targetObjectId,
|
|
2189
2190
|
libraryId: targetLibraryId
|
|
2190
2191
|
});
|
|
2191
|
-
case
|
|
2192
|
-
_yield$this$EditConte2 =
|
|
2192
|
+
case 9:
|
|
2193
|
+
_yield$this$EditConte2 = _context12.sent;
|
|
2193
2194
|
writeToken = _yield$this$EditConte2.writeToken;
|
|
2194
2195
|
status.target_object_id = targetObjectId;
|
|
2195
2196
|
status.target_library_id = targetLibraryId;
|
|
2196
2197
|
status.target_write_token = writeToken;
|
|
2197
2198
|
this.Log("Process live source (takes around 20 sec per hour of content)");
|
|
2198
|
-
|
|
2199
|
+
_context12.next = 10;
|
|
2199
2200
|
return this.CallBitcodeMethod({
|
|
2200
2201
|
libraryId: targetLibraryId,
|
|
2201
2202
|
objectId: targetObjectId,
|
|
@@ -2214,7 +2215,7 @@ exports.StreamCopyToVod = /*#__PURE__*/function () {
|
|
|
2214
2215
|
constant: false,
|
|
2215
2216
|
format: "text"
|
|
2216
2217
|
});
|
|
2217
|
-
case
|
|
2218
|
+
case 10:
|
|
2218
2219
|
abrMezInitBody = {
|
|
2219
2220
|
abr_profile: abrProfile,
|
|
2220
2221
|
"offering_key": "default",
|
|
@@ -2222,7 +2223,7 @@ exports.StreamCopyToVod = /*#__PURE__*/function () {
|
|
|
2222
2223
|
"variant_key": "default",
|
|
2223
2224
|
"keep_other_streams": false
|
|
2224
2225
|
};
|
|
2225
|
-
|
|
2226
|
+
_context12.next = 11;
|
|
2226
2227
|
return this.CallBitcodeMethod({
|
|
2227
2228
|
libraryId: targetLibraryId,
|
|
2228
2229
|
objectId: targetObjectId,
|
|
@@ -2232,9 +2233,9 @@ exports.StreamCopyToVod = /*#__PURE__*/function () {
|
|
|
2232
2233
|
constant: false,
|
|
2233
2234
|
format: "text"
|
|
2234
2235
|
});
|
|
2235
|
-
case
|
|
2236
|
-
|
|
2237
|
-
|
|
2236
|
+
case 11:
|
|
2237
|
+
_context12.prev = 11;
|
|
2238
|
+
_context12.next = 12;
|
|
2238
2239
|
return this.CallBitcodeMethod({
|
|
2239
2240
|
libraryId: targetLibraryId,
|
|
2240
2241
|
objectId: targetObjectId,
|
|
@@ -2244,16 +2245,16 @@ exports.StreamCopyToVod = /*#__PURE__*/function () {
|
|
|
2244
2245
|
constant: false,
|
|
2245
2246
|
format: "text"
|
|
2246
2247
|
});
|
|
2247
|
-
case
|
|
2248
|
-
|
|
2248
|
+
case 12:
|
|
2249
|
+
_context12.next = 14;
|
|
2249
2250
|
break;
|
|
2250
|
-
case
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
console.error("Unable to call /media/live_to_vod/copy",
|
|
2254
|
-
throw
|
|
2255
|
-
case
|
|
2256
|
-
|
|
2251
|
+
case 13:
|
|
2252
|
+
_context12.prev = 13;
|
|
2253
|
+
_t29 = _context12["catch"](11);
|
|
2254
|
+
console.error("Unable to call /media/live_to_vod/copy", _t29);
|
|
2255
|
+
throw _t29;
|
|
2256
|
+
case 14:
|
|
2257
|
+
_context12.next = 15;
|
|
2257
2258
|
return this.CallBitcodeMethod({
|
|
2258
2259
|
libraryId: targetLibraryId,
|
|
2259
2260
|
objectId: targetObjectId,
|
|
@@ -2263,22 +2264,22 @@ exports.StreamCopyToVod = /*#__PURE__*/function () {
|
|
|
2263
2264
|
constant: false,
|
|
2264
2265
|
format: "text"
|
|
2265
2266
|
});
|
|
2266
|
-
case
|
|
2267
|
+
case 15:
|
|
2267
2268
|
if (!finalize) {
|
|
2268
|
-
|
|
2269
|
+
_context12.next = 17;
|
|
2269
2270
|
break;
|
|
2270
2271
|
}
|
|
2271
|
-
|
|
2272
|
+
_context12.next = 16;
|
|
2272
2273
|
return this.FinalizeContentObject({
|
|
2273
2274
|
libraryId: targetLibraryId,
|
|
2274
2275
|
objectId: targetObjectId,
|
|
2275
2276
|
writeToken: writeToken,
|
|
2276
2277
|
commitMessage: "Live Stream to VoD"
|
|
2277
2278
|
});
|
|
2278
|
-
case
|
|
2279
|
-
finalizeResponse =
|
|
2279
|
+
case 16:
|
|
2280
|
+
finalizeResponse = _context12.sent;
|
|
2280
2281
|
status.target_hash = finalizeResponse.hash;
|
|
2281
|
-
case
|
|
2282
|
+
case 17:
|
|
2282
2283
|
// Clean up unnecessary status items
|
|
2283
2284
|
delete status.playout_urls;
|
|
2284
2285
|
delete status.lro_status_url;
|
|
@@ -2286,20 +2287,20 @@ exports.StreamCopyToVod = /*#__PURE__*/function () {
|
|
|
2286
2287
|
delete status.recording_period_sequence;
|
|
2287
2288
|
delete status.edge_meta_size;
|
|
2288
2289
|
delete status.insertions;
|
|
2289
|
-
return
|
|
2290
|
-
case
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
this.Log(
|
|
2294
|
-
throw
|
|
2295
|
-
case
|
|
2290
|
+
return _context12.abrupt("return", status);
|
|
2291
|
+
case 18:
|
|
2292
|
+
_context12.prev = 18;
|
|
2293
|
+
_t30 = _context12["catch"](5);
|
|
2294
|
+
this.Log(_t30, true);
|
|
2295
|
+
throw _t30;
|
|
2296
|
+
case 19:
|
|
2296
2297
|
case "end":
|
|
2297
|
-
return
|
|
2298
|
+
return _context12.stop();
|
|
2298
2299
|
}
|
|
2299
|
-
},
|
|
2300
|
+
}, _callee12, this, [[5, 18], [11, 13]]);
|
|
2300
2301
|
}));
|
|
2301
|
-
return function (
|
|
2302
|
-
return
|
|
2302
|
+
return function (_x11) {
|
|
2303
|
+
return _ref25.apply(this, arguments);
|
|
2303
2304
|
};
|
|
2304
2305
|
}();
|
|
2305
2306
|
|
|
@@ -2320,48 +2321,48 @@ exports.StreamCopyToVod = /*#__PURE__*/function () {
|
|
|
2320
2321
|
* @return {Promise<Object>} - The finalize response
|
|
2321
2322
|
*/
|
|
2322
2323
|
exports.StreamRemoveWatermark = /*#__PURE__*/function () {
|
|
2323
|
-
var
|
|
2324
|
-
var libraryId, objectId, writeToken, types,
|
|
2325
|
-
return _regeneratorRuntime.wrap(function
|
|
2326
|
-
while (1) switch (
|
|
2324
|
+
var _ref27 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref26) {
|
|
2325
|
+
var libraryId, objectId, writeToken, types, _ref26$finalize, finalize, _yield$this$EditConte3, edgeWriteToken, metadataPath, objectMetadata, finalizeResponse;
|
|
2326
|
+
return _regeneratorRuntime.wrap(function (_context13) {
|
|
2327
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
2327
2328
|
case 0:
|
|
2328
|
-
libraryId =
|
|
2329
|
+
libraryId = _ref26.libraryId, objectId = _ref26.objectId, writeToken = _ref26.writeToken, types = _ref26.types, _ref26$finalize = _ref26.finalize, finalize = _ref26$finalize === void 0 ? true : _ref26$finalize;
|
|
2329
2330
|
ValidateObject(objectId);
|
|
2330
2331
|
if (libraryId) {
|
|
2331
|
-
|
|
2332
|
+
_context13.next = 2;
|
|
2332
2333
|
break;
|
|
2333
2334
|
}
|
|
2334
|
-
|
|
2335
|
+
_context13.next = 1;
|
|
2335
2336
|
return this.ContentObjectLibraryId({
|
|
2336
2337
|
objectId: objectId
|
|
2337
2338
|
});
|
|
2338
|
-
case
|
|
2339
|
-
libraryId =
|
|
2340
|
-
case
|
|
2339
|
+
case 1:
|
|
2340
|
+
libraryId = _context13.sent;
|
|
2341
|
+
case 2:
|
|
2341
2342
|
if (writeToken) {
|
|
2342
|
-
|
|
2343
|
+
_context13.next = 4;
|
|
2343
2344
|
break;
|
|
2344
2345
|
}
|
|
2345
|
-
|
|
2346
|
+
_context13.next = 3;
|
|
2346
2347
|
return this.EditContentObject({
|
|
2347
2348
|
objectId: objectId,
|
|
2348
2349
|
libraryId: libraryId
|
|
2349
2350
|
});
|
|
2350
|
-
case
|
|
2351
|
-
_yield$this$EditConte3 =
|
|
2351
|
+
case 3:
|
|
2352
|
+
_yield$this$EditConte3 = _context13.sent;
|
|
2352
2353
|
writeToken = _yield$this$EditConte3.writeToken;
|
|
2353
|
-
case
|
|
2354
|
+
case 4:
|
|
2354
2355
|
this.Log("Removing watermark types: ".concat(types.join(", "), " ").concat(libraryId, " ").concat(objectId));
|
|
2355
|
-
|
|
2356
|
+
_context13.next = 5;
|
|
2356
2357
|
return this.ContentObjectMetadata({
|
|
2357
2358
|
objectId: objectId,
|
|
2358
2359
|
libraryId: libraryId,
|
|
2359
2360
|
metadataSubtree: "/live_recording/fabric_config/edge_write_token"
|
|
2360
2361
|
});
|
|
2361
|
-
case
|
|
2362
|
-
edgeWriteToken =
|
|
2362
|
+
case 5:
|
|
2363
|
+
edgeWriteToken = _context13.sent;
|
|
2363
2364
|
metadataPath = "live_recording/playout_config";
|
|
2364
|
-
|
|
2365
|
+
_context13.next = 6;
|
|
2365
2366
|
return this.ContentObjectMetadata({
|
|
2366
2367
|
libraryId: libraryId,
|
|
2367
2368
|
objectId: objectId,
|
|
@@ -2369,14 +2370,14 @@ exports.StreamRemoveWatermark = /*#__PURE__*/function () {
|
|
|
2369
2370
|
metadataSubtree: metadataPath,
|
|
2370
2371
|
resolveLinks: false
|
|
2371
2372
|
});
|
|
2372
|
-
case
|
|
2373
|
-
objectMetadata =
|
|
2373
|
+
case 6:
|
|
2374
|
+
objectMetadata = _context13.sent;
|
|
2374
2375
|
if (objectMetadata) {
|
|
2375
|
-
|
|
2376
|
+
_context13.next = 7;
|
|
2376
2377
|
break;
|
|
2377
2378
|
}
|
|
2378
2379
|
throw Error("Stream object must be configured before removing a watermark");
|
|
2379
|
-
case
|
|
2380
|
+
case 7:
|
|
2380
2381
|
types.forEach(function (type) {
|
|
2381
2382
|
if (type === "text") {
|
|
2382
2383
|
delete objectMetadata.simple_watermark;
|
|
@@ -2386,7 +2387,7 @@ exports.StreamRemoveWatermark = /*#__PURE__*/function () {
|
|
|
2386
2387
|
delete objectMetadata.forensic_watermark;
|
|
2387
2388
|
}
|
|
2388
2389
|
});
|
|
2389
|
-
|
|
2390
|
+
_context13.next = 8;
|
|
2390
2391
|
return this.ReplaceMetadata({
|
|
2391
2392
|
libraryId: libraryId,
|
|
2392
2393
|
objectId: objectId,
|
|
@@ -2394,12 +2395,12 @@ exports.StreamRemoveWatermark = /*#__PURE__*/function () {
|
|
|
2394
2395
|
metadataSubtree: metadataPath,
|
|
2395
2396
|
metadata: objectMetadata
|
|
2396
2397
|
});
|
|
2397
|
-
case
|
|
2398
|
+
case 8:
|
|
2398
2399
|
if (!edgeWriteToken) {
|
|
2399
|
-
|
|
2400
|
+
_context13.next = 9;
|
|
2400
2401
|
break;
|
|
2401
2402
|
}
|
|
2402
|
-
|
|
2403
|
+
_context13.next = 9;
|
|
2403
2404
|
return this.ReplaceMetadata({
|
|
2404
2405
|
libraryId: libraryId,
|
|
2405
2406
|
objectId: objectId,
|
|
@@ -2407,29 +2408,29 @@ exports.StreamRemoveWatermark = /*#__PURE__*/function () {
|
|
|
2407
2408
|
metadataSubtree: metadataPath,
|
|
2408
2409
|
metadata: objectMetadata
|
|
2409
2410
|
});
|
|
2410
|
-
case
|
|
2411
|
+
case 9:
|
|
2411
2412
|
if (!finalize) {
|
|
2412
|
-
|
|
2413
|
+
_context13.next = 11;
|
|
2413
2414
|
break;
|
|
2414
2415
|
}
|
|
2415
|
-
|
|
2416
|
+
_context13.next = 10;
|
|
2416
2417
|
return this.FinalizeContentObject({
|
|
2417
2418
|
libraryId: libraryId,
|
|
2418
2419
|
objectId: objectId,
|
|
2419
2420
|
writeToken: writeToken,
|
|
2420
2421
|
commitMessage: "Watermark removed"
|
|
2421
2422
|
});
|
|
2422
|
-
case
|
|
2423
|
-
finalizeResponse =
|
|
2424
|
-
return
|
|
2425
|
-
case
|
|
2423
|
+
case 10:
|
|
2424
|
+
finalizeResponse = _context13.sent;
|
|
2425
|
+
return _context13.abrupt("return", finalizeResponse);
|
|
2426
|
+
case 11:
|
|
2426
2427
|
case "end":
|
|
2427
|
-
return
|
|
2428
|
+
return _context13.stop();
|
|
2428
2429
|
}
|
|
2429
|
-
},
|
|
2430
|
+
}, _callee13, this);
|
|
2430
2431
|
}));
|
|
2431
|
-
return function (
|
|
2432
|
-
return
|
|
2432
|
+
return function (_x12) {
|
|
2433
|
+
return _ref27.apply(this, arguments);
|
|
2433
2434
|
};
|
|
2434
2435
|
}();
|
|
2435
2436
|
|
|
@@ -2484,49 +2485,49 @@ exports.StreamRemoveWatermark = /*#__PURE__*/function () {
|
|
|
2484
2485
|
* @return {Promise<Object>} - The finalize response
|
|
2485
2486
|
*/
|
|
2486
2487
|
exports.StreamAddWatermark = /*#__PURE__*/function () {
|
|
2487
|
-
var
|
|
2488
|
-
var libraryId, objectId, writeToken, simpleWatermark, imageWatermark, forensicWatermark,
|
|
2489
|
-
return _regeneratorRuntime.wrap(function
|
|
2490
|
-
while (1) switch (
|
|
2488
|
+
var _ref29 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref28) {
|
|
2489
|
+
var libraryId, objectId, writeToken, simpleWatermark, imageWatermark, forensicWatermark, _ref28$finalize, finalize, _yield$this$EditConte4, edgeWriteToken, watermarkType, metadataPath, objectMetadata, watermarkArgCount, response, finalizeResponse;
|
|
2490
|
+
return _regeneratorRuntime.wrap(function (_context14) {
|
|
2491
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
2491
2492
|
case 0:
|
|
2492
|
-
libraryId =
|
|
2493
|
+
libraryId = _ref28.libraryId, objectId = _ref28.objectId, writeToken = _ref28.writeToken, simpleWatermark = _ref28.simpleWatermark, imageWatermark = _ref28.imageWatermark, forensicWatermark = _ref28.forensicWatermark, _ref28$finalize = _ref28.finalize, finalize = _ref28$finalize === void 0 ? true : _ref28$finalize;
|
|
2493
2494
|
ValidateObject(objectId);
|
|
2494
2495
|
if (libraryId) {
|
|
2495
|
-
|
|
2496
|
+
_context14.next = 2;
|
|
2496
2497
|
break;
|
|
2497
2498
|
}
|
|
2498
|
-
|
|
2499
|
+
_context14.next = 1;
|
|
2499
2500
|
return this.ContentObjectLibraryId({
|
|
2500
2501
|
objectId: objectId
|
|
2501
2502
|
});
|
|
2502
|
-
case
|
|
2503
|
-
libraryId =
|
|
2504
|
-
case
|
|
2503
|
+
case 1:
|
|
2504
|
+
libraryId = _context14.sent;
|
|
2505
|
+
case 2:
|
|
2505
2506
|
if (writeToken) {
|
|
2506
|
-
|
|
2507
|
+
_context14.next = 4;
|
|
2507
2508
|
break;
|
|
2508
2509
|
}
|
|
2509
|
-
|
|
2510
|
+
_context14.next = 3;
|
|
2510
2511
|
return this.EditContentObject({
|
|
2511
2512
|
objectId: objectId,
|
|
2512
2513
|
libraryId: libraryId
|
|
2513
2514
|
});
|
|
2514
|
-
case
|
|
2515
|
-
_yield$this$EditConte4 =
|
|
2515
|
+
case 3:
|
|
2516
|
+
_yield$this$EditConte4 = _context14.sent;
|
|
2516
2517
|
writeToken = _yield$this$EditConte4.writeToken;
|
|
2517
|
-
case
|
|
2518
|
-
|
|
2518
|
+
case 4:
|
|
2519
|
+
_context14.next = 5;
|
|
2519
2520
|
return this.ContentObjectMetadata({
|
|
2520
2521
|
objectId: objectId,
|
|
2521
2522
|
libraryId: libraryId,
|
|
2522
2523
|
metadataSubtree: "/live_recording/fabric_config/edge_write_token"
|
|
2523
2524
|
});
|
|
2524
|
-
case
|
|
2525
|
-
edgeWriteToken =
|
|
2525
|
+
case 5:
|
|
2526
|
+
edgeWriteToken = _context14.sent;
|
|
2526
2527
|
watermarkType = imageWatermark ? "image" : forensicWatermark ? "forensic" : "text";
|
|
2527
2528
|
metadataPath = "live_recording/playout_config";
|
|
2528
2529
|
this.Log("Adding watermarking type: ".concat(watermarkType, " ").concat(libraryId, " ").concat(objectId));
|
|
2529
|
-
|
|
2530
|
+
_context14.next = 6;
|
|
2530
2531
|
return this.ContentObjectMetadata({
|
|
2531
2532
|
libraryId: libraryId,
|
|
2532
2533
|
objectId: objectId,
|
|
@@ -2534,30 +2535,30 @@ exports.StreamAddWatermark = /*#__PURE__*/function () {
|
|
|
2534
2535
|
metadataSubtree: metadataPath,
|
|
2535
2536
|
resolveLinks: false
|
|
2536
2537
|
});
|
|
2537
|
-
case
|
|
2538
|
-
objectMetadata =
|
|
2538
|
+
case 6:
|
|
2539
|
+
objectMetadata = _context14.sent;
|
|
2539
2540
|
if (objectMetadata) {
|
|
2540
|
-
|
|
2541
|
+
_context14.next = 7;
|
|
2541
2542
|
break;
|
|
2542
2543
|
}
|
|
2543
2544
|
throw Error("Stream object must be configured before adding a watermark");
|
|
2544
|
-
case
|
|
2545
|
+
case 7:
|
|
2545
2546
|
watermarkArgCount = [simpleWatermark, imageWatermark, forensicWatermark].filter(function (i) {
|
|
2546
2547
|
return !!i;
|
|
2547
2548
|
}).length;
|
|
2548
2549
|
console.log("watermark arg count", watermarkArgCount);
|
|
2549
2550
|
if (!(watermarkArgCount === 0)) {
|
|
2550
|
-
|
|
2551
|
+
_context14.next = 8;
|
|
2551
2552
|
break;
|
|
2552
2553
|
}
|
|
2553
2554
|
throw Error("No watermark was provided");
|
|
2554
|
-
case
|
|
2555
|
+
case 8:
|
|
2555
2556
|
if (!(watermarkArgCount > 1)) {
|
|
2556
|
-
|
|
2557
|
+
_context14.next = 9;
|
|
2557
2558
|
break;
|
|
2558
2559
|
}
|
|
2559
2560
|
throw Error("Only one watermark is allowed");
|
|
2560
|
-
case
|
|
2561
|
+
case 9:
|
|
2561
2562
|
if (simpleWatermark) {
|
|
2562
2563
|
objectMetadata.simple_watermark = simpleWatermark;
|
|
2563
2564
|
} else if (imageWatermark) {
|
|
@@ -2565,7 +2566,7 @@ exports.StreamAddWatermark = /*#__PURE__*/function () {
|
|
|
2565
2566
|
} else if (forensicWatermark) {
|
|
2566
2567
|
objectMetadata.forensic_watermark = forensicWatermark;
|
|
2567
2568
|
}
|
|
2568
|
-
|
|
2569
|
+
_context14.next = 10;
|
|
2569
2570
|
return this.ReplaceMetadata({
|
|
2570
2571
|
libraryId: libraryId,
|
|
2571
2572
|
objectId: objectId,
|
|
@@ -2573,12 +2574,12 @@ exports.StreamAddWatermark = /*#__PURE__*/function () {
|
|
|
2573
2574
|
metadataSubtree: metadataPath,
|
|
2574
2575
|
metadata: objectMetadata
|
|
2575
2576
|
});
|
|
2576
|
-
case
|
|
2577
|
+
case 10:
|
|
2577
2578
|
if (!edgeWriteToken) {
|
|
2578
|
-
|
|
2579
|
+
_context14.next = 11;
|
|
2579
2580
|
break;
|
|
2580
2581
|
}
|
|
2581
|
-
|
|
2582
|
+
_context14.next = 11;
|
|
2582
2583
|
return this.ReplaceMetadata({
|
|
2583
2584
|
libraryId: libraryId,
|
|
2584
2585
|
objectId: objectId,
|
|
@@ -2586,36 +2587,36 @@ exports.StreamAddWatermark = /*#__PURE__*/function () {
|
|
|
2586
2587
|
metadataSubtree: metadataPath,
|
|
2587
2588
|
metadata: objectMetadata
|
|
2588
2589
|
});
|
|
2589
|
-
case
|
|
2590
|
+
case 11:
|
|
2590
2591
|
response = {
|
|
2591
2592
|
"imageWatermark": objectMetadata.image_watermark,
|
|
2592
2593
|
"textWatermark": objectMetadata.simple_watermark,
|
|
2593
2594
|
"forensicWatermark": objectMetadata.forensic_watermark
|
|
2594
2595
|
};
|
|
2595
2596
|
if (!finalize) {
|
|
2596
|
-
|
|
2597
|
+
_context14.next = 13;
|
|
2597
2598
|
break;
|
|
2598
2599
|
}
|
|
2599
|
-
|
|
2600
|
+
_context14.next = 12;
|
|
2600
2601
|
return this.FinalizeContentObject({
|
|
2601
2602
|
libraryId: libraryId,
|
|
2602
2603
|
objectId: objectId,
|
|
2603
2604
|
writeToken: writeToken,
|
|
2604
2605
|
commitMessage: "Watermark set"
|
|
2605
2606
|
});
|
|
2606
|
-
case
|
|
2607
|
-
finalizeResponse =
|
|
2607
|
+
case 12:
|
|
2608
|
+
finalizeResponse = _context14.sent;
|
|
2608
2609
|
response.hash = finalizeResponse.hash;
|
|
2609
|
-
case
|
|
2610
|
-
return
|
|
2611
|
-
case
|
|
2610
|
+
case 13:
|
|
2611
|
+
return _context14.abrupt("return", response);
|
|
2612
|
+
case 14:
|
|
2612
2613
|
case "end":
|
|
2613
|
-
return
|
|
2614
|
+
return _context14.stop();
|
|
2614
2615
|
}
|
|
2615
|
-
},
|
|
2616
|
+
}, _callee14, this);
|
|
2616
2617
|
}));
|
|
2617
|
-
return function (
|
|
2618
|
-
return
|
|
2618
|
+
return function (_x13) {
|
|
2619
|
+
return _ref29.apply(this, arguments);
|
|
2619
2620
|
};
|
|
2620
2621
|
}();
|
|
2621
2622
|
|
|
@@ -2633,13 +2634,13 @@ exports.StreamAddWatermark = /*#__PURE__*/function () {
|
|
|
2633
2634
|
* @returns {Promise<Object>} - Response describing audit results
|
|
2634
2635
|
*/
|
|
2635
2636
|
exports.AuditStream = /*#__PURE__*/function () {
|
|
2636
|
-
var
|
|
2637
|
+
var _ref31 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref30) {
|
|
2637
2638
|
var objectId, versionHash, salt, samples, authorizationToken;
|
|
2638
|
-
return _regeneratorRuntime.wrap(function
|
|
2639
|
-
while (1) switch (
|
|
2639
|
+
return _regeneratorRuntime.wrap(function (_context15) {
|
|
2640
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
2640
2641
|
case 0:
|
|
2641
|
-
objectId =
|
|
2642
|
-
|
|
2642
|
+
objectId = _ref30.objectId, versionHash = _ref30.versionHash, salt = _ref30.salt, samples = _ref30.samples, authorizationToken = _ref30.authorizationToken;
|
|
2643
|
+
_context15.next = 1;
|
|
2643
2644
|
return ContentObjectAudit.AuditContentObject({
|
|
2644
2645
|
client: this,
|
|
2645
2646
|
objectId: objectId,
|
|
@@ -2649,15 +2650,15 @@ exports.AuditStream = /*#__PURE__*/function () {
|
|
|
2649
2650
|
live: true,
|
|
2650
2651
|
authorizationToken: authorizationToken
|
|
2651
2652
|
});
|
|
2652
|
-
case
|
|
2653
|
-
return
|
|
2654
|
-
case
|
|
2653
|
+
case 1:
|
|
2654
|
+
return _context15.abrupt("return", _context15.sent);
|
|
2655
|
+
case 2:
|
|
2655
2656
|
case "end":
|
|
2656
|
-
return
|
|
2657
|
+
return _context15.stop();
|
|
2657
2658
|
}
|
|
2658
|
-
},
|
|
2659
|
+
}, _callee15, this);
|
|
2659
2660
|
}));
|
|
2660
|
-
return function (
|
|
2661
|
-
return
|
|
2661
|
+
return function (_x14) {
|
|
2662
|
+
return _ref31.apply(this, arguments);
|
|
2662
2663
|
};
|
|
2663
2664
|
}();
|