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