@eluvio/elv-client-js 4.2.11 → 4.2.13
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 +710 -723
- package/dist/src/ContentObjectAudit.js +56 -56
- package/dist/src/Crypto.js +85 -85
- package/dist/src/ElvClient.js +530 -500
- 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 +114 -163
- 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 -6
- package/dist/src/client/LiveStream.js +723 -686
- 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 +579 -581
- package/package.json +1 -1
- package/src/client/ContentAccess.js +1 -1
- package/src/client/LiveStream.js +2 -1
- 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
|
}
|
|
@@ -412,6 +414,7 @@ var StreamGenerateOffering = /*#__PURE__*/function () {
|
|
|
412
414
|
* @methodGroup Live Stream
|
|
413
415
|
* @namedParams
|
|
414
416
|
* @param {string} name - Object ID or name of the live stream object
|
|
417
|
+
* @param {boolean=} stopLro - If specified, will stop LRO
|
|
415
418
|
* @param {boolean=} showParams - If specified, will return recording_params with status
|
|
416
419
|
* States:
|
|
417
420
|
* unconfigured - no live_recording_config
|
|
@@ -425,57 +428,57 @@ var StreamGenerateOffering = /*#__PURE__*/function () {
|
|
|
425
428
|
* @return {Promise<Object>} - The status response for the object, as well as logs, warnings and errors from the master initialization
|
|
426
429
|
*/
|
|
427
430
|
exports.StreamStatus = /*#__PURE__*/function () {
|
|
428
|
-
var _ref8 = _asyncToGenerator(
|
|
429
|
-
var name, _ref7$showParams, showParams, objectId, status, libraryId, mainMeta, fabURI, edgeWriteToken, edgeMeta, recordings, sequence, period, tlro, videoLastFinalizationTimeEpochSec, videoFinalizedParts, sinceLastFinalize, recording_period, insertions, i, insertionTimeSinceEpoch, state, lroStatus, playout_urls, playout_options, hls_clear_enabled, hls_aes128_enabled, hls_sample_aes_enabled, networkInfo, token, embed_net, embed_url;
|
|
430
|
-
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) {
|
|
431
434
|
while (1) switch (_context4.prev = _context4.next) {
|
|
432
435
|
case 0:
|
|
433
|
-
name = _ref7.name, _ref7$showParams = _ref7.showParams, showParams = _ref7$showParams === void 0 ? false : _ref7$showParams;
|
|
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;
|
|
434
437
|
objectId = name;
|
|
435
438
|
status = {
|
|
436
439
|
name: name
|
|
437
440
|
};
|
|
438
|
-
_context4.prev =
|
|
439
|
-
_context4.next =
|
|
441
|
+
_context4.prev = 1;
|
|
442
|
+
_context4.next = 2;
|
|
440
443
|
return this.ContentObjectLibraryId({
|
|
441
444
|
objectId: objectId
|
|
442
445
|
});
|
|
443
|
-
case
|
|
446
|
+
case 2:
|
|
444
447
|
libraryId = _context4.sent;
|
|
445
448
|
status.library_id = libraryId;
|
|
446
449
|
status.object_id = objectId;
|
|
447
|
-
_context4.next =
|
|
450
|
+
_context4.next = 3;
|
|
448
451
|
return this.ContentObjectMetadata({
|
|
449
452
|
libraryId: libraryId,
|
|
450
453
|
objectId: objectId,
|
|
451
454
|
select: ["live_recording_config", "live_recording"]
|
|
452
455
|
});
|
|
453
|
-
case
|
|
456
|
+
case 3:
|
|
454
457
|
mainMeta = _context4.sent;
|
|
455
458
|
status.reference_url = mainMeta.live_recording_config.reference_url;
|
|
456
459
|
if (!(mainMeta.live_recording_config == undefined || mainMeta.live_recording_config.url == undefined)) {
|
|
457
|
-
_context4.next =
|
|
460
|
+
_context4.next = 4;
|
|
458
461
|
break;
|
|
459
462
|
}
|
|
460
463
|
status.state = "unconfigured";
|
|
461
464
|
return _context4.abrupt("return", status);
|
|
462
|
-
case
|
|
465
|
+
case 4:
|
|
463
466
|
if (!(mainMeta.live_recording == undefined || mainMeta.live_recording.fabric_config == undefined || mainMeta.live_recording.playout_config == undefined || mainMeta.live_recording.recording_config == undefined)) {
|
|
464
|
-
_context4.next =
|
|
467
|
+
_context4.next = 5;
|
|
465
468
|
break;
|
|
466
469
|
}
|
|
467
470
|
status.state = "uninitialized";
|
|
468
471
|
return _context4.abrupt("return", status);
|
|
469
|
-
case
|
|
472
|
+
case 5:
|
|
470
473
|
fabURI = mainMeta.live_recording.fabric_config.ingress_node_api;
|
|
471
474
|
if (!(fabURI === undefined)) {
|
|
472
|
-
_context4.next =
|
|
475
|
+
_context4.next = 6;
|
|
473
476
|
break;
|
|
474
477
|
}
|
|
475
478
|
console.log("bad fabric config - missing ingress node API");
|
|
476
479
|
status.state = "uninitialized";
|
|
477
480
|
return _context4.abrupt("return", status);
|
|
478
|
-
case
|
|
481
|
+
case 6:
|
|
479
482
|
// Support both hostname and URL ingress_node_api
|
|
480
483
|
if (!fabURI.startsWith("http")) {
|
|
481
484
|
// Assume https
|
|
@@ -485,52 +488,52 @@ exports.StreamStatus = /*#__PURE__*/function () {
|
|
|
485
488
|
status.url = mainMeta.live_recording.recording_config.recording_params.origin_url;
|
|
486
489
|
edgeWriteToken = mainMeta.live_recording.fabric_config.edge_write_token;
|
|
487
490
|
if (edgeWriteToken) {
|
|
488
|
-
_context4.next =
|
|
491
|
+
_context4.next = 7;
|
|
489
492
|
break;
|
|
490
493
|
}
|
|
491
494
|
status.state = "inactive";
|
|
492
495
|
return _context4.abrupt("return", status);
|
|
493
|
-
case
|
|
496
|
+
case 7:
|
|
494
497
|
this.RecordWriteToken({
|
|
495
498
|
writeToken: edgeWriteToken,
|
|
496
499
|
fabricNodeUrl: fabURI
|
|
497
500
|
});
|
|
498
501
|
status.edge_write_token = edgeWriteToken;
|
|
499
502
|
status.stream_id = edgeWriteToken; // By convention the stream ID is its write token
|
|
500
|
-
_context4.prev =
|
|
501
|
-
_context4.next =
|
|
502
|
-
return this.
|
|
503
|
+
_context4.prev = 8;
|
|
504
|
+
_context4.next = 9;
|
|
505
|
+
return this.ContentObjectMetadata({
|
|
503
506
|
libraryId: libraryId,
|
|
504
507
|
objectId: objectId,
|
|
505
|
-
|
|
506
|
-
|
|
508
|
+
writeToken: edgeWriteToken,
|
|
509
|
+
select: ["live_recording"]
|
|
507
510
|
});
|
|
508
|
-
case
|
|
511
|
+
case 9:
|
|
509
512
|
edgeMeta = _context4.sent;
|
|
510
|
-
_context4.next =
|
|
513
|
+
_context4.next = 11;
|
|
511
514
|
break;
|
|
512
|
-
case
|
|
513
|
-
_context4.prev =
|
|
514
|
-
|
|
515
|
-
if (
|
|
515
|
+
case 10:
|
|
516
|
+
_context4.prev = 10;
|
|
517
|
+
_t5 = _context4["catch"](8);
|
|
518
|
+
if (_t5.message && _t5.message.includes("ERR_TOO_MANY_REDIRECTS")) {
|
|
516
519
|
console.error("Redirect loop detected when trying to read metadata.");
|
|
517
520
|
status.state = "unavailable";
|
|
518
521
|
} else {
|
|
519
|
-
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);
|
|
520
523
|
status.state = "inactive";
|
|
521
524
|
}
|
|
522
525
|
return _context4.abrupt("return", status);
|
|
523
|
-
case
|
|
526
|
+
case 11:
|
|
524
527
|
status.edge_meta_size = JSON.stringify(edgeMeta || "").length;
|
|
525
528
|
|
|
526
529
|
// If a stream has never been started return state 'inactive'
|
|
527
530
|
if (!(edgeMeta.live_recording === undefined || edgeMeta.live_recording.recordings === undefined || edgeMeta.live_recording.recordings.recording_sequence === undefined)) {
|
|
528
|
-
_context4.next =
|
|
531
|
+
_context4.next = 12;
|
|
529
532
|
break;
|
|
530
533
|
}
|
|
531
|
-
status.state = "
|
|
534
|
+
status.state = "stopped";
|
|
532
535
|
return _context4.abrupt("return", status);
|
|
533
|
-
case
|
|
536
|
+
case 12:
|
|
534
537
|
recordings = edgeMeta.live_recording.recordings;
|
|
535
538
|
status.recording_period_sequence = recordings.recording_sequence;
|
|
536
539
|
sequence = recordings.recording_sequence;
|
|
@@ -556,14 +559,14 @@ exports.StreamStatus = /*#__PURE__*/function () {
|
|
|
556
559
|
video_since_last_finalize_sec: sinceLastFinalize
|
|
557
560
|
};
|
|
558
561
|
status.recording_period = recording_period;
|
|
559
|
-
_context4.next =
|
|
562
|
+
_context4.next = 13;
|
|
560
563
|
return this.FabricUrl({
|
|
561
564
|
libraryId: libraryId,
|
|
562
565
|
objectId: objectId,
|
|
563
566
|
writeToken: edgeWriteToken,
|
|
564
|
-
call: "live/status"
|
|
567
|
+
call: "live/status/" + tlro
|
|
565
568
|
});
|
|
566
|
-
case
|
|
569
|
+
case 13:
|
|
567
570
|
status.lro_status_url = _context4.sent;
|
|
568
571
|
status.insertions = [];
|
|
569
572
|
if (edgeMeta.live_recording.playout_config.interleaves != undefined && edgeMeta.live_recording.playout_config.interleaves[sequence] != undefined) {
|
|
@@ -583,15 +586,15 @@ exports.StreamStatus = /*#__PURE__*/function () {
|
|
|
583
586
|
}
|
|
584
587
|
state = "stopped";
|
|
585
588
|
lroStatus = "";
|
|
586
|
-
_context4.prev =
|
|
587
|
-
|
|
588
|
-
_context4.next =
|
|
589
|
+
_context4.prev = 14;
|
|
590
|
+
_t6 = this.utils;
|
|
591
|
+
_context4.next = 15;
|
|
589
592
|
return HttpClient.Fetch(status.lro_status_url);
|
|
590
|
-
case
|
|
591
|
-
|
|
592
|
-
_context4.next =
|
|
593
|
-
return
|
|
594
|
-
case
|
|
593
|
+
case 15:
|
|
594
|
+
_t7 = _context4.sent;
|
|
595
|
+
_context4.next = 16;
|
|
596
|
+
return _t6.ResponseToJson.call(_t6, _t7);
|
|
597
|
+
case 16:
|
|
595
598
|
lroStatus = _context4.sent;
|
|
596
599
|
state = lroStatus.state;
|
|
597
600
|
status.warnings = lroStatus.custom && lroStatus.custom.warnings;
|
|
@@ -599,82 +602,117 @@ exports.StreamStatus = /*#__PURE__*/function () {
|
|
|
599
602
|
if (lroStatus.custom && lroStatus.custom.status) {
|
|
600
603
|
status.recording_status = lroStatus.custom.status;
|
|
601
604
|
}
|
|
602
|
-
_context4.next =
|
|
605
|
+
_context4.next = 18;
|
|
603
606
|
break;
|
|
604
|
-
case
|
|
605
|
-
_context4.prev =
|
|
606
|
-
|
|
607
|
-
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);
|
|
608
611
|
status.state = "stopped";
|
|
609
|
-
status.error =
|
|
612
|
+
status.error = _t8.response;
|
|
610
613
|
return _context4.abrupt("return", status);
|
|
611
|
-
case
|
|
612
|
-
// Convert LRO 'state' to desired 'state'
|
|
614
|
+
case 18:
|
|
615
|
+
segDurationMeta = edgeMeta.live_recording.recording_config.recording_params.xc_params.seg_duration; // Convert LRO 'state' to desired 'state'
|
|
613
616
|
if (state === "running" && videoLastFinalizationTimeEpochSec <= 0) {
|
|
614
|
-
state = "starting";
|
|
617
|
+
state = "starting";
|
|
618
|
+
} else if (state === "running" && segDurationMeta !== undefined && sinceLastFinalize > parseInt(segDurationMeta) + 5) {
|
|
619
|
+
state = "stalled";
|
|
615
620
|
} else if (state == "terminated") {
|
|
616
|
-
state = "stopped";
|
|
621
|
+
state = "stopped";
|
|
617
622
|
}
|
|
618
|
-
|
|
619
623
|
status.state = state;
|
|
624
|
+
if (!((state === "running" || state === "stalled" || state === "starting") && stopLro)) {
|
|
625
|
+
_context4.next = 25;
|
|
626
|
+
break;
|
|
627
|
+
}
|
|
628
|
+
_context4.next = 19;
|
|
629
|
+
return this.FabricUrl({
|
|
630
|
+
libraryId: libraryId,
|
|
631
|
+
objectId: objectId,
|
|
632
|
+
writeToken: edgeWriteToken,
|
|
633
|
+
call: "live/stop/" + tlro
|
|
634
|
+
});
|
|
635
|
+
case 19:
|
|
636
|
+
lroStopUrl = _context4.sent;
|
|
637
|
+
_context4.prev = 20;
|
|
638
|
+
_t9 = this.utils;
|
|
639
|
+
_context4.next = 21;
|
|
640
|
+
return HttpClient.Fetch(lroStopUrl);
|
|
641
|
+
case 21:
|
|
642
|
+
_t0 = _context4.sent;
|
|
643
|
+
_context4.next = 22;
|
|
644
|
+
return _t9.ResponseToJson.call(_t9, _t0);
|
|
645
|
+
case 22:
|
|
646
|
+
console.log("LRO Stop: ", lroStatus.body);
|
|
647
|
+
_context4.next = 24;
|
|
648
|
+
break;
|
|
649
|
+
case 23:
|
|
650
|
+
_context4.prev = 23;
|
|
651
|
+
_t1 = _context4["catch"](20);
|
|
652
|
+
console.log("LRO Stop (failed): ", _t1.response.statusCode);
|
|
653
|
+
case 24:
|
|
654
|
+
state = "stopped";
|
|
655
|
+
status.state = state;
|
|
656
|
+
case 25:
|
|
620
657
|
if (!(state === "running")) {
|
|
621
|
-
_context4.next =
|
|
658
|
+
_context4.next = 35;
|
|
622
659
|
break;
|
|
623
660
|
}
|
|
624
661
|
playout_urls = {};
|
|
625
|
-
_context4.next =
|
|
662
|
+
_context4.next = 26;
|
|
626
663
|
return this.PlayoutOptions({
|
|
627
|
-
objectId: objectId
|
|
664
|
+
objectId: objectId,
|
|
665
|
+
linkPath: "public/asset_metadata/sources/default"
|
|
628
666
|
});
|
|
629
|
-
case
|
|
667
|
+
case 26:
|
|
630
668
|
playout_options = _context4.sent;
|
|
631
669
|
hls_clear_enabled = playout_options && playout_options.hls && playout_options.hls.playoutMethods && playout_options.hls.playoutMethods.clear !== undefined;
|
|
632
670
|
if (!hls_clear_enabled) {
|
|
633
|
-
_context4.next =
|
|
671
|
+
_context4.next = 28;
|
|
634
672
|
break;
|
|
635
673
|
}
|
|
636
|
-
_context4.next =
|
|
674
|
+
_context4.next = 27;
|
|
637
675
|
return this.FabricUrl({
|
|
638
676
|
libraryId: libraryId,
|
|
639
677
|
objectId: objectId,
|
|
640
678
|
rep: "playout/default/hls-clear/playlist.m3u8"
|
|
641
679
|
});
|
|
642
|
-
case
|
|
680
|
+
case 27:
|
|
643
681
|
playout_urls.hls_clear = _context4.sent;
|
|
644
|
-
case
|
|
682
|
+
case 28:
|
|
645
683
|
hls_aes128_enabled = playout_options && playout_options.hls && playout_options.hls.playoutMethods && playout_options.hls.playoutMethods["aes-128"] !== undefined;
|
|
646
684
|
if (!hls_aes128_enabled) {
|
|
647
|
-
_context4.next =
|
|
685
|
+
_context4.next = 30;
|
|
648
686
|
break;
|
|
649
687
|
}
|
|
650
|
-
_context4.next =
|
|
688
|
+
_context4.next = 29;
|
|
651
689
|
return this.FabricUrl({
|
|
652
690
|
libraryId: libraryId,
|
|
653
691
|
objectId: objectId,
|
|
654
692
|
rep: "playout/default/hls-aes128/playlist.m3u8"
|
|
655
693
|
});
|
|
656
|
-
case
|
|
694
|
+
case 29:
|
|
657
695
|
playout_urls.hls_aes128 = _context4.sent;
|
|
658
|
-
case
|
|
696
|
+
case 30:
|
|
659
697
|
hls_sample_aes_enabled = playout_options && playout_options.hls && playout_options.hls.playoutMethods && playout_options.hls.playoutMethods["sample-aes"] !== undefined;
|
|
660
698
|
if (!hls_sample_aes_enabled) {
|
|
661
|
-
_context4.next =
|
|
699
|
+
_context4.next = 32;
|
|
662
700
|
break;
|
|
663
701
|
}
|
|
664
|
-
_context4.next =
|
|
702
|
+
_context4.next = 31;
|
|
665
703
|
return this.FabricUrl({
|
|
666
704
|
libraryId: libraryId,
|
|
667
705
|
objectId: objectId,
|
|
668
706
|
rep: "playout/default/hls-sample-aes/playlist.m3u8"
|
|
669
707
|
});
|
|
670
|
-
case
|
|
708
|
+
case 31:
|
|
671
709
|
playout_urls.hls_sample_aes = _context4.sent;
|
|
672
|
-
case
|
|
673
|
-
_context4.next =
|
|
710
|
+
case 32:
|
|
711
|
+
_context4.next = 33;
|
|
674
712
|
return this.NetworkInfo();
|
|
675
|
-
case
|
|
713
|
+
case 33:
|
|
676
714
|
networkInfo = _context4.sent;
|
|
677
|
-
_context4.next =
|
|
715
|
+
_context4.next = 34;
|
|
678
716
|
return this.authClient.AuthorizationToken({
|
|
679
717
|
libraryId: libraryId,
|
|
680
718
|
objectId: objectId,
|
|
@@ -682,7 +720,7 @@ exports.StreamStatus = /*#__PURE__*/function () {
|
|
|
682
720
|
noCache: true,
|
|
683
721
|
noAuth: true
|
|
684
722
|
});
|
|
685
|
-
case
|
|
723
|
+
case 34:
|
|
686
724
|
token = _context4.sent;
|
|
687
725
|
embed_net = "main";
|
|
688
726
|
if (networkInfo.name.includes("demo")) {
|
|
@@ -691,20 +729,20 @@ exports.StreamStatus = /*#__PURE__*/function () {
|
|
|
691
729
|
embed_url = "https://embed.v3.contentfabric.io/?net=".concat(embed_net, "&p&ct=h&oid=").concat(objectId, "&mt=lv&ath=").concat(token);
|
|
692
730
|
playout_urls.embed_url = embed_url;
|
|
693
731
|
status.playout_urls = playout_urls;
|
|
694
|
-
case
|
|
695
|
-
_context4.next =
|
|
732
|
+
case 35:
|
|
733
|
+
_context4.next = 37;
|
|
696
734
|
break;
|
|
697
|
-
case
|
|
698
|
-
_context4.prev =
|
|
699
|
-
|
|
700
|
-
console.error(
|
|
701
|
-
case
|
|
735
|
+
case 36:
|
|
736
|
+
_context4.prev = 36;
|
|
737
|
+
_t10 = _context4["catch"](1);
|
|
738
|
+
console.error(_t10);
|
|
739
|
+
case 37:
|
|
702
740
|
return _context4.abrupt("return", status);
|
|
703
|
-
case
|
|
741
|
+
case 38:
|
|
704
742
|
case "end":
|
|
705
743
|
return _context4.stop();
|
|
706
744
|
}
|
|
707
|
-
}, _callee4, this, [[
|
|
745
|
+
}, _callee4, this, [[1, 36], [8, 10], [14, 17], [20, 23]]);
|
|
708
746
|
}));
|
|
709
747
|
return function (_x4) {
|
|
710
748
|
return _ref8.apply(this, arguments);
|
|
@@ -723,42 +761,42 @@ exports.StreamStatus = /*#__PURE__*/function () {
|
|
|
723
761
|
*
|
|
724
762
|
*/
|
|
725
763
|
exports.StreamCreate = /*#__PURE__*/function () {
|
|
726
|
-
var
|
|
764
|
+
var _ref0 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref9) {
|
|
727
765
|
var name, _ref9$start, start, status, objectId, libraryId, liveRecording, fabURI, response, edgeToken, writeToken, objectHash;
|
|
728
|
-
return _regeneratorRuntime.wrap(function
|
|
766
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
729
767
|
while (1) switch (_context5.prev = _context5.next) {
|
|
730
768
|
case 0:
|
|
731
769
|
name = _ref9.name, _ref9$start = _ref9.start, start = _ref9$start === void 0 ? false : _ref9$start;
|
|
732
|
-
_context5.next =
|
|
770
|
+
_context5.next = 1;
|
|
733
771
|
return this.StreamStatus({
|
|
734
772
|
name: name
|
|
735
773
|
});
|
|
736
|
-
case
|
|
774
|
+
case 1:
|
|
737
775
|
status = _context5.sent;
|
|
738
776
|
if (!(status.state != "uninitialized" && status.state !== "inactive" && status.state !== "terminated" && status.state !== "stopped")) {
|
|
739
|
-
_context5.next =
|
|
777
|
+
_context5.next = 2;
|
|
740
778
|
break;
|
|
741
779
|
}
|
|
742
780
|
return _context5.abrupt("return", {
|
|
743
781
|
state: status.state,
|
|
744
782
|
error: "stream still active - must terminate first"
|
|
745
783
|
});
|
|
746
|
-
case
|
|
784
|
+
case 2:
|
|
747
785
|
objectId = status.object_id;
|
|
748
786
|
console.log("START: ", name, "start", start);
|
|
749
|
-
_context5.next =
|
|
787
|
+
_context5.next = 3;
|
|
750
788
|
return this.ContentObjectLibraryId({
|
|
751
789
|
objectId: objectId
|
|
752
790
|
});
|
|
753
|
-
case
|
|
791
|
+
case 3:
|
|
754
792
|
libraryId = _context5.sent;
|
|
755
|
-
_context5.next =
|
|
793
|
+
_context5.next = 4;
|
|
756
794
|
return this.ContentObjectMetadata({
|
|
757
795
|
libraryId: libraryId,
|
|
758
796
|
objectId: objectId,
|
|
759
797
|
metadataSubtree: "/live_recording"
|
|
760
798
|
});
|
|
761
|
-
case
|
|
799
|
+
case 4:
|
|
762
800
|
liveRecording = _context5.sent;
|
|
763
801
|
fabURI = liveRecording.fabric_config.ingress_node_api; // Support both hostname and URL ingress_node_api
|
|
764
802
|
if (!fabURI.startsWith("http")) {
|
|
@@ -769,12 +807,12 @@ exports.StreamCreate = /*#__PURE__*/function () {
|
|
|
769
807
|
fabricURIs: [fabURI]
|
|
770
808
|
});
|
|
771
809
|
console.log("Node URI", fabURI, "ID", liveRecording.fabric_config.ingress_node_id);
|
|
772
|
-
_context5.next =
|
|
810
|
+
_context5.next = 5;
|
|
773
811
|
return this.EditContentObject({
|
|
774
812
|
libraryId: libraryId,
|
|
775
813
|
objectId: objectId
|
|
776
814
|
});
|
|
777
|
-
case
|
|
815
|
+
case 5:
|
|
778
816
|
response = _context5.sent;
|
|
779
817
|
edgeToken = response.write_token;
|
|
780
818
|
console.log("Edge token:", edgeToken);
|
|
@@ -782,16 +820,16 @@ exports.StreamCreate = /*#__PURE__*/function () {
|
|
|
782
820
|
/*
|
|
783
821
|
* Set the metadata, including the edge token.
|
|
784
822
|
*/
|
|
785
|
-
_context5.next =
|
|
823
|
+
_context5.next = 6;
|
|
786
824
|
return this.EditContentObject({
|
|
787
825
|
libraryId: libraryId,
|
|
788
826
|
objectId: objectId
|
|
789
827
|
});
|
|
790
|
-
case
|
|
828
|
+
case 6:
|
|
791
829
|
response = _context5.sent;
|
|
792
830
|
writeToken = response.write_token;
|
|
793
831
|
this.Log("Merging metadata: ", libraryId, objectId, writeToken);
|
|
794
|
-
_context5.next =
|
|
832
|
+
_context5.next = 7;
|
|
795
833
|
return this.MergeMetadata({
|
|
796
834
|
libraryId: libraryId,
|
|
797
835
|
objectId: objectId,
|
|
@@ -802,23 +840,22 @@ exports.StreamCreate = /*#__PURE__*/function () {
|
|
|
802
840
|
edge_write_token: edgeToken,
|
|
803
841
|
state: "active" // indicates there is an active session (set to 'closed' when done)
|
|
804
842
|
},
|
|
805
|
-
|
|
806
843
|
fabric_config: {
|
|
807
844
|
edge_write_token: edgeToken
|
|
808
845
|
}
|
|
809
846
|
}
|
|
810
847
|
}
|
|
811
848
|
});
|
|
812
|
-
case
|
|
849
|
+
case 7:
|
|
813
850
|
this.Log("Finalizing content draft: ", libraryId, objectId, writeToken);
|
|
814
|
-
_context5.next =
|
|
851
|
+
_context5.next = 8;
|
|
815
852
|
return this.FinalizeContentObject({
|
|
816
853
|
libraryId: libraryId,
|
|
817
854
|
objectId: objectId,
|
|
818
855
|
writeToken: writeToken,
|
|
819
856
|
commitMessage: "Create stream edge write token " + edgeToken
|
|
820
857
|
});
|
|
821
|
-
case
|
|
858
|
+
case 8:
|
|
822
859
|
response = _context5.sent;
|
|
823
860
|
objectHash = response.hash;
|
|
824
861
|
this.Log("Finalized object: ", objectHash);
|
|
@@ -838,14 +875,14 @@ exports.StreamCreate = /*#__PURE__*/function () {
|
|
|
838
875
|
});
|
|
839
876
|
}
|
|
840
877
|
return _context5.abrupt("return", status);
|
|
841
|
-
case
|
|
878
|
+
case 9:
|
|
842
879
|
case "end":
|
|
843
880
|
return _context5.stop();
|
|
844
881
|
}
|
|
845
882
|
}, _callee5, this);
|
|
846
883
|
}));
|
|
847
884
|
return function (_x5) {
|
|
848
|
-
return
|
|
885
|
+
return _ref0.apply(this, arguments);
|
|
849
886
|
};
|
|
850
887
|
}();
|
|
851
888
|
|
|
@@ -866,36 +903,36 @@ exports.StreamCreate = /*#__PURE__*/function () {
|
|
|
866
903
|
*
|
|
867
904
|
*/
|
|
868
905
|
exports.StreamStartOrStopOrReset = /*#__PURE__*/function () {
|
|
869
|
-
var
|
|
870
|
-
var name, op, status, _tries, tries;
|
|
871
|
-
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) {
|
|
872
909
|
while (1) switch (_context6.prev = _context6.next) {
|
|
873
910
|
case 0:
|
|
874
|
-
name =
|
|
911
|
+
name = _ref1.name, op = _ref1.op;
|
|
875
912
|
_context6.prev = 1;
|
|
876
|
-
_context6.next =
|
|
913
|
+
_context6.next = 2;
|
|
877
914
|
return this.StreamStatus({
|
|
878
915
|
name: name
|
|
879
916
|
});
|
|
880
|
-
case
|
|
917
|
+
case 2:
|
|
881
918
|
status = _context6.sent;
|
|
882
919
|
if (!(status.state != "stopped")) {
|
|
883
|
-
_context6.next =
|
|
920
|
+
_context6.next = 3;
|
|
884
921
|
break;
|
|
885
922
|
}
|
|
886
923
|
if (!(op === "start")) {
|
|
887
|
-
_context6.next =
|
|
924
|
+
_context6.next = 3;
|
|
888
925
|
break;
|
|
889
926
|
}
|
|
890
927
|
status.error = "Unable to start stream - state: " + status.state;
|
|
891
928
|
return _context6.abrupt("return", status);
|
|
892
|
-
case
|
|
929
|
+
case 3:
|
|
893
930
|
if (!(status.state == "running" || status.state == "starting" || status.state == "stalled")) {
|
|
894
|
-
_context6.next =
|
|
931
|
+
_context6.next = 12;
|
|
895
932
|
break;
|
|
896
933
|
}
|
|
897
|
-
_context6.prev =
|
|
898
|
-
_context6.next =
|
|
934
|
+
_context6.prev = 4;
|
|
935
|
+
_context6.next = 5;
|
|
899
936
|
return this.CallBitcodeMethod({
|
|
900
937
|
libraryId: status.library_id,
|
|
901
938
|
objectId: status.object_id,
|
|
@@ -903,50 +940,50 @@ exports.StreamStartOrStopOrReset = /*#__PURE__*/function () {
|
|
|
903
940
|
method: "/live/stop/" + status.tlro,
|
|
904
941
|
constant: false
|
|
905
942
|
});
|
|
906
|
-
case
|
|
907
|
-
_context6.next =
|
|
943
|
+
case 5:
|
|
944
|
+
_context6.next = 7;
|
|
908
945
|
break;
|
|
909
|
-
case
|
|
910
|
-
_context6.prev =
|
|
911
|
-
|
|
912
|
-
case
|
|
946
|
+
case 6:
|
|
947
|
+
_context6.prev = 6;
|
|
948
|
+
_t11 = _context6["catch"](4);
|
|
949
|
+
case 7:
|
|
913
950
|
// Wait until LRO is terminated
|
|
914
951
|
_tries = 10;
|
|
915
|
-
case
|
|
952
|
+
case 8:
|
|
916
953
|
if (!(status.state != "stopped" && _tries-- > 0)) {
|
|
917
|
-
_context6.next =
|
|
954
|
+
_context6.next = 11;
|
|
918
955
|
break;
|
|
919
956
|
}
|
|
920
957
|
console.log("Wait to terminate - ", status.state);
|
|
921
|
-
_context6.next =
|
|
958
|
+
_context6.next = 9;
|
|
922
959
|
return Sleep(1000);
|
|
923
|
-
case
|
|
924
|
-
_context6.next =
|
|
960
|
+
case 9:
|
|
961
|
+
_context6.next = 10;
|
|
925
962
|
return this.StreamStatus({
|
|
926
963
|
name: name
|
|
927
964
|
});
|
|
928
|
-
case
|
|
965
|
+
case 10:
|
|
929
966
|
status = _context6.sent;
|
|
930
|
-
_context6.next =
|
|
967
|
+
_context6.next = 8;
|
|
931
968
|
break;
|
|
932
|
-
case
|
|
969
|
+
case 11:
|
|
933
970
|
console.log("Status after stop - ", status.state);
|
|
934
971
|
if (!(_tries <= 0)) {
|
|
935
|
-
_context6.next =
|
|
972
|
+
_context6.next = 12;
|
|
936
973
|
break;
|
|
937
974
|
}
|
|
938
975
|
console.log("Failed to stop");
|
|
939
976
|
return _context6.abrupt("return", status);
|
|
940
|
-
case
|
|
977
|
+
case 12:
|
|
941
978
|
if (!(op === "stop")) {
|
|
942
|
-
_context6.next =
|
|
979
|
+
_context6.next = 13;
|
|
943
980
|
break;
|
|
944
981
|
}
|
|
945
982
|
return _context6.abrupt("return", status);
|
|
946
|
-
case
|
|
983
|
+
case 13:
|
|
947
984
|
console.log("STARTING", "edge_write_token", status.edge_write_token);
|
|
948
|
-
_context6.prev =
|
|
949
|
-
_context6.next =
|
|
985
|
+
_context6.prev = 14;
|
|
986
|
+
_context6.next = 15;
|
|
950
987
|
return this.CallBitcodeMethod({
|
|
951
988
|
libraryId: status.library_id,
|
|
952
989
|
objectId: status.object_id,
|
|
@@ -954,52 +991,52 @@ exports.StreamStartOrStopOrReset = /*#__PURE__*/function () {
|
|
|
954
991
|
method: "/live/start",
|
|
955
992
|
constant: false
|
|
956
993
|
});
|
|
957
|
-
case
|
|
958
|
-
_context6.next =
|
|
994
|
+
case 15:
|
|
995
|
+
_context6.next = 17;
|
|
959
996
|
break;
|
|
960
|
-
case
|
|
961
|
-
_context6.prev =
|
|
962
|
-
|
|
963
|
-
console.log("LRO Start (failed): ",
|
|
997
|
+
case 16:
|
|
998
|
+
_context6.prev = 16;
|
|
999
|
+
_t12 = _context6["catch"](14);
|
|
1000
|
+
console.log("LRO Start (failed): ", _t12);
|
|
964
1001
|
return _context6.abrupt("return", {
|
|
965
1002
|
state: status.state,
|
|
966
1003
|
error: "LRO start failed - must create a stream first"
|
|
967
1004
|
});
|
|
968
|
-
case
|
|
1005
|
+
case 17:
|
|
969
1006
|
// Wait until LRO is 'starting'
|
|
970
1007
|
tries = 10;
|
|
971
|
-
case
|
|
1008
|
+
case 18:
|
|
972
1009
|
if (!(status.state != "starting" && tries-- > 0)) {
|
|
973
|
-
_context6.next =
|
|
1010
|
+
_context6.next = 21;
|
|
974
1011
|
break;
|
|
975
1012
|
}
|
|
976
1013
|
console.log("Wait to start - ", status.state);
|
|
977
|
-
_context6.next =
|
|
1014
|
+
_context6.next = 19;
|
|
978
1015
|
return Sleep(1000);
|
|
979
|
-
case
|
|
980
|
-
_context6.next =
|
|
1016
|
+
case 19:
|
|
1017
|
+
_context6.next = 20;
|
|
981
1018
|
return this.StreamStatus({
|
|
982
1019
|
name: name
|
|
983
1020
|
});
|
|
984
|
-
case
|
|
1021
|
+
case 20:
|
|
985
1022
|
status = _context6.sent;
|
|
986
|
-
_context6.next =
|
|
1023
|
+
_context6.next = 18;
|
|
987
1024
|
break;
|
|
988
|
-
case
|
|
1025
|
+
case 21:
|
|
989
1026
|
console.log("Status after restart - ", status.state);
|
|
990
1027
|
return _context6.abrupt("return", status);
|
|
991
|
-
case
|
|
992
|
-
_context6.prev =
|
|
993
|
-
|
|
994
|
-
console.error(
|
|
995
|
-
case
|
|
1028
|
+
case 22:
|
|
1029
|
+
_context6.prev = 22;
|
|
1030
|
+
_t13 = _context6["catch"](1);
|
|
1031
|
+
console.error(_t13);
|
|
1032
|
+
case 23:
|
|
996
1033
|
case "end":
|
|
997
1034
|
return _context6.stop();
|
|
998
1035
|
}
|
|
999
|
-
}, _callee6, this, [[1,
|
|
1036
|
+
}, _callee6, this, [[1, 22], [4, 6], [14, 16]]);
|
|
1000
1037
|
}));
|
|
1001
1038
|
return function (_x6) {
|
|
1002
|
-
return
|
|
1039
|
+
return _ref10.apply(this, arguments);
|
|
1003
1040
|
};
|
|
1004
1041
|
}();
|
|
1005
1042
|
|
|
@@ -1013,27 +1050,27 @@ exports.StreamStartOrStopOrReset = /*#__PURE__*/function () {
|
|
|
1013
1050
|
* @return {Promise<Object>} - The finalize response for the stream object
|
|
1014
1051
|
*/
|
|
1015
1052
|
exports.StreamStopSession = /*#__PURE__*/function () {
|
|
1016
|
-
var
|
|
1017
|
-
var name, objectId, libraryId, mainMeta, fabURI, metaEdgeWriteToken, streamMetadata, status, _yield$this$EditConte, writeToken, newState, stopTime, finalizeMetadata, fin;
|
|
1018
|
-
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) {
|
|
1019
1056
|
while (1) switch (_context7.prev = _context7.next) {
|
|
1020
1057
|
case 0:
|
|
1021
|
-
name =
|
|
1058
|
+
name = _ref11.name;
|
|
1022
1059
|
_context7.prev = 1;
|
|
1023
1060
|
this.Log("Terminating stream session for: ".concat(name));
|
|
1024
1061
|
objectId = name;
|
|
1025
|
-
_context7.next =
|
|
1062
|
+
_context7.next = 2;
|
|
1026
1063
|
return this.ContentObjectLibraryId({
|
|
1027
1064
|
objectId: objectId
|
|
1028
1065
|
});
|
|
1029
|
-
case
|
|
1066
|
+
case 2:
|
|
1030
1067
|
libraryId = _context7.sent;
|
|
1031
|
-
_context7.next =
|
|
1068
|
+
_context7.next = 3;
|
|
1032
1069
|
return this.ContentObjectMetadata({
|
|
1033
1070
|
libraryId: libraryId,
|
|
1034
1071
|
objectId: objectId
|
|
1035
1072
|
});
|
|
1036
|
-
case
|
|
1073
|
+
case 3:
|
|
1037
1074
|
mainMeta = _context7.sent;
|
|
1038
1075
|
fabURI = mainMeta.live_recording.fabric_config.ingress_node_api; // Support both hostname and URL ingress_node_api
|
|
1039
1076
|
if (!fabURI.startsWith("http")) {
|
|
@@ -1045,56 +1082,56 @@ exports.StreamStopSession = /*#__PURE__*/function () {
|
|
|
1045
1082
|
});
|
|
1046
1083
|
metaEdgeWriteToken = mainMeta.live_recording.fabric_config.edge_write_token;
|
|
1047
1084
|
if (metaEdgeWriteToken) {
|
|
1048
|
-
_context7.next =
|
|
1085
|
+
_context7.next = 4;
|
|
1049
1086
|
break;
|
|
1050
1087
|
}
|
|
1051
1088
|
return _context7.abrupt("return", {
|
|
1052
1089
|
state: "inactive",
|
|
1053
1090
|
error: "The stream is not active"
|
|
1054
1091
|
});
|
|
1055
|
-
case
|
|
1056
|
-
_context7.prev =
|
|
1057
|
-
_context7.next =
|
|
1092
|
+
case 4:
|
|
1093
|
+
_context7.prev = 4;
|
|
1094
|
+
_context7.next = 5;
|
|
1058
1095
|
return this.ContentObjectMetadata({
|
|
1059
1096
|
libraryId: libraryId,
|
|
1060
1097
|
objectId: objectId,
|
|
1061
1098
|
writeToken: metaEdgeWriteToken
|
|
1062
1099
|
});
|
|
1063
|
-
case
|
|
1100
|
+
case 5:
|
|
1064
1101
|
streamMetadata = _context7.sent;
|
|
1065
|
-
_context7.next =
|
|
1102
|
+
_context7.next = 6;
|
|
1066
1103
|
return this.StreamStatus({
|
|
1067
1104
|
name: name
|
|
1068
1105
|
});
|
|
1069
|
-
case
|
|
1106
|
+
case 6:
|
|
1070
1107
|
status = _context7.sent;
|
|
1071
1108
|
if (!(status.state !== "stopped")) {
|
|
1072
|
-
_context7.next =
|
|
1109
|
+
_context7.next = 7;
|
|
1073
1110
|
break;
|
|
1074
1111
|
}
|
|
1075
1112
|
return _context7.abrupt("return", {
|
|
1076
1113
|
state: status.state,
|
|
1077
1114
|
error: "The stream must be stopped before terminating"
|
|
1078
1115
|
});
|
|
1079
|
-
case
|
|
1080
|
-
_context7.next =
|
|
1116
|
+
case 7:
|
|
1117
|
+
_context7.next = 8;
|
|
1081
1118
|
return this.DeleteWriteToken({
|
|
1082
1119
|
writeToken: metaEdgeWriteToken
|
|
1083
1120
|
});
|
|
1084
|
-
case
|
|
1085
|
-
_context7.next =
|
|
1121
|
+
case 8:
|
|
1122
|
+
_context7.next = 10;
|
|
1086
1123
|
break;
|
|
1087
|
-
case
|
|
1088
|
-
_context7.prev =
|
|
1089
|
-
|
|
1124
|
+
case 9:
|
|
1125
|
+
_context7.prev = 9;
|
|
1126
|
+
_t14 = _context7["catch"](4);
|
|
1090
1127
|
this.Log("Unable to retrieve metadata for edge write token");
|
|
1091
|
-
case
|
|
1092
|
-
_context7.next =
|
|
1128
|
+
case 10:
|
|
1129
|
+
_context7.next = 11;
|
|
1093
1130
|
return this.EditContentObject({
|
|
1094
1131
|
libraryId: libraryId,
|
|
1095
1132
|
objectId: objectId
|
|
1096
1133
|
});
|
|
1097
|
-
case
|
|
1134
|
+
case 11:
|
|
1098
1135
|
_yield$this$EditConte = _context7.sent;
|
|
1099
1136
|
writeToken = _yield$this$EditConte.writeToken;
|
|
1100
1137
|
// Set stop time and inactive state
|
|
@@ -1112,40 +1149,40 @@ exports.StreamStopSession = /*#__PURE__*/function () {
|
|
|
1112
1149
|
}
|
|
1113
1150
|
}
|
|
1114
1151
|
};
|
|
1115
|
-
_context7.next =
|
|
1152
|
+
_context7.next = 12;
|
|
1116
1153
|
return this.MergeMetadata({
|
|
1117
1154
|
libraryId: libraryId,
|
|
1118
1155
|
objectId: objectId,
|
|
1119
1156
|
writeToken: writeToken,
|
|
1120
1157
|
metadata: finalizeMetadata
|
|
1121
1158
|
});
|
|
1122
|
-
case
|
|
1123
|
-
_context7.next =
|
|
1159
|
+
case 12:
|
|
1160
|
+
_context7.next = 13;
|
|
1124
1161
|
return this.FinalizeContentObject({
|
|
1125
1162
|
libraryId: libraryId,
|
|
1126
1163
|
objectId: objectId,
|
|
1127
1164
|
writeToken: writeToken,
|
|
1128
1165
|
commitMessage: "Deactivate live stream - stop time ".concat(stopTime)
|
|
1129
1166
|
});
|
|
1130
|
-
case
|
|
1167
|
+
case 13:
|
|
1131
1168
|
fin = _context7.sent;
|
|
1132
1169
|
return _context7.abrupt("return", {
|
|
1133
1170
|
fin: fin,
|
|
1134
1171
|
name: name,
|
|
1135
1172
|
state: newState
|
|
1136
1173
|
});
|
|
1137
|
-
case
|
|
1138
|
-
_context7.prev =
|
|
1139
|
-
|
|
1140
|
-
console.error(
|
|
1141
|
-
case
|
|
1174
|
+
case 14:
|
|
1175
|
+
_context7.prev = 14;
|
|
1176
|
+
_t15 = _context7["catch"](1);
|
|
1177
|
+
console.error(_t15);
|
|
1178
|
+
case 15:
|
|
1142
1179
|
case "end":
|
|
1143
1180
|
return _context7.stop();
|
|
1144
1181
|
}
|
|
1145
|
-
}, _callee7, this, [[1,
|
|
1182
|
+
}, _callee7, this, [[1, 14], [4, 9]]);
|
|
1146
1183
|
}));
|
|
1147
1184
|
return function (_x7) {
|
|
1148
|
-
return
|
|
1185
|
+
return _ref12.apply(this, arguments);
|
|
1149
1186
|
};
|
|
1150
1187
|
}();
|
|
1151
1188
|
|
|
@@ -1159,30 +1196,28 @@ exports.StreamStopSession = /*#__PURE__*/function () {
|
|
|
1159
1196
|
* @param {string=} format - Specify the list of playout formats and DRM to support,
|
|
1160
1197
|
comma-separated (hls-clear, hls-aes128, hls-sample-aes,
|
|
1161
1198
|
hls-fairplay)
|
|
1162
|
-
* @param {string=} writeToken - Write token of the draft
|
|
1163
|
-
* @param {boolean=} finalize - If enabled, target object will be finalized after configuration
|
|
1164
1199
|
*
|
|
1165
1200
|
* @return {Promise<Object>} - The name, object ID, and state of the stream
|
|
1166
1201
|
*/
|
|
1167
1202
|
exports.StreamInitialize = /*#__PURE__*/function () {
|
|
1168
|
-
var
|
|
1169
|
-
var name,
|
|
1170
|
-
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) {
|
|
1171
1206
|
while (1) switch (_context8.prev = _context8.next) {
|
|
1172
1207
|
case 0:
|
|
1173
|
-
name =
|
|
1174
|
-
_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;
|
|
1175
1210
|
return this.userProfileClient.TenantContractId();
|
|
1176
|
-
case
|
|
1211
|
+
case 1:
|
|
1177
1212
|
tenantContractId = _context8.sent;
|
|
1178
|
-
_context8.next =
|
|
1213
|
+
_context8.next = 2;
|
|
1179
1214
|
return this.ContentObjectMetadata({
|
|
1180
1215
|
libraryId: tenantContractId.replace("iten", "ilib"),
|
|
1181
1216
|
objectId: tenantContractId.replace("iten", "iq__"),
|
|
1182
1217
|
metadataSubtree: "public/content_types",
|
|
1183
1218
|
select: ["live_stream", "title"]
|
|
1184
1219
|
});
|
|
1185
|
-
case
|
|
1220
|
+
case 2:
|
|
1186
1221
|
_yield$this$ContentOb = _context8.sent;
|
|
1187
1222
|
live_stream = _yield$this$ContentOb.live_stream;
|
|
1188
1223
|
title = _yield$this$ContentOb.title;
|
|
@@ -1193,33 +1228,31 @@ exports.StreamInitialize = /*#__PURE__*/function () {
|
|
|
1193
1228
|
typeAbrMaster = title;
|
|
1194
1229
|
}
|
|
1195
1230
|
if (!(typeAbrMaster === undefined || typeLiveStream === undefined)) {
|
|
1196
|
-
_context8.next =
|
|
1231
|
+
_context8.next = 3;
|
|
1197
1232
|
break;
|
|
1198
1233
|
}
|
|
1199
1234
|
console.log("ERROR - unable to find content types", "ABR Master", typeAbrMaster, "Live Stream", typeLiveStream);
|
|
1200
1235
|
return _context8.abrupt("return", {});
|
|
1201
|
-
case
|
|
1202
|
-
_context8.next =
|
|
1236
|
+
case 3:
|
|
1237
|
+
_context8.next = 4;
|
|
1203
1238
|
return this.StreamSetOfferingAndDRM({
|
|
1204
1239
|
name: name,
|
|
1205
1240
|
typeAbrMaster: typeAbrMaster,
|
|
1206
1241
|
typeLiveStream: typeLiveStream,
|
|
1207
1242
|
drm: drm,
|
|
1208
|
-
format: format
|
|
1209
|
-
writeToken: writeToken,
|
|
1210
|
-
finalize: finalize
|
|
1243
|
+
format: format
|
|
1211
1244
|
});
|
|
1212
|
-
case
|
|
1245
|
+
case 4:
|
|
1213
1246
|
res = _context8.sent;
|
|
1214
1247
|
return _context8.abrupt("return", res);
|
|
1215
|
-
case
|
|
1248
|
+
case 5:
|
|
1216
1249
|
case "end":
|
|
1217
1250
|
return _context8.stop();
|
|
1218
1251
|
}
|
|
1219
1252
|
}, _callee8, this);
|
|
1220
1253
|
}));
|
|
1221
1254
|
return function (_x8) {
|
|
1222
|
-
return
|
|
1255
|
+
return _ref14.apply(this, arguments);
|
|
1223
1256
|
};
|
|
1224
1257
|
}();
|
|
1225
1258
|
|
|
@@ -1235,32 +1268,31 @@ exports.StreamInitialize = /*#__PURE__*/function () {
|
|
|
1235
1268
|
* @param {string=} format - A list of playout formats and DRM to support, comma-separated
|
|
1236
1269
|
* (hls-clear, hls-aes128, hls-sample-aes, hls-fairplay). If specified,
|
|
1237
1270
|
* this will take precedence over the drm value
|
|
1238
|
-
* @param {string=} writeToken - Write token of the draft
|
|
1239
1271
|
*
|
|
1240
1272
|
* @return {Promise<Object>} - The name, object ID, and state of the stream
|
|
1241
1273
|
*/
|
|
1242
1274
|
exports.StreamSetOfferingAndDRM = /*#__PURE__*/function () {
|
|
1243
|
-
var
|
|
1244
|
-
var name, typeAbrMaster, typeLiveStream,
|
|
1245
|
-
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) {
|
|
1246
1278
|
while (1) switch (_context9.prev = _context9.next) {
|
|
1247
1279
|
case 0:
|
|
1248
|
-
name =
|
|
1249
|
-
_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;
|
|
1250
1282
|
return this.StreamStatus({
|
|
1251
1283
|
name: name
|
|
1252
1284
|
});
|
|
1253
|
-
case
|
|
1285
|
+
case 1:
|
|
1254
1286
|
status = _context9.sent;
|
|
1255
1287
|
if (!(status.state != "uninitialized" && status.state != "inactive" && status.state != "stopped")) {
|
|
1256
|
-
_context9.next =
|
|
1288
|
+
_context9.next = 2;
|
|
1257
1289
|
break;
|
|
1258
1290
|
}
|
|
1259
1291
|
return _context9.abrupt("return", {
|
|
1260
1292
|
state: status.state,
|
|
1261
1293
|
error: "stream still active - must terminate first"
|
|
1262
1294
|
});
|
|
1263
|
-
case
|
|
1295
|
+
case 2:
|
|
1264
1296
|
objectId = status.object_id;
|
|
1265
1297
|
console.log("INIT: ", name, objectId);
|
|
1266
1298
|
aBitRate = 128000;
|
|
@@ -1279,20 +1311,20 @@ exports.StreamSetOfferingAndDRM = /*#__PURE__*/function () {
|
|
|
1279
1311
|
abrProfileDefault = require("../abr_profiles/abr_profile_live_drm.js");
|
|
1280
1312
|
abrProfile = JSON.parse(JSON.stringify(abrProfileDefault));
|
|
1281
1313
|
if (!format) {
|
|
1282
|
-
_context9.next =
|
|
1314
|
+
_context9.next = 8;
|
|
1283
1315
|
break;
|
|
1284
1316
|
}
|
|
1285
1317
|
drm = true; // Override DRM parameter
|
|
1286
1318
|
playoutFormats = {};
|
|
1287
1319
|
formats = format.split(",");
|
|
1288
1320
|
i = 0;
|
|
1289
|
-
case
|
|
1321
|
+
case 3:
|
|
1290
1322
|
if (!(i < formats.length)) {
|
|
1291
|
-
_context9.next =
|
|
1323
|
+
_context9.next = 7;
|
|
1292
1324
|
break;
|
|
1293
1325
|
}
|
|
1294
1326
|
if (!(formats[i] === "hls-clear")) {
|
|
1295
|
-
_context9.next =
|
|
1327
|
+
_context9.next = 4;
|
|
1296
1328
|
break;
|
|
1297
1329
|
}
|
|
1298
1330
|
abrProfile.drm_optional = true;
|
|
@@ -1302,10 +1334,10 @@ exports.StreamSetOfferingAndDRM = /*#__PURE__*/function () {
|
|
|
1302
1334
|
"type": "ProtoHls"
|
|
1303
1335
|
}
|
|
1304
1336
|
};
|
|
1305
|
-
return _context9.abrupt("continue",
|
|
1306
|
-
case
|
|
1337
|
+
return _context9.abrupt("continue", 6);
|
|
1338
|
+
case 4:
|
|
1307
1339
|
if (!(formats[i] === "dash-clear")) {
|
|
1308
|
-
_context9.next =
|
|
1340
|
+
_context9.next = 5;
|
|
1309
1341
|
break;
|
|
1310
1342
|
}
|
|
1311
1343
|
abrProfile.drm_optional = true;
|
|
@@ -1316,17 +1348,17 @@ exports.StreamSetOfferingAndDRM = /*#__PURE__*/function () {
|
|
|
1316
1348
|
"type": "ProtoDash"
|
|
1317
1349
|
}
|
|
1318
1350
|
};
|
|
1319
|
-
return _context9.abrupt("continue",
|
|
1320
|
-
case
|
|
1351
|
+
return _context9.abrupt("continue", 6);
|
|
1352
|
+
case 5:
|
|
1321
1353
|
playoutFormats[formats[i]] = abrProfile.playout_formats[formats[i]];
|
|
1322
|
-
case
|
|
1354
|
+
case 6:
|
|
1323
1355
|
i++;
|
|
1324
|
-
_context9.next =
|
|
1356
|
+
_context9.next = 3;
|
|
1325
1357
|
break;
|
|
1326
|
-
case
|
|
1327
|
-
_context9.next =
|
|
1358
|
+
case 7:
|
|
1359
|
+
_context9.next = 9;
|
|
1328
1360
|
break;
|
|
1329
|
-
case
|
|
1361
|
+
case 8:
|
|
1330
1362
|
if (!drm) {
|
|
1331
1363
|
abrProfile.drm_optional = true;
|
|
1332
1364
|
playoutFormats = {
|
|
@@ -1347,22 +1379,21 @@ exports.StreamSetOfferingAndDRM = /*#__PURE__*/function () {
|
|
|
1347
1379
|
} else {
|
|
1348
1380
|
playoutFormats = Object.assign({}, abrProfile.playout_formats);
|
|
1349
1381
|
}
|
|
1350
|
-
case
|
|
1382
|
+
case 9:
|
|
1351
1383
|
abrProfile.playout_formats = playoutFormats;
|
|
1352
|
-
_context9.next =
|
|
1384
|
+
_context9.next = 10;
|
|
1353
1385
|
return this.ContentObjectLibraryId({
|
|
1354
1386
|
objectId: objectId
|
|
1355
1387
|
});
|
|
1356
|
-
case
|
|
1388
|
+
case 10:
|
|
1357
1389
|
libraryId = _context9.sent;
|
|
1358
|
-
_context9.prev =
|
|
1359
|
-
_context9.next =
|
|
1390
|
+
_context9.prev = 11;
|
|
1391
|
+
_context9.next = 12;
|
|
1360
1392
|
return this.ContentObjectMetadata({
|
|
1361
1393
|
libraryId: libraryId,
|
|
1362
|
-
objectId: objectId
|
|
1363
|
-
writeToken: writeToken
|
|
1394
|
+
objectId: objectId
|
|
1364
1395
|
});
|
|
1365
|
-
case
|
|
1396
|
+
case 12:
|
|
1366
1397
|
mainMeta = _context9.sent;
|
|
1367
1398
|
fabURI = mainMeta.live_recording.fabric_config.ingress_node_api; // Support both hostname and URL ingress_node_api
|
|
1368
1399
|
if (!fabURI.startsWith("http")) {
|
|
@@ -1373,7 +1404,7 @@ exports.StreamSetOfferingAndDRM = /*#__PURE__*/function () {
|
|
|
1373
1404
|
fabricURIs: [fabURI]
|
|
1374
1405
|
});
|
|
1375
1406
|
streamUrl = mainMeta.live_recording.recording_config.recording_params.origin_url;
|
|
1376
|
-
_context9.next =
|
|
1407
|
+
_context9.next = 13;
|
|
1377
1408
|
return StreamGenerateOffering({
|
|
1378
1409
|
client: this,
|
|
1379
1410
|
libraryId: libraryId,
|
|
@@ -1394,29 +1425,27 @@ exports.StreamSetOfferingAndDRM = /*#__PURE__*/function () {
|
|
|
1394
1425
|
vWidth: vWidth,
|
|
1395
1426
|
vDisplayAspectRatio: vDisplayAspectRatio,
|
|
1396
1427
|
vFrameRate: vFrameRate,
|
|
1397
|
-
vTimeBase: vTimeBase
|
|
1398
|
-
writeToken: writeToken,
|
|
1399
|
-
finalize: finalize
|
|
1428
|
+
vTimeBase: vTimeBase
|
|
1400
1429
|
});
|
|
1401
|
-
case
|
|
1430
|
+
case 13:
|
|
1402
1431
|
console.log("Finished generating offering");
|
|
1403
1432
|
return _context9.abrupt("return", {
|
|
1404
1433
|
name: name,
|
|
1405
1434
|
object_id: objectId,
|
|
1406
1435
|
state: "initialized"
|
|
1407
1436
|
});
|
|
1408
|
-
case
|
|
1409
|
-
_context9.prev =
|
|
1410
|
-
|
|
1411
|
-
console.error(
|
|
1412
|
-
case
|
|
1437
|
+
case 14:
|
|
1438
|
+
_context9.prev = 14;
|
|
1439
|
+
_t16 = _context9["catch"](11);
|
|
1440
|
+
console.error(_t16);
|
|
1441
|
+
case 15:
|
|
1413
1442
|
case "end":
|
|
1414
1443
|
return _context9.stop();
|
|
1415
1444
|
}
|
|
1416
|
-
}, _callee9, this, [[
|
|
1445
|
+
}, _callee9, this, [[11, 14]]);
|
|
1417
1446
|
}));
|
|
1418
1447
|
return function (_x9) {
|
|
1419
|
-
return
|
|
1448
|
+
return _ref16.apply(this, arguments);
|
|
1420
1449
|
};
|
|
1421
1450
|
}();
|
|
1422
1451
|
|
|
@@ -1436,23 +1465,22 @@ exports.StreamSetOfferingAndDRM = /*#__PURE__*/function () {
|
|
|
1436
1465
|
* @return {Promise<Object>} - Insertions, as well as any errors from bad insertions
|
|
1437
1466
|
*/
|
|
1438
1467
|
exports.StreamInsertion = /*#__PURE__*/function () {
|
|
1439
|
-
var
|
|
1440
|
-
var name, insertionTime,
|
|
1441
|
-
return _regeneratorRuntime.wrap(function
|
|
1442
|
-
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) {
|
|
1443
1472
|
case 0:
|
|
1444
|
-
name =
|
|
1445
|
-
|
|
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;
|
|
1446
1475
|
return this.ContentObjectMetadata({
|
|
1447
1476
|
versionHash: targetHash,
|
|
1448
1477
|
metadataSubtree: "/offerings/default"
|
|
1449
1478
|
});
|
|
1450
|
-
case
|
|
1451
|
-
offeringMeta =
|
|
1479
|
+
case 1:
|
|
1480
|
+
offeringMeta = _context0.sent;
|
|
1452
1481
|
insertionInfo = {
|
|
1453
1482
|
duration_sec: 0 // Minimum of video and audio duration
|
|
1454
1483
|
};
|
|
1455
|
-
|
|
1456
1484
|
["video", "audio"].forEach(function (mt) {
|
|
1457
1485
|
var stream = offeringMeta.media_struct.streams[mt];
|
|
1458
1486
|
insertionInfo[mt] = {
|
|
@@ -1467,39 +1495,39 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1467
1495
|
audioAbrDuration = insertionInfo.audio.seg_duration_sec;
|
|
1468
1496
|
videoAbrDuration = insertionInfo.video.seg_duration_sec;
|
|
1469
1497
|
if (!(audioAbrDuration === 0 || videoAbrDuration === 0)) {
|
|
1470
|
-
|
|
1498
|
+
_context0.next = 2;
|
|
1471
1499
|
break;
|
|
1472
1500
|
}
|
|
1473
1501
|
throw new Error("Bad segment duration hash:", targetHash);
|
|
1474
|
-
case
|
|
1502
|
+
case 2:
|
|
1475
1503
|
if (!(duration === undefined)) {
|
|
1476
|
-
|
|
1504
|
+
_context0.next = 3;
|
|
1477
1505
|
break;
|
|
1478
1506
|
}
|
|
1479
1507
|
duration = insertionInfo.duration_sec; // Use full duration of the insertion
|
|
1480
|
-
|
|
1508
|
+
_context0.next = 4;
|
|
1481
1509
|
break;
|
|
1482
|
-
case
|
|
1510
|
+
case 3:
|
|
1483
1511
|
if (!(duration > insertionInfo.duration_sec)) {
|
|
1484
|
-
|
|
1512
|
+
_context0.next = 4;
|
|
1485
1513
|
break;
|
|
1486
1514
|
}
|
|
1487
1515
|
throw new Error("Bad duration - larger than insertion object duration", insertionInfo.duration_sec);
|
|
1488
|
-
case
|
|
1516
|
+
case 4:
|
|
1489
1517
|
objectId = name;
|
|
1490
|
-
|
|
1518
|
+
_context0.next = 5;
|
|
1491
1519
|
return this.ContentObjectLibraryId({
|
|
1492
1520
|
objectId: objectId
|
|
1493
1521
|
});
|
|
1494
|
-
case
|
|
1495
|
-
libraryId =
|
|
1496
|
-
|
|
1522
|
+
case 5:
|
|
1523
|
+
libraryId = _context0.sent;
|
|
1524
|
+
_context0.next = 6;
|
|
1497
1525
|
return this.ContentObjectMetadata({
|
|
1498
1526
|
libraryId: libraryId,
|
|
1499
1527
|
objectId: objectId
|
|
1500
1528
|
});
|
|
1501
|
-
case
|
|
1502
|
-
mainMeta =
|
|
1529
|
+
case 6:
|
|
1530
|
+
mainMeta = _context0.sent;
|
|
1503
1531
|
fabURI = mainMeta.live_recording.fabric_config.ingress_node_api; // Support both hostname and URL ingress_node_api
|
|
1504
1532
|
if (!fabURI.startsWith("http")) {
|
|
1505
1533
|
// Assume https
|
|
@@ -1509,14 +1537,14 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1509
1537
|
fabricURIs: [fabURI]
|
|
1510
1538
|
});
|
|
1511
1539
|
edgeWriteToken = mainMeta.live_recording.fabric_config.edge_write_token;
|
|
1512
|
-
|
|
1540
|
+
_context0.next = 7;
|
|
1513
1541
|
return this.ContentObjectMetadata({
|
|
1514
1542
|
libraryId: libraryId,
|
|
1515
1543
|
objectId: objectId,
|
|
1516
1544
|
writeToken: edgeWriteToken
|
|
1517
1545
|
});
|
|
1518
|
-
case
|
|
1519
|
-
edgeMeta =
|
|
1546
|
+
case 7:
|
|
1547
|
+
edgeMeta = _context0.sent;
|
|
1520
1548
|
// Find stream start time (from the most recent recording section)
|
|
1521
1549
|
recordings = edgeMeta.live_recording.recordings;
|
|
1522
1550
|
sequence = 1;
|
|
@@ -1534,15 +1562,15 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1534
1562
|
}
|
|
1535
1563
|
}
|
|
1536
1564
|
if (!(streamStartTime === 0)) {
|
|
1537
|
-
|
|
1565
|
+
_context0.next = 8;
|
|
1538
1566
|
break;
|
|
1539
1567
|
}
|
|
1540
1568
|
if (!(sinceStart === false)) {
|
|
1541
|
-
|
|
1569
|
+
_context0.next = 8;
|
|
1542
1570
|
break;
|
|
1543
1571
|
}
|
|
1544
1572
|
throw new Error("Stream not running - must use 'time since start'");
|
|
1545
|
-
case
|
|
1573
|
+
case 8:
|
|
1546
1574
|
// Find the current period playout configuration
|
|
1547
1575
|
if (edgeMeta.live_recording.playout_config.interleaves === undefined) {
|
|
1548
1576
|
edgeMeta.live_recording.playout_config.interleaves = {};
|
|
@@ -1569,9 +1597,9 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1569
1597
|
playout: "/qfab/" + targetHash + "/rep/playout" // TO FIX - should be a link
|
|
1570
1598
|
};
|
|
1571
1599
|
i = 0;
|
|
1572
|
-
case
|
|
1600
|
+
case 9:
|
|
1573
1601
|
if (!(i < insertions.length)) {
|
|
1574
|
-
|
|
1602
|
+
_context0.next = 13;
|
|
1575
1603
|
break;
|
|
1576
1604
|
}
|
|
1577
1605
|
if (insertions[i].insertion_time <= currentTime) {
|
|
@@ -1579,21 +1607,21 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1579
1607
|
append(errs, "Bad insertion - time:", insertions[i].insertion_time);
|
|
1580
1608
|
}
|
|
1581
1609
|
if (!remove) {
|
|
1582
|
-
|
|
1610
|
+
_context0.next = 11;
|
|
1583
1611
|
break;
|
|
1584
1612
|
}
|
|
1585
1613
|
if (!(insertions[i].insertion_time === insertionTime)) {
|
|
1586
|
-
|
|
1614
|
+
_context0.next = 10;
|
|
1587
1615
|
break;
|
|
1588
1616
|
}
|
|
1589
1617
|
insertions.splice(i, 1);
|
|
1590
|
-
return
|
|
1591
|
-
case
|
|
1592
|
-
|
|
1618
|
+
return _context0.abrupt("continue", 13);
|
|
1619
|
+
case 10:
|
|
1620
|
+
_context0.next = 12;
|
|
1593
1621
|
break;
|
|
1594
|
-
case
|
|
1622
|
+
case 11:
|
|
1595
1623
|
if (!(insertions[i].insertion_time > insertionTime)) {
|
|
1596
|
-
|
|
1624
|
+
_context0.next = 12;
|
|
1597
1625
|
break;
|
|
1598
1626
|
}
|
|
1599
1627
|
if (i > 0) {
|
|
@@ -1602,12 +1630,12 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1602
1630
|
insertions = [newInsertion].concat(_toConsumableArray(insertions.splice(i)));
|
|
1603
1631
|
}
|
|
1604
1632
|
insertionDone = true;
|
|
1605
|
-
return
|
|
1606
|
-
case
|
|
1633
|
+
return _context0.abrupt("continue", 13);
|
|
1634
|
+
case 12:
|
|
1607
1635
|
i++;
|
|
1608
|
-
|
|
1636
|
+
_context0.next = 9;
|
|
1609
1637
|
break;
|
|
1610
|
-
case
|
|
1638
|
+
case 13:
|
|
1611
1639
|
if (!remove && !insertionDone) {
|
|
1612
1640
|
// Add to the end of the insertions list
|
|
1613
1641
|
console.log("Add insertion at the end");
|
|
@@ -1616,7 +1644,7 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1616
1644
|
playoutConfig.interleaves[sequence] = insertions;
|
|
1617
1645
|
|
|
1618
1646
|
// Store the new insertions in the write token
|
|
1619
|
-
|
|
1647
|
+
_context0.next = 14;
|
|
1620
1648
|
return this.ReplaceMetadata({
|
|
1621
1649
|
libraryId: libraryId,
|
|
1622
1650
|
objectId: objectId,
|
|
@@ -1624,18 +1652,18 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1624
1652
|
metadataSubtree: "/live_recording/playout_config",
|
|
1625
1653
|
metadata: edgeMeta.live_recording.playout_config
|
|
1626
1654
|
});
|
|
1627
|
-
case
|
|
1655
|
+
case 14:
|
|
1628
1656
|
res.errors = errs;
|
|
1629
1657
|
res.insertions = insertions;
|
|
1630
|
-
return
|
|
1631
|
-
case
|
|
1658
|
+
return _context0.abrupt("return", res);
|
|
1659
|
+
case 15:
|
|
1632
1660
|
case "end":
|
|
1633
|
-
return
|
|
1661
|
+
return _context0.stop();
|
|
1634
1662
|
}
|
|
1635
|
-
},
|
|
1663
|
+
}, _callee0, this);
|
|
1636
1664
|
}));
|
|
1637
|
-
return function (
|
|
1638
|
-
return
|
|
1665
|
+
return function (_x0) {
|
|
1666
|
+
return _ref18.apply(this, arguments);
|
|
1639
1667
|
};
|
|
1640
1668
|
}();
|
|
1641
1669
|
|
|
@@ -1673,32 +1701,32 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1673
1701
|
*
|
|
1674
1702
|
*/
|
|
1675
1703
|
exports.StreamConfig = /*#__PURE__*/function () {
|
|
1676
|
-
var
|
|
1677
|
-
var name,
|
|
1678
|
-
return _regeneratorRuntime.wrap(function
|
|
1679
|
-
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) {
|
|
1680
1708
|
case 0:
|
|
1681
|
-
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;
|
|
1682
1710
|
objectId = name;
|
|
1683
1711
|
status = {
|
|
1684
1712
|
name: name
|
|
1685
1713
|
};
|
|
1686
|
-
|
|
1714
|
+
_context1.next = 1;
|
|
1687
1715
|
return this.ContentObjectLibraryId({
|
|
1688
1716
|
objectId: objectId
|
|
1689
1717
|
});
|
|
1690
|
-
case
|
|
1691
|
-
libraryId =
|
|
1718
|
+
case 1:
|
|
1719
|
+
libraryId = _context1.sent;
|
|
1692
1720
|
status.library_id = libraryId;
|
|
1693
1721
|
status.object_id = objectId;
|
|
1694
1722
|
probe = probeMetadata;
|
|
1695
|
-
|
|
1723
|
+
_context1.next = 2;
|
|
1696
1724
|
return this.ContentObjectMetadata({
|
|
1697
1725
|
libraryId: libraryId,
|
|
1698
1726
|
objectId: objectId
|
|
1699
1727
|
});
|
|
1700
|
-
case
|
|
1701
|
-
mainMeta =
|
|
1728
|
+
case 2:
|
|
1729
|
+
mainMeta = _context1.sent;
|
|
1702
1730
|
userConfig = mainMeta.live_recording_config;
|
|
1703
1731
|
status.user_config = userConfig;
|
|
1704
1732
|
|
|
@@ -1707,19 +1735,19 @@ exports.StreamConfig = /*#__PURE__*/function () {
|
|
|
1707
1735
|
hostName = new URL(parsedName).hostname;
|
|
1708
1736
|
streamUrl = new URL(userConfig.url);
|
|
1709
1737
|
this.Log("Retrieving nodes - matching: ".concat(hostName));
|
|
1710
|
-
|
|
1738
|
+
_context1.next = 3;
|
|
1711
1739
|
return this.SpaceNodes({
|
|
1712
1740
|
matchEndpoint: hostName
|
|
1713
1741
|
});
|
|
1714
|
-
case
|
|
1715
|
-
nodes =
|
|
1742
|
+
case 3:
|
|
1743
|
+
nodes = _context1.sent;
|
|
1716
1744
|
if (!(nodes.length < 1)) {
|
|
1717
|
-
|
|
1745
|
+
_context1.next = 4;
|
|
1718
1746
|
break;
|
|
1719
1747
|
}
|
|
1720
1748
|
status.error = "No node matching stream URL " + streamUrl.href;
|
|
1721
|
-
return
|
|
1722
|
-
case
|
|
1749
|
+
return _context1.abrupt("return", status);
|
|
1750
|
+
case 4:
|
|
1723
1751
|
node = {
|
|
1724
1752
|
endpoints: nodes[0].services.fabric_api.urls,
|
|
1725
1753
|
id: nodes[0].id
|
|
@@ -1727,7 +1755,7 @@ exports.StreamConfig = /*#__PURE__*/function () {
|
|
|
1727
1755
|
status.node = node;
|
|
1728
1756
|
endpoint = node.endpoints[0];
|
|
1729
1757
|
if (probe) {
|
|
1730
|
-
|
|
1758
|
+
_context1.next = 13;
|
|
1731
1759
|
break;
|
|
1732
1760
|
}
|
|
1733
1761
|
this.SetNodes({
|
|
@@ -1736,17 +1764,17 @@ exports.StreamConfig = /*#__PURE__*/function () {
|
|
|
1736
1764
|
|
|
1737
1765
|
// Probe the stream
|
|
1738
1766
|
probe = {};
|
|
1739
|
-
|
|
1740
|
-
|
|
1767
|
+
_context1.prev = 5;
|
|
1768
|
+
_context1.next = 6;
|
|
1741
1769
|
return this.Rep({
|
|
1742
1770
|
libraryId: libraryId,
|
|
1743
1771
|
objectId: objectId,
|
|
1744
1772
|
rep: "probe"
|
|
1745
1773
|
});
|
|
1746
|
-
case
|
|
1747
|
-
probeUrl =
|
|
1748
|
-
|
|
1749
|
-
|
|
1774
|
+
case 6:
|
|
1775
|
+
probeUrl = _context1.sent;
|
|
1776
|
+
_t17 = this.utils;
|
|
1777
|
+
_context1.next = 7;
|
|
1750
1778
|
return HttpClient.Fetch(probeUrl, {
|
|
1751
1779
|
body: JSON.stringify({
|
|
1752
1780
|
"filename": streamUrl.href,
|
|
@@ -1754,52 +1782,52 @@ exports.StreamConfig = /*#__PURE__*/function () {
|
|
|
1754
1782
|
}),
|
|
1755
1783
|
method: "POST"
|
|
1756
1784
|
});
|
|
1757
|
-
case
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
return
|
|
1761
|
-
case
|
|
1762
|
-
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;
|
|
1763
1791
|
if (!probe.errors) {
|
|
1764
|
-
|
|
1792
|
+
_context1.next = 9;
|
|
1765
1793
|
break;
|
|
1766
1794
|
}
|
|
1767
1795
|
throw probe.errors[0];
|
|
1768
|
-
case
|
|
1769
|
-
|
|
1796
|
+
case 9:
|
|
1797
|
+
_context1.next = 12;
|
|
1770
1798
|
break;
|
|
1771
|
-
case
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
if (!(
|
|
1775
|
-
|
|
1799
|
+
case 10:
|
|
1800
|
+
_context1.prev = 10;
|
|
1801
|
+
_t19 = _context1["catch"](5);
|
|
1802
|
+
if (!(_t19.code === "ETIMEDOUT")) {
|
|
1803
|
+
_context1.next = 11;
|
|
1776
1804
|
break;
|
|
1777
1805
|
}
|
|
1778
1806
|
throw "Stream probe time out - make sure the stream source is available";
|
|
1779
|
-
case
|
|
1780
|
-
throw
|
|
1781
|
-
case
|
|
1807
|
+
case 11:
|
|
1808
|
+
throw _t19;
|
|
1809
|
+
case 12:
|
|
1782
1810
|
probe.format.filename = streamUrl.href;
|
|
1783
|
-
case
|
|
1811
|
+
case 13:
|
|
1784
1812
|
// Create live recording config
|
|
1785
1813
|
lc = new LiveConf(probe, node.id, endpoint, false, false, true);
|
|
1786
1814
|
liveRecordingConfig = lc.generateLiveConf({
|
|
1787
1815
|
customSettings: customSettings
|
|
1788
1816
|
}); // Store live recording config into the stream object
|
|
1789
1817
|
if (writeToken) {
|
|
1790
|
-
|
|
1818
|
+
_context1.next = 15;
|
|
1791
1819
|
break;
|
|
1792
1820
|
}
|
|
1793
|
-
|
|
1821
|
+
_context1.next = 14;
|
|
1794
1822
|
return this.EditContentObject({
|
|
1795
1823
|
libraryId: libraryId,
|
|
1796
1824
|
objectId: objectId
|
|
1797
1825
|
});
|
|
1798
|
-
case
|
|
1799
|
-
e =
|
|
1826
|
+
case 14:
|
|
1827
|
+
e = _context1.sent;
|
|
1800
1828
|
writeToken = e.write_token;
|
|
1801
|
-
case
|
|
1802
|
-
|
|
1829
|
+
case 15:
|
|
1830
|
+
_context1.next = 16;
|
|
1803
1831
|
return this.ReplaceMetadata({
|
|
1804
1832
|
libraryId: libraryId,
|
|
1805
1833
|
objectId: objectId,
|
|
@@ -1807,8 +1835,8 @@ exports.StreamConfig = /*#__PURE__*/function () {
|
|
|
1807
1835
|
metadataSubtree: "live_recording",
|
|
1808
1836
|
metadata: liveRecordingConfig.live_recording
|
|
1809
1837
|
});
|
|
1810
|
-
case
|
|
1811
|
-
|
|
1838
|
+
case 16:
|
|
1839
|
+
_context1.next = 17;
|
|
1812
1840
|
return this.ReplaceMetadata({
|
|
1813
1841
|
libraryId: libraryId,
|
|
1814
1842
|
objectId: objectId,
|
|
@@ -1816,30 +1844,30 @@ exports.StreamConfig = /*#__PURE__*/function () {
|
|
|
1816
1844
|
metadataSubtree: "live_recording_config/probe_info",
|
|
1817
1845
|
metadata: probe
|
|
1818
1846
|
});
|
|
1819
|
-
case
|
|
1847
|
+
case 17:
|
|
1820
1848
|
if (!finalize) {
|
|
1821
|
-
|
|
1849
|
+
_context1.next = 19;
|
|
1822
1850
|
break;
|
|
1823
1851
|
}
|
|
1824
|
-
|
|
1852
|
+
_context1.next = 18;
|
|
1825
1853
|
return this.FinalizeContentObject({
|
|
1826
1854
|
libraryId: libraryId,
|
|
1827
1855
|
objectId: objectId,
|
|
1828
1856
|
writeToken: writeToken,
|
|
1829
1857
|
commitMessage: "Apply live stream configuration"
|
|
1830
1858
|
});
|
|
1831
|
-
case
|
|
1832
|
-
status.fin =
|
|
1833
|
-
case
|
|
1834
|
-
return
|
|
1835
|
-
case
|
|
1859
|
+
case 18:
|
|
1860
|
+
status.fin = _context1.sent;
|
|
1861
|
+
case 19:
|
|
1862
|
+
return _context1.abrupt("return", status);
|
|
1863
|
+
case 20:
|
|
1836
1864
|
case "end":
|
|
1837
|
-
return
|
|
1865
|
+
return _context1.stop();
|
|
1838
1866
|
}
|
|
1839
|
-
},
|
|
1867
|
+
}, _callee1, this, [[5, 10]]);
|
|
1840
1868
|
}));
|
|
1841
|
-
return function (
|
|
1842
|
-
return
|
|
1869
|
+
return function (_x1) {
|
|
1870
|
+
return _ref20.apply(this, arguments);
|
|
1843
1871
|
};
|
|
1844
1872
|
}();
|
|
1845
1873
|
|
|
@@ -1852,9 +1880,9 @@ exports.StreamConfig = /*#__PURE__*/function () {
|
|
|
1852
1880
|
*
|
|
1853
1881
|
* @return {Promise<Object>} - The list of stream URLs
|
|
1854
1882
|
*/
|
|
1855
|
-
exports.StreamListUrls = /*#__PURE__*/_asyncToGenerator(
|
|
1883
|
+
exports.StreamListUrls = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
|
|
1856
1884
|
var _this2 = this;
|
|
1857
|
-
var
|
|
1885
|
+
var _ref22,
|
|
1858
1886
|
siteId,
|
|
1859
1887
|
STATUS_MAP,
|
|
1860
1888
|
tenantContractId,
|
|
@@ -1862,12 +1890,21 @@ exports.StreamListUrls = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regenerat
|
|
|
1862
1890
|
activeUrlMap,
|
|
1863
1891
|
streamUrlStatus,
|
|
1864
1892
|
streamUrls,
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
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) {
|
|
1868
1905
|
case 0:
|
|
1869
|
-
|
|
1870
|
-
|
|
1906
|
+
_ref22 = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {}, siteId = _ref22.siteId;
|
|
1907
|
+
_context11.prev = 1;
|
|
1871
1908
|
STATUS_MAP = {
|
|
1872
1909
|
UNCONFIGURED: "unconfigured",
|
|
1873
1910
|
UNINITIALIZED: "uninitialized",
|
|
@@ -1878,78 +1915,78 @@ exports.StreamListUrls = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regenerat
|
|
|
1878
1915
|
STALLED: "stalled"
|
|
1879
1916
|
};
|
|
1880
1917
|
if (siteId) {
|
|
1881
|
-
|
|
1918
|
+
_context11.next = 5;
|
|
1882
1919
|
break;
|
|
1883
1920
|
}
|
|
1884
|
-
|
|
1921
|
+
_context11.next = 2;
|
|
1885
1922
|
return this.userProfileClient.TenantContractId();
|
|
1886
|
-
case
|
|
1887
|
-
tenantContractId =
|
|
1923
|
+
case 2:
|
|
1924
|
+
tenantContractId = _context11.sent;
|
|
1888
1925
|
if (tenantContractId) {
|
|
1889
|
-
|
|
1926
|
+
_context11.next = 3;
|
|
1890
1927
|
break;
|
|
1891
1928
|
}
|
|
1892
1929
|
throw Error("No tenant contract ID configured");
|
|
1893
|
-
case
|
|
1894
|
-
|
|
1930
|
+
case 3:
|
|
1931
|
+
_context11.next = 4;
|
|
1895
1932
|
return this.ContentObjectMetadata({
|
|
1896
1933
|
libraryId: tenantContractId.replace("iten", "ilib"),
|
|
1897
1934
|
objectId: tenantContractId.replace("iten", "iq__"),
|
|
1898
1935
|
metadataSubtree: "public/sites/live_streams"
|
|
1899
1936
|
});
|
|
1900
|
-
case
|
|
1901
|
-
siteId =
|
|
1902
|
-
case
|
|
1903
|
-
|
|
1904
|
-
|
|
1937
|
+
case 4:
|
|
1938
|
+
siteId = _context11.sent;
|
|
1939
|
+
case 5:
|
|
1940
|
+
_t20 = this;
|
|
1941
|
+
_context11.next = 6;
|
|
1905
1942
|
return this.ContentObjectLibraryId({
|
|
1906
1943
|
objectId: siteId
|
|
1907
1944
|
});
|
|
1908
|
-
case
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
libraryId:
|
|
1913
|
-
objectId:
|
|
1945
|
+
case 6:
|
|
1946
|
+
_t21 = _context11.sent;
|
|
1947
|
+
_t22 = siteId;
|
|
1948
|
+
_t23 = {
|
|
1949
|
+
libraryId: _t21,
|
|
1950
|
+
objectId: _t22,
|
|
1914
1951
|
metadataSubtree: "public/asset_metadata/live_streams",
|
|
1915
1952
|
resolveLinks: true,
|
|
1916
1953
|
resolveIgnoreErrors: true,
|
|
1917
1954
|
resolveIncludeSource: true
|
|
1918
1955
|
};
|
|
1919
|
-
|
|
1920
|
-
return
|
|
1921
|
-
case
|
|
1922
|
-
streamMetadata =
|
|
1956
|
+
_context11.next = 7;
|
|
1957
|
+
return _t20.ContentObjectMetadata.call(_t20, _t23);
|
|
1958
|
+
case 7:
|
|
1959
|
+
streamMetadata = _context11.sent;
|
|
1923
1960
|
activeUrlMap = {};
|
|
1924
|
-
|
|
1961
|
+
_context11.next = 8;
|
|
1925
1962
|
return this.utils.LimitedMap(10, Object.keys(streamMetadata || {}), /*#__PURE__*/function () {
|
|
1926
|
-
var
|
|
1963
|
+
var _ref23 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10(slug) {
|
|
1927
1964
|
var stream, versionHash, objectId, libraryId, status, streamMeta, url, isActive;
|
|
1928
|
-
return _regeneratorRuntime.wrap(function
|
|
1929
|
-
while (1) switch (
|
|
1965
|
+
return _regeneratorRuntime.wrap(function (_context10) {
|
|
1966
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
1930
1967
|
case 0:
|
|
1931
1968
|
stream = streamMetadata[slug];
|
|
1932
1969
|
if (stream && stream["."] && stream["."].source) {
|
|
1933
1970
|
versionHash = stream["."].source;
|
|
1934
1971
|
}
|
|
1935
1972
|
if (!versionHash) {
|
|
1936
|
-
|
|
1973
|
+
_context10.next = 4;
|
|
1937
1974
|
break;
|
|
1938
1975
|
}
|
|
1939
1976
|
objectId = _this2.utils.DecodeVersionHash(versionHash).objectId;
|
|
1940
|
-
|
|
1977
|
+
_context10.next = 1;
|
|
1941
1978
|
return _this2.ContentObjectLibraryId({
|
|
1942
1979
|
objectId: objectId
|
|
1943
1980
|
});
|
|
1944
|
-
case
|
|
1945
|
-
libraryId =
|
|
1946
|
-
|
|
1981
|
+
case 1:
|
|
1982
|
+
libraryId = _context10.sent;
|
|
1983
|
+
_context10.next = 2;
|
|
1947
1984
|
return _this2.StreamStatus({
|
|
1948
1985
|
name: objectId
|
|
1949
1986
|
});
|
|
1950
|
-
case
|
|
1951
|
-
status =
|
|
1952
|
-
|
|
1987
|
+
case 2:
|
|
1988
|
+
status = _context10.sent;
|
|
1989
|
+
_context10.next = 3;
|
|
1953
1990
|
return _this2.ContentObjectMetadata({
|
|
1954
1991
|
objectId: objectId,
|
|
1955
1992
|
libraryId: libraryId,
|
|
@@ -1957,50 +1994,50 @@ exports.StreamListUrls = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regenerat
|
|
|
1957
1994
|
// live_recording_config/url is the old path
|
|
1958
1995
|
"live_recording_config/url"]
|
|
1959
1996
|
});
|
|
1960
|
-
case
|
|
1961
|
-
streamMeta =
|
|
1997
|
+
case 3:
|
|
1998
|
+
streamMeta = _context10.sent;
|
|
1962
1999
|
url = streamMeta.live_recording_config.reference_url || streamMeta.live_recording_config.url;
|
|
1963
2000
|
isActive = [STATUS_MAP.STARTING, STATUS_MAP.RUNNING, STATUS_MAP.STALLED, STATUS_MAP.STOPPED].includes(status.state);
|
|
1964
2001
|
if (url && isActive) {
|
|
1965
2002
|
activeUrlMap[url] = true;
|
|
1966
2003
|
}
|
|
1967
|
-
case
|
|
2004
|
+
case 4:
|
|
1968
2005
|
case "end":
|
|
1969
|
-
return
|
|
2006
|
+
return _context10.stop();
|
|
1970
2007
|
}
|
|
1971
|
-
},
|
|
2008
|
+
}, _callee10);
|
|
1972
2009
|
}));
|
|
1973
|
-
return function (
|
|
1974
|
-
return
|
|
2010
|
+
return function (_x10) {
|
|
2011
|
+
return _ref23.apply(this, arguments);
|
|
1975
2012
|
};
|
|
1976
2013
|
}());
|
|
1977
|
-
case
|
|
2014
|
+
case 8:
|
|
1978
2015
|
streamUrlStatus = {};
|
|
1979
|
-
|
|
1980
|
-
|
|
2016
|
+
_t24 = this;
|
|
2017
|
+
_context11.next = 9;
|
|
1981
2018
|
return this.ContentObjectLibraryId({
|
|
1982
2019
|
objectId: siteId
|
|
1983
2020
|
});
|
|
1984
|
-
case
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
libraryId:
|
|
1989
|
-
objectId:
|
|
2021
|
+
case 9:
|
|
2022
|
+
_t25 = _context11.sent;
|
|
2023
|
+
_t26 = siteId;
|
|
2024
|
+
_t27 = {
|
|
2025
|
+
libraryId: _t25,
|
|
2026
|
+
objectId: _t26,
|
|
1990
2027
|
metadataSubtree: "/live_stream_urls",
|
|
1991
2028
|
resolveLinks: true,
|
|
1992
2029
|
resolveIgnoreErrors: true
|
|
1993
2030
|
};
|
|
1994
|
-
|
|
1995
|
-
return
|
|
1996
|
-
case
|
|
1997
|
-
streamUrls =
|
|
2031
|
+
_context11.next = 10;
|
|
2032
|
+
return _t24.ContentObjectMetadata.call(_t24, _t27);
|
|
2033
|
+
case 10:
|
|
2034
|
+
streamUrls = _context11.sent;
|
|
1998
2035
|
if (streamUrls) {
|
|
1999
|
-
|
|
2036
|
+
_context11.next = 11;
|
|
2000
2037
|
break;
|
|
2001
2038
|
}
|
|
2002
2039
|
throw Error("No pre-allocated URLs configured");
|
|
2003
|
-
case
|
|
2040
|
+
case 11:
|
|
2004
2041
|
Object.keys(streamUrls || {}).forEach(function (protocol) {
|
|
2005
2042
|
streamUrlStatus[protocol] = streamUrls[protocol].map(function (url) {
|
|
2006
2043
|
return {
|
|
@@ -2009,16 +2046,16 @@ exports.StreamListUrls = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regenerat
|
|
|
2009
2046
|
};
|
|
2010
2047
|
});
|
|
2011
2048
|
});
|
|
2012
|
-
return
|
|
2013
|
-
case
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
console.error(
|
|
2017
|
-
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:
|
|
2018
2055
|
case "end":
|
|
2019
|
-
return
|
|
2056
|
+
return _context11.stop();
|
|
2020
2057
|
}
|
|
2021
|
-
},
|
|
2058
|
+
}, _callee11, this, [[1, 12]]);
|
|
2022
2059
|
}));
|
|
2023
2060
|
|
|
2024
2061
|
/**
|
|
@@ -2077,89 +2114,89 @@ exports.StreamListUrls = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regenerat
|
|
|
2077
2114
|
*/
|
|
2078
2115
|
|
|
2079
2116
|
exports.StreamCopyToVod = /*#__PURE__*/function () {
|
|
2080
|
-
var
|
|
2081
|
-
var name, targetObjectId, eventId,
|
|
2082
|
-
return _regeneratorRuntime.wrap(function
|
|
2083
|
-
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) {
|
|
2084
2121
|
case 0:
|
|
2085
|
-
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;
|
|
2086
2123
|
objectId = name;
|
|
2087
2124
|
abrProfile = require("../abr_profiles/abr_profile_live_to_vod.js");
|
|
2088
|
-
|
|
2125
|
+
_context12.next = 1;
|
|
2089
2126
|
return this.StreamStatus({
|
|
2090
2127
|
name: name
|
|
2091
2128
|
});
|
|
2092
|
-
case
|
|
2093
|
-
status =
|
|
2129
|
+
case 1:
|
|
2130
|
+
status = _context12.sent;
|
|
2094
2131
|
libraryId = status.library_id;
|
|
2095
2132
|
this.Log("Copying stream ".concat(name, " to target ").concat(targetObjectId));
|
|
2096
2133
|
ValidateObject(targetObjectId);
|
|
2097
|
-
|
|
2134
|
+
_context12.next = 2;
|
|
2098
2135
|
return this.ContentObjectLibraryId({
|
|
2099
2136
|
objectId: targetObjectId
|
|
2100
2137
|
});
|
|
2101
|
-
case
|
|
2102
|
-
targetLibraryId =
|
|
2103
|
-
|
|
2138
|
+
case 2:
|
|
2139
|
+
targetLibraryId = _context12.sent;
|
|
2140
|
+
_context12.next = 3;
|
|
2104
2141
|
return this.authClient.KMSAddress({
|
|
2105
2142
|
objectId: targetObjectId
|
|
2106
2143
|
});
|
|
2107
|
-
case
|
|
2108
|
-
kmsAddress =
|
|
2144
|
+
case 3:
|
|
2145
|
+
kmsAddress = _context12.sent;
|
|
2109
2146
|
kmsCapId = "eluv.caps.ikms".concat(this.utils.AddressToHash(kmsAddress));
|
|
2110
|
-
|
|
2147
|
+
_context12.next = 4;
|
|
2111
2148
|
return this.ContentObjectMetadata({
|
|
2112
2149
|
libraryId: targetLibraryId,
|
|
2113
2150
|
objectId: targetObjectId,
|
|
2114
2151
|
metadataSubtree: kmsCapId
|
|
2115
2152
|
});
|
|
2116
|
-
case
|
|
2117
|
-
kmsCap =
|
|
2153
|
+
case 4:
|
|
2154
|
+
kmsCap = _context12.sent;
|
|
2118
2155
|
if (kmsCap) {
|
|
2119
|
-
|
|
2156
|
+
_context12.next = 5;
|
|
2120
2157
|
break;
|
|
2121
2158
|
}
|
|
2122
2159
|
throw Error("No content encryption key set for object ".concat(targetObjectId));
|
|
2123
|
-
case
|
|
2124
|
-
|
|
2160
|
+
case 5:
|
|
2161
|
+
_context12.prev = 5;
|
|
2125
2162
|
status.live_object_id = objectId;
|
|
2126
|
-
|
|
2163
|
+
_context12.next = 6;
|
|
2127
2164
|
return this.LatestVersionHash({
|
|
2128
2165
|
objectId: objectId,
|
|
2129
2166
|
libraryId: libraryId
|
|
2130
2167
|
});
|
|
2131
|
-
case
|
|
2132
|
-
liveHash =
|
|
2168
|
+
case 6:
|
|
2169
|
+
liveHash = _context12.sent;
|
|
2133
2170
|
status.live_hash = liveHash;
|
|
2134
2171
|
if (!eventId) {
|
|
2135
|
-
|
|
2172
|
+
_context12.next = 8;
|
|
2136
2173
|
break;
|
|
2137
2174
|
}
|
|
2138
|
-
|
|
2175
|
+
_context12.next = 7;
|
|
2139
2176
|
return this.CueInfo({
|
|
2140
2177
|
eventId: eventId,
|
|
2141
2178
|
status: status
|
|
2142
2179
|
});
|
|
2143
|
-
case
|
|
2144
|
-
event =
|
|
2180
|
+
case 7:
|
|
2181
|
+
event = _context12.sent;
|
|
2145
2182
|
if (event.eventStart && event.eventEnd) {
|
|
2146
2183
|
startTime = event.eventStart;
|
|
2147
2184
|
endTime = event.eventEnd;
|
|
2148
2185
|
}
|
|
2149
|
-
case
|
|
2150
|
-
|
|
2186
|
+
case 8:
|
|
2187
|
+
_context12.next = 9;
|
|
2151
2188
|
return this.EditContentObject({
|
|
2152
2189
|
objectId: targetObjectId,
|
|
2153
2190
|
libraryId: targetLibraryId
|
|
2154
2191
|
});
|
|
2155
|
-
case
|
|
2156
|
-
_yield$this$EditConte2 =
|
|
2192
|
+
case 9:
|
|
2193
|
+
_yield$this$EditConte2 = _context12.sent;
|
|
2157
2194
|
writeToken = _yield$this$EditConte2.writeToken;
|
|
2158
2195
|
status.target_object_id = targetObjectId;
|
|
2159
2196
|
status.target_library_id = targetLibraryId;
|
|
2160
2197
|
status.target_write_token = writeToken;
|
|
2161
2198
|
this.Log("Process live source (takes around 20 sec per hour of content)");
|
|
2162
|
-
|
|
2199
|
+
_context12.next = 10;
|
|
2163
2200
|
return this.CallBitcodeMethod({
|
|
2164
2201
|
libraryId: targetLibraryId,
|
|
2165
2202
|
objectId: targetObjectId,
|
|
@@ -2178,7 +2215,7 @@ exports.StreamCopyToVod = /*#__PURE__*/function () {
|
|
|
2178
2215
|
constant: false,
|
|
2179
2216
|
format: "text"
|
|
2180
2217
|
});
|
|
2181
|
-
case
|
|
2218
|
+
case 10:
|
|
2182
2219
|
abrMezInitBody = {
|
|
2183
2220
|
abr_profile: abrProfile,
|
|
2184
2221
|
"offering_key": "default",
|
|
@@ -2186,7 +2223,7 @@ exports.StreamCopyToVod = /*#__PURE__*/function () {
|
|
|
2186
2223
|
"variant_key": "default",
|
|
2187
2224
|
"keep_other_streams": false
|
|
2188
2225
|
};
|
|
2189
|
-
|
|
2226
|
+
_context12.next = 11;
|
|
2190
2227
|
return this.CallBitcodeMethod({
|
|
2191
2228
|
libraryId: targetLibraryId,
|
|
2192
2229
|
objectId: targetObjectId,
|
|
@@ -2196,9 +2233,9 @@ exports.StreamCopyToVod = /*#__PURE__*/function () {
|
|
|
2196
2233
|
constant: false,
|
|
2197
2234
|
format: "text"
|
|
2198
2235
|
});
|
|
2199
|
-
case
|
|
2200
|
-
|
|
2201
|
-
|
|
2236
|
+
case 11:
|
|
2237
|
+
_context12.prev = 11;
|
|
2238
|
+
_context12.next = 12;
|
|
2202
2239
|
return this.CallBitcodeMethod({
|
|
2203
2240
|
libraryId: targetLibraryId,
|
|
2204
2241
|
objectId: targetObjectId,
|
|
@@ -2208,16 +2245,16 @@ exports.StreamCopyToVod = /*#__PURE__*/function () {
|
|
|
2208
2245
|
constant: false,
|
|
2209
2246
|
format: "text"
|
|
2210
2247
|
});
|
|
2211
|
-
case
|
|
2212
|
-
|
|
2248
|
+
case 12:
|
|
2249
|
+
_context12.next = 14;
|
|
2213
2250
|
break;
|
|
2214
|
-
case
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
console.error("Unable to call /media/live_to_vod/copy",
|
|
2218
|
-
throw
|
|
2219
|
-
case
|
|
2220
|
-
|
|
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;
|
|
2221
2258
|
return this.CallBitcodeMethod({
|
|
2222
2259
|
libraryId: targetLibraryId,
|
|
2223
2260
|
objectId: targetObjectId,
|
|
@@ -2227,22 +2264,22 @@ exports.StreamCopyToVod = /*#__PURE__*/function () {
|
|
|
2227
2264
|
constant: false,
|
|
2228
2265
|
format: "text"
|
|
2229
2266
|
});
|
|
2230
|
-
case
|
|
2267
|
+
case 15:
|
|
2231
2268
|
if (!finalize) {
|
|
2232
|
-
|
|
2269
|
+
_context12.next = 17;
|
|
2233
2270
|
break;
|
|
2234
2271
|
}
|
|
2235
|
-
|
|
2272
|
+
_context12.next = 16;
|
|
2236
2273
|
return this.FinalizeContentObject({
|
|
2237
2274
|
libraryId: targetLibraryId,
|
|
2238
2275
|
objectId: targetObjectId,
|
|
2239
2276
|
writeToken: writeToken,
|
|
2240
2277
|
commitMessage: "Live Stream to VoD"
|
|
2241
2278
|
});
|
|
2242
|
-
case
|
|
2243
|
-
finalizeResponse =
|
|
2279
|
+
case 16:
|
|
2280
|
+
finalizeResponse = _context12.sent;
|
|
2244
2281
|
status.target_hash = finalizeResponse.hash;
|
|
2245
|
-
case
|
|
2282
|
+
case 17:
|
|
2246
2283
|
// Clean up unnecessary status items
|
|
2247
2284
|
delete status.playout_urls;
|
|
2248
2285
|
delete status.lro_status_url;
|
|
@@ -2250,20 +2287,20 @@ exports.StreamCopyToVod = /*#__PURE__*/function () {
|
|
|
2250
2287
|
delete status.recording_period_sequence;
|
|
2251
2288
|
delete status.edge_meta_size;
|
|
2252
2289
|
delete status.insertions;
|
|
2253
|
-
return
|
|
2254
|
-
case
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
this.Log(
|
|
2258
|
-
throw
|
|
2259
|
-
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:
|
|
2260
2297
|
case "end":
|
|
2261
|
-
return
|
|
2298
|
+
return _context12.stop();
|
|
2262
2299
|
}
|
|
2263
|
-
},
|
|
2300
|
+
}, _callee12, this, [[5, 18], [11, 13]]);
|
|
2264
2301
|
}));
|
|
2265
|
-
return function (
|
|
2266
|
-
return
|
|
2302
|
+
return function (_x11) {
|
|
2303
|
+
return _ref25.apply(this, arguments);
|
|
2267
2304
|
};
|
|
2268
2305
|
}();
|
|
2269
2306
|
|
|
@@ -2284,48 +2321,48 @@ exports.StreamCopyToVod = /*#__PURE__*/function () {
|
|
|
2284
2321
|
* @return {Promise<Object>} - The finalize response
|
|
2285
2322
|
*/
|
|
2286
2323
|
exports.StreamRemoveWatermark = /*#__PURE__*/function () {
|
|
2287
|
-
var
|
|
2288
|
-
var libraryId, objectId, writeToken, types,
|
|
2289
|
-
return _regeneratorRuntime.wrap(function
|
|
2290
|
-
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) {
|
|
2291
2328
|
case 0:
|
|
2292
|
-
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;
|
|
2293
2330
|
ValidateObject(objectId);
|
|
2294
2331
|
if (libraryId) {
|
|
2295
|
-
|
|
2332
|
+
_context13.next = 2;
|
|
2296
2333
|
break;
|
|
2297
2334
|
}
|
|
2298
|
-
|
|
2335
|
+
_context13.next = 1;
|
|
2299
2336
|
return this.ContentObjectLibraryId({
|
|
2300
2337
|
objectId: objectId
|
|
2301
2338
|
});
|
|
2302
|
-
case
|
|
2303
|
-
libraryId =
|
|
2304
|
-
case
|
|
2339
|
+
case 1:
|
|
2340
|
+
libraryId = _context13.sent;
|
|
2341
|
+
case 2:
|
|
2305
2342
|
if (writeToken) {
|
|
2306
|
-
|
|
2343
|
+
_context13.next = 4;
|
|
2307
2344
|
break;
|
|
2308
2345
|
}
|
|
2309
|
-
|
|
2346
|
+
_context13.next = 3;
|
|
2310
2347
|
return this.EditContentObject({
|
|
2311
2348
|
objectId: objectId,
|
|
2312
2349
|
libraryId: libraryId
|
|
2313
2350
|
});
|
|
2314
|
-
case
|
|
2315
|
-
_yield$this$EditConte3 =
|
|
2351
|
+
case 3:
|
|
2352
|
+
_yield$this$EditConte3 = _context13.sent;
|
|
2316
2353
|
writeToken = _yield$this$EditConte3.writeToken;
|
|
2317
|
-
case
|
|
2354
|
+
case 4:
|
|
2318
2355
|
this.Log("Removing watermark types: ".concat(types.join(", "), " ").concat(libraryId, " ").concat(objectId));
|
|
2319
|
-
|
|
2356
|
+
_context13.next = 5;
|
|
2320
2357
|
return this.ContentObjectMetadata({
|
|
2321
2358
|
objectId: objectId,
|
|
2322
2359
|
libraryId: libraryId,
|
|
2323
2360
|
metadataSubtree: "/live_recording/fabric_config/edge_write_token"
|
|
2324
2361
|
});
|
|
2325
|
-
case
|
|
2326
|
-
edgeWriteToken =
|
|
2362
|
+
case 5:
|
|
2363
|
+
edgeWriteToken = _context13.sent;
|
|
2327
2364
|
metadataPath = "live_recording/playout_config";
|
|
2328
|
-
|
|
2365
|
+
_context13.next = 6;
|
|
2329
2366
|
return this.ContentObjectMetadata({
|
|
2330
2367
|
libraryId: libraryId,
|
|
2331
2368
|
objectId: objectId,
|
|
@@ -2333,14 +2370,14 @@ exports.StreamRemoveWatermark = /*#__PURE__*/function () {
|
|
|
2333
2370
|
metadataSubtree: metadataPath,
|
|
2334
2371
|
resolveLinks: false
|
|
2335
2372
|
});
|
|
2336
|
-
case
|
|
2337
|
-
objectMetadata =
|
|
2373
|
+
case 6:
|
|
2374
|
+
objectMetadata = _context13.sent;
|
|
2338
2375
|
if (objectMetadata) {
|
|
2339
|
-
|
|
2376
|
+
_context13.next = 7;
|
|
2340
2377
|
break;
|
|
2341
2378
|
}
|
|
2342
2379
|
throw Error("Stream object must be configured before removing a watermark");
|
|
2343
|
-
case
|
|
2380
|
+
case 7:
|
|
2344
2381
|
types.forEach(function (type) {
|
|
2345
2382
|
if (type === "text") {
|
|
2346
2383
|
delete objectMetadata.simple_watermark;
|
|
@@ -2350,7 +2387,7 @@ exports.StreamRemoveWatermark = /*#__PURE__*/function () {
|
|
|
2350
2387
|
delete objectMetadata.forensic_watermark;
|
|
2351
2388
|
}
|
|
2352
2389
|
});
|
|
2353
|
-
|
|
2390
|
+
_context13.next = 8;
|
|
2354
2391
|
return this.ReplaceMetadata({
|
|
2355
2392
|
libraryId: libraryId,
|
|
2356
2393
|
objectId: objectId,
|
|
@@ -2358,12 +2395,12 @@ exports.StreamRemoveWatermark = /*#__PURE__*/function () {
|
|
|
2358
2395
|
metadataSubtree: metadataPath,
|
|
2359
2396
|
metadata: objectMetadata
|
|
2360
2397
|
});
|
|
2361
|
-
case
|
|
2398
|
+
case 8:
|
|
2362
2399
|
if (!edgeWriteToken) {
|
|
2363
|
-
|
|
2400
|
+
_context13.next = 9;
|
|
2364
2401
|
break;
|
|
2365
2402
|
}
|
|
2366
|
-
|
|
2403
|
+
_context13.next = 9;
|
|
2367
2404
|
return this.ReplaceMetadata({
|
|
2368
2405
|
libraryId: libraryId,
|
|
2369
2406
|
objectId: objectId,
|
|
@@ -2371,29 +2408,29 @@ exports.StreamRemoveWatermark = /*#__PURE__*/function () {
|
|
|
2371
2408
|
metadataSubtree: metadataPath,
|
|
2372
2409
|
metadata: objectMetadata
|
|
2373
2410
|
});
|
|
2374
|
-
case
|
|
2411
|
+
case 9:
|
|
2375
2412
|
if (!finalize) {
|
|
2376
|
-
|
|
2413
|
+
_context13.next = 11;
|
|
2377
2414
|
break;
|
|
2378
2415
|
}
|
|
2379
|
-
|
|
2416
|
+
_context13.next = 10;
|
|
2380
2417
|
return this.FinalizeContentObject({
|
|
2381
2418
|
libraryId: libraryId,
|
|
2382
2419
|
objectId: objectId,
|
|
2383
2420
|
writeToken: writeToken,
|
|
2384
2421
|
commitMessage: "Watermark removed"
|
|
2385
2422
|
});
|
|
2386
|
-
case
|
|
2387
|
-
finalizeResponse =
|
|
2388
|
-
return
|
|
2389
|
-
case
|
|
2423
|
+
case 10:
|
|
2424
|
+
finalizeResponse = _context13.sent;
|
|
2425
|
+
return _context13.abrupt("return", finalizeResponse);
|
|
2426
|
+
case 11:
|
|
2390
2427
|
case "end":
|
|
2391
|
-
return
|
|
2428
|
+
return _context13.stop();
|
|
2392
2429
|
}
|
|
2393
|
-
},
|
|
2430
|
+
}, _callee13, this);
|
|
2394
2431
|
}));
|
|
2395
|
-
return function (
|
|
2396
|
-
return
|
|
2432
|
+
return function (_x12) {
|
|
2433
|
+
return _ref27.apply(this, arguments);
|
|
2397
2434
|
};
|
|
2398
2435
|
}();
|
|
2399
2436
|
|
|
@@ -2448,49 +2485,49 @@ exports.StreamRemoveWatermark = /*#__PURE__*/function () {
|
|
|
2448
2485
|
* @return {Promise<Object>} - The finalize response
|
|
2449
2486
|
*/
|
|
2450
2487
|
exports.StreamAddWatermark = /*#__PURE__*/function () {
|
|
2451
|
-
var
|
|
2452
|
-
var libraryId, objectId, writeToken, simpleWatermark, imageWatermark, forensicWatermark,
|
|
2453
|
-
return _regeneratorRuntime.wrap(function
|
|
2454
|
-
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) {
|
|
2455
2492
|
case 0:
|
|
2456
|
-
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;
|
|
2457
2494
|
ValidateObject(objectId);
|
|
2458
2495
|
if (libraryId) {
|
|
2459
|
-
|
|
2496
|
+
_context14.next = 2;
|
|
2460
2497
|
break;
|
|
2461
2498
|
}
|
|
2462
|
-
|
|
2499
|
+
_context14.next = 1;
|
|
2463
2500
|
return this.ContentObjectLibraryId({
|
|
2464
2501
|
objectId: objectId
|
|
2465
2502
|
});
|
|
2466
|
-
case
|
|
2467
|
-
libraryId =
|
|
2468
|
-
case
|
|
2503
|
+
case 1:
|
|
2504
|
+
libraryId = _context14.sent;
|
|
2505
|
+
case 2:
|
|
2469
2506
|
if (writeToken) {
|
|
2470
|
-
|
|
2507
|
+
_context14.next = 4;
|
|
2471
2508
|
break;
|
|
2472
2509
|
}
|
|
2473
|
-
|
|
2510
|
+
_context14.next = 3;
|
|
2474
2511
|
return this.EditContentObject({
|
|
2475
2512
|
objectId: objectId,
|
|
2476
2513
|
libraryId: libraryId
|
|
2477
2514
|
});
|
|
2478
|
-
case
|
|
2479
|
-
_yield$this$EditConte4 =
|
|
2515
|
+
case 3:
|
|
2516
|
+
_yield$this$EditConte4 = _context14.sent;
|
|
2480
2517
|
writeToken = _yield$this$EditConte4.writeToken;
|
|
2481
|
-
case
|
|
2482
|
-
|
|
2518
|
+
case 4:
|
|
2519
|
+
_context14.next = 5;
|
|
2483
2520
|
return this.ContentObjectMetadata({
|
|
2484
2521
|
objectId: objectId,
|
|
2485
2522
|
libraryId: libraryId,
|
|
2486
2523
|
metadataSubtree: "/live_recording/fabric_config/edge_write_token"
|
|
2487
2524
|
});
|
|
2488
|
-
case
|
|
2489
|
-
edgeWriteToken =
|
|
2525
|
+
case 5:
|
|
2526
|
+
edgeWriteToken = _context14.sent;
|
|
2490
2527
|
watermarkType = imageWatermark ? "image" : forensicWatermark ? "forensic" : "text";
|
|
2491
2528
|
metadataPath = "live_recording/playout_config";
|
|
2492
2529
|
this.Log("Adding watermarking type: ".concat(watermarkType, " ").concat(libraryId, " ").concat(objectId));
|
|
2493
|
-
|
|
2530
|
+
_context14.next = 6;
|
|
2494
2531
|
return this.ContentObjectMetadata({
|
|
2495
2532
|
libraryId: libraryId,
|
|
2496
2533
|
objectId: objectId,
|
|
@@ -2498,30 +2535,30 @@ exports.StreamAddWatermark = /*#__PURE__*/function () {
|
|
|
2498
2535
|
metadataSubtree: metadataPath,
|
|
2499
2536
|
resolveLinks: false
|
|
2500
2537
|
});
|
|
2501
|
-
case
|
|
2502
|
-
objectMetadata =
|
|
2538
|
+
case 6:
|
|
2539
|
+
objectMetadata = _context14.sent;
|
|
2503
2540
|
if (objectMetadata) {
|
|
2504
|
-
|
|
2541
|
+
_context14.next = 7;
|
|
2505
2542
|
break;
|
|
2506
2543
|
}
|
|
2507
2544
|
throw Error("Stream object must be configured before adding a watermark");
|
|
2508
|
-
case
|
|
2545
|
+
case 7:
|
|
2509
2546
|
watermarkArgCount = [simpleWatermark, imageWatermark, forensicWatermark].filter(function (i) {
|
|
2510
2547
|
return !!i;
|
|
2511
2548
|
}).length;
|
|
2512
2549
|
console.log("watermark arg count", watermarkArgCount);
|
|
2513
2550
|
if (!(watermarkArgCount === 0)) {
|
|
2514
|
-
|
|
2551
|
+
_context14.next = 8;
|
|
2515
2552
|
break;
|
|
2516
2553
|
}
|
|
2517
2554
|
throw Error("No watermark was provided");
|
|
2518
|
-
case
|
|
2555
|
+
case 8:
|
|
2519
2556
|
if (!(watermarkArgCount > 1)) {
|
|
2520
|
-
|
|
2557
|
+
_context14.next = 9;
|
|
2521
2558
|
break;
|
|
2522
2559
|
}
|
|
2523
2560
|
throw Error("Only one watermark is allowed");
|
|
2524
|
-
case
|
|
2561
|
+
case 9:
|
|
2525
2562
|
if (simpleWatermark) {
|
|
2526
2563
|
objectMetadata.simple_watermark = simpleWatermark;
|
|
2527
2564
|
} else if (imageWatermark) {
|
|
@@ -2529,7 +2566,7 @@ exports.StreamAddWatermark = /*#__PURE__*/function () {
|
|
|
2529
2566
|
} else if (forensicWatermark) {
|
|
2530
2567
|
objectMetadata.forensic_watermark = forensicWatermark;
|
|
2531
2568
|
}
|
|
2532
|
-
|
|
2569
|
+
_context14.next = 10;
|
|
2533
2570
|
return this.ReplaceMetadata({
|
|
2534
2571
|
libraryId: libraryId,
|
|
2535
2572
|
objectId: objectId,
|
|
@@ -2537,12 +2574,12 @@ exports.StreamAddWatermark = /*#__PURE__*/function () {
|
|
|
2537
2574
|
metadataSubtree: metadataPath,
|
|
2538
2575
|
metadata: objectMetadata
|
|
2539
2576
|
});
|
|
2540
|
-
case
|
|
2577
|
+
case 10:
|
|
2541
2578
|
if (!edgeWriteToken) {
|
|
2542
|
-
|
|
2579
|
+
_context14.next = 11;
|
|
2543
2580
|
break;
|
|
2544
2581
|
}
|
|
2545
|
-
|
|
2582
|
+
_context14.next = 11;
|
|
2546
2583
|
return this.ReplaceMetadata({
|
|
2547
2584
|
libraryId: libraryId,
|
|
2548
2585
|
objectId: objectId,
|
|
@@ -2550,36 +2587,36 @@ exports.StreamAddWatermark = /*#__PURE__*/function () {
|
|
|
2550
2587
|
metadataSubtree: metadataPath,
|
|
2551
2588
|
metadata: objectMetadata
|
|
2552
2589
|
});
|
|
2553
|
-
case
|
|
2590
|
+
case 11:
|
|
2554
2591
|
response = {
|
|
2555
2592
|
"imageWatermark": objectMetadata.image_watermark,
|
|
2556
2593
|
"textWatermark": objectMetadata.simple_watermark,
|
|
2557
2594
|
"forensicWatermark": objectMetadata.forensic_watermark
|
|
2558
2595
|
};
|
|
2559
2596
|
if (!finalize) {
|
|
2560
|
-
|
|
2597
|
+
_context14.next = 13;
|
|
2561
2598
|
break;
|
|
2562
2599
|
}
|
|
2563
|
-
|
|
2600
|
+
_context14.next = 12;
|
|
2564
2601
|
return this.FinalizeContentObject({
|
|
2565
2602
|
libraryId: libraryId,
|
|
2566
2603
|
objectId: objectId,
|
|
2567
2604
|
writeToken: writeToken,
|
|
2568
2605
|
commitMessage: "Watermark set"
|
|
2569
2606
|
});
|
|
2570
|
-
case
|
|
2571
|
-
finalizeResponse =
|
|
2607
|
+
case 12:
|
|
2608
|
+
finalizeResponse = _context14.sent;
|
|
2572
2609
|
response.hash = finalizeResponse.hash;
|
|
2573
|
-
case
|
|
2574
|
-
return
|
|
2575
|
-
case
|
|
2610
|
+
case 13:
|
|
2611
|
+
return _context14.abrupt("return", response);
|
|
2612
|
+
case 14:
|
|
2576
2613
|
case "end":
|
|
2577
|
-
return
|
|
2614
|
+
return _context14.stop();
|
|
2578
2615
|
}
|
|
2579
|
-
},
|
|
2616
|
+
}, _callee14, this);
|
|
2580
2617
|
}));
|
|
2581
|
-
return function (
|
|
2582
|
-
return
|
|
2618
|
+
return function (_x13) {
|
|
2619
|
+
return _ref29.apply(this, arguments);
|
|
2583
2620
|
};
|
|
2584
2621
|
}();
|
|
2585
2622
|
|
|
@@ -2597,13 +2634,13 @@ exports.StreamAddWatermark = /*#__PURE__*/function () {
|
|
|
2597
2634
|
* @returns {Promise<Object>} - Response describing audit results
|
|
2598
2635
|
*/
|
|
2599
2636
|
exports.AuditStream = /*#__PURE__*/function () {
|
|
2600
|
-
var
|
|
2637
|
+
var _ref31 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref30) {
|
|
2601
2638
|
var objectId, versionHash, salt, samples, authorizationToken;
|
|
2602
|
-
return _regeneratorRuntime.wrap(function
|
|
2603
|
-
while (1) switch (
|
|
2639
|
+
return _regeneratorRuntime.wrap(function (_context15) {
|
|
2640
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
2604
2641
|
case 0:
|
|
2605
|
-
objectId =
|
|
2606
|
-
|
|
2642
|
+
objectId = _ref30.objectId, versionHash = _ref30.versionHash, salt = _ref30.salt, samples = _ref30.samples, authorizationToken = _ref30.authorizationToken;
|
|
2643
|
+
_context15.next = 1;
|
|
2607
2644
|
return ContentObjectAudit.AuditContentObject({
|
|
2608
2645
|
client: this,
|
|
2609
2646
|
objectId: objectId,
|
|
@@ -2613,15 +2650,15 @@ exports.AuditStream = /*#__PURE__*/function () {
|
|
|
2613
2650
|
live: true,
|
|
2614
2651
|
authorizationToken: authorizationToken
|
|
2615
2652
|
});
|
|
2616
|
-
case
|
|
2617
|
-
return
|
|
2618
|
-
case
|
|
2653
|
+
case 1:
|
|
2654
|
+
return _context15.abrupt("return", _context15.sent);
|
|
2655
|
+
case 2:
|
|
2619
2656
|
case "end":
|
|
2620
|
-
return
|
|
2657
|
+
return _context15.stop();
|
|
2621
2658
|
}
|
|
2622
|
-
},
|
|
2659
|
+
}, _callee15, this);
|
|
2623
2660
|
}));
|
|
2624
|
-
return function (
|
|
2625
|
-
return
|
|
2661
|
+
return function (_x14) {
|
|
2662
|
+
return _ref31.apply(this, arguments);
|
|
2626
2663
|
};
|
|
2627
2664
|
}();
|