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