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