@eluvio/elv-client-js 4.0.77 → 4.0.78

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.
@@ -449,7 +449,7 @@ var FrameClient = /*#__PURE__*/function () {
449
449
  }, {
450
450
  key: "AllowedMethods",
451
451
  value: function AllowedMethods() {
452
- return ["AccessGroupManagers", "AccessGroupMembers", "AccessGroupOwner", "AccessInfo", "AccessRequest", "AccessType", "AddAccessGroupManager", "AddAccessGroupMember", "AddContentLibraryGroup", "AddContentObjectGroupPermission", "AddLibraryContentType", "AssetMetadata", "AvailableDRMs", "AvailableOfferings", "AwaitPending", "BitmovinPlayoutOptions", "BlockNumber", "CallBitcodeMethod", "CallContractMethod", "CallContractMethodAndWait", "ClearCache", "ClearStaticToken", "Collection", "CollectionTransactions", "ConfigUrl", "ContentLibraries", "ContentLibrary", "ContentLibraryGroupPermissions", "ContentLibraryOwner", "ContentObject", "ContentObjectAccessComplete", "ContentObjectGraph", "ContentObjectGroupPermissions", "ContentObjectImageUrl", "ContentObjectLibraryId", "ContentObjectMetadata", "ContentObjectOwner", "ContentObjectTenantId", "ContentObjectVersions", "ContentObjects", "ContentPart", "ContentParts", "ContentSpaceId", "ContentType", "ContentTypeOwner", "ContentTypes", "ContractAbi", "ContractEvents", "ContractInfo", "ContractMetadata", "ContractName", "CopyContentObject", "CreateABRMezzanine", "CreateAccessGroup", "CreateAndFinalizeContentObject", "CreateContentLibrary", "CreateContentObject", "CreateContentType", "CreateEncryptionConk", "CreateFabricToken", "CreateFileDirectories", "CreateFileUploadJob", "CreateLinks", "CreateNTPInstance", "CreateNonOwnerCap", "CreatePart", "CreateProductionMaster", "CreateSignedToken", "CurrentAccountAddress", "CustomContractAddress", "Decrypt", "DecryptECIES", "DefaultKMSAddress", "DeleteAccessGroup", "DeleteContentLibrary", "DeleteContentObject", "DeleteContentVersion", "DeleteFiles", "DeleteMetadata", "DeleteNTPInstance", "DeletePart", "DeployContract", "Download", "DownloadEncrypted", "DownloadFile", "DownloadPart", "EditAndFinalizeContentObject", "EditContentObject", "EmbedUrl", "Encrypt", "EncryptECIES", "EncryptionConk", "Events", "ExtractEventFromLogs", "ExtractValueFromEvent", "FabricUrl", "FileUrl", "FinalizeABRMezzanine", "FinalizeContentObject", "FinalizePart", "FinalizeStateChannelAccess", "FinalizeUploadJob", "FormatContractArguments", "GenerateStateChannelToken", "GenerateSignedLinkToken", "GetBalance", "InitializeAuthPolicy", "IssueNTPCode", "IssueSignedNTPCode", "LatestVersionHash", "LibraryContentTypes", "LinkAccessGroupToOauth", "LinkData", "LinkTarget", "LinkUrl", "ListAccessGroups", "ListFiles", "ListNTPInstances", "LRODraftInfo", "LROStatus", "MakeAuthServiceRequest", "MergeContractMetadata", "MergeMetadata", "MetadataAuth", "MintNFT", "MoveFiles", "NetworkInfo", "NodeId", "Nodes", "NTPInstance", "Permission", "PlayoutOptions", "PlayoutPathResolution", "ProduceMetadataLinks", "Proofs", "PublicRep", "PublishContentVersion", "QParts", "RecordWriteToken", "RedeemCode", "RemoveAccessGroupManager", "RemoveAccessGroupMember", "RemoveContentObjectGroupPermission", "RemoveContentLibraryGroup", "RemoveLibraryContentType", "Rep", "ReplaceContractMetadata", "ReplaceMetadata", "Request", "ResetRegion", "SendFunds", "SetAccessCharge", "SetAuth", "SetAuthContext", "SetAuthPolicy", "SetContentLibraryImage", "SetContentObjectImage", "SetCustomContentContract", "SetGroupPermission", "SetNodes", "SetOauthToken", "SetPolicyAuthorization", "SetSignerFromOauthToken", "SetStaticToken", "SetVisibility", "SetPermission", "SpaceNodes", "StartABRMezzanineJobs", "StreamConfig", "StreamCreate", "StreamInitialize", "StreamInsertion", "StreamStatus", "StreamStartOrStopOrReset", "StreamStopSession", "SuspendNTPInstance", "UnlinkAccessGroupFromOauth", "UpdateContentObjectGraph", "UpdateNTPInstance", "UploadFileData", "UploadFilesFromS3", "UploadJobStatus", "UploadPart", "UploadPartChunk", "UploadStatus", "UseRegion", "VerifyContentObject", "Visibility", "WriteTokenNodeUrl"];
452
+ return ["AccessGroupManagers", "AccessGroupMembers", "AccessGroupOwner", "AccessInfo", "AccessRequest", "AccessType", "AddAccessGroupManager", "AddAccessGroupMember", "AddContentLibraryGroup", "AddContentObjectGroupPermission", "AddLibraryContentType", "AssetMetadata", "AvailableDRMs", "AvailableOfferings", "AwaitPending", "BitmovinPlayoutOptions", "BlockNumber", "CallBitcodeMethod", "CallContractMethod", "CallContractMethodAndWait", "ClearCache", "ClearStaticToken", "Collection", "CollectionTransactions", "ConfigUrl", "ContentLibraries", "ContentLibrary", "ContentLibraryGroupPermissions", "ContentLibraryOwner", "ContentObject", "ContentObjectAccessComplete", "ContentObjectGraph", "ContentObjectGroupPermissions", "ContentObjectImageUrl", "ContentObjectLibraryId", "ContentObjectMetadata", "ContentObjectOwner", "ContentObjectTenantId", "ContentObjectVersions", "ContentObjects", "ContentPart", "ContentParts", "ContentSpaceId", "ContentType", "ContentTypeOwner", "ContentTypes", "ContractAbi", "ContractEvents", "ContractInfo", "ContractMetadata", "ContractName", "CopyContentObject", "CreateABRMezzanine", "CreateAccessGroup", "CreateAndFinalizeContentObject", "CreateContentLibrary", "CreateContentObject", "CreateContentType", "CreateEncryptionConk", "CreateFabricToken", "CreateFileDirectories", "CreateFileUploadJob", "CreateLinks", "CreateNTPInstance", "CreateNonOwnerCap", "CreatePart", "CreateProductionMaster", "CreateSignedToken", "CurrentAccountAddress", "CustomContractAddress", "Decrypt", "DecryptECIES", "DefaultKMSAddress", "DeleteAccessGroup", "DeleteContentLibrary", "DeleteContentObject", "DeleteContentVersion", "DeleteFiles", "DeleteMetadata", "DeleteNTPInstance", "DeletePart", "DeployContract", "Download", "DownloadEncrypted", "DownloadFile", "DownloadPart", "EditAndFinalizeContentObject", "EditContentObject", "EmbedUrl", "Encrypt", "EncryptECIES", "EncryptionConk", "Events", "ExtractEventFromLogs", "ExtractValueFromEvent", "FabricUrl", "FileUrl", "FinalizeABRMezzanine", "FinalizeContentObject", "FinalizePart", "FinalizeStateChannelAccess", "FinalizeUploadJob", "FormatContractArguments", "GenerateStateChannelToken", "GenerateSignedLinkToken", "GetBalance", "InitializeAuthPolicy", "IssueNTPCode", "IssueSignedNTPCode", "LatestVersionHash", "LibraryContentTypes", "LinkAccessGroupToOauth", "LinkData", "LinkTarget", "LinkUrl", "ListAccessGroups", "ListFiles", "ListNTPInstances", "LRODraftInfo", "LROStatus", "MakeAuthServiceRequest", "MergeContractMetadata", "MergeMetadata", "MetadataAuth", "MintNFT", "MoveFiles", "NetworkInfo", "NodeId", "Nodes", "NTPInstance", "Permission", "PlayoutOptions", "PlayoutPathResolution", "ProduceMetadataLinks", "Proofs", "PublicRep", "PublishContentVersion", "QParts", "RecordWriteToken", "RedeemCode", "RemoveAccessGroupManager", "RemoveAccessGroupMember", "RemoveContentObjectGroupPermission", "RemoveContentLibraryGroup", "RemoveLibraryContentType", "Rep", "ReplaceContractMetadata", "ReplaceMetadata", "Request", "ResetRegion", "SendFunds", "SetAccessCharge", "SetAuth", "SetAuthContext", "SetAuthPolicy", "SetContentLibraryImage", "SetContentObjectImage", "SetCustomContentContract", "SetGroupPermission", "SetNodes", "SetOauthToken", "SetPolicyAuthorization", "SetSignerFromOauthToken", "SetStaticToken", "SetVisibility", "SetPermission", "SpaceNodes", "StartABRMezzanineJobs", "StreamConfig", "StreamCreate", "StreamDeactivate", "StreamInitialize", "StreamInsertion", "StreamStatus", "StreamStartOrStopOrReset", "StreamStopSession", "SuspendNTPInstance", "UnlinkAccessGroupFromOauth", "UpdateContentObjectGraph", "UpdateNTPInstance", "UploadFileData", "UploadFilesFromS3", "UploadJobStatus", "UploadPart", "UploadPartChunk", "UploadStatus", "UseRegion", "VerifyContentObject", "Visibility", "WriteTokenNodeUrl"];
453
453
  }
454
454
  }, {
455
455
  key: "AllowedUserProfileMethods",
@@ -3289,6 +3289,11 @@ var EmbedMediaTypes = {
3289
3289
  - `showTitle` - Shows the video title, which is set from the title option (if set) or the metadata
3290
3290
  - `title` - Sets the page title
3291
3291
  - `viewRecordKey` - Contains record key
3292
+ - `useTicketCodes` - Use tickets authorization
3293
+ - `tenantId` - Tenant ID, required for tickets authorization
3294
+ - `ntpId` - NTP ID, required for tickets authorization
3295
+ - `ticketCode` - Ticket code, optional with tickets authorization
3296
+ - `ticketSubject` - Ticket subject, optional with tickets authorization
3292
3297
  *
3293
3298
  * @returns {Promise<string>} - Will return an embed URL
3294
3299
  */
@@ -3337,95 +3342,110 @@ exports.EmbedUrl = /*#__PURE__*/function () {
3337
3342
  _i = 0, _Object$keys = Object.keys(options);
3338
3343
  case 18:
3339
3344
  if (!(_i < _Object$keys.length)) {
3340
- _context41.next = 62;
3345
+ _context41.next = 68;
3341
3346
  break;
3342
3347
  }
3343
3348
  option = _Object$keys[_i];
3344
3349
  _context41.t0 = option;
3345
- _context41.next = _context41.t0 === "accountWatermark" ? 23 : _context41.t0 === "autoplay" ? 25 : _context41.t0 === "capLevelToPlayerSize" ? 27 : _context41.t0 === "clipEnd" ? 29 : _context41.t0 === "clipStart" ? 31 : _context41.t0 === "controls" ? 33 : _context41.t0 === "description" ? 35 : _context41.t0 === "directLink" ? 37 : _context41.t0 === "linkPath" ? 39 : _context41.t0 === "loop" ? 41 : _context41.t0 === "muted" ? 43 : _context41.t0 === "offerings" ? 45 : _context41.t0 === "posterUrl" ? 47 : _context41.t0 === "protocols" ? 49 : _context41.t0 === "showShare" ? 51 : _context41.t0 === "showTitle" ? 53 : _context41.t0 === "title" ? 55 : _context41.t0 === "viewRecordKey" ? 57 : 59;
3350
+ _context41.next = _context41.t0 === "accountWatermark" ? 23 : _context41.t0 === "autoplay" ? 25 : _context41.t0 === "capLevelToPlayerSize" ? 27 : _context41.t0 === "clipEnd" ? 29 : _context41.t0 === "clipStart" ? 31 : _context41.t0 === "controls" ? 33 : _context41.t0 === "description" ? 35 : _context41.t0 === "directLink" ? 37 : _context41.t0 === "linkPath" ? 39 : _context41.t0 === "loop" ? 41 : _context41.t0 === "muted" ? 43 : _context41.t0 === "offerings" ? 45 : _context41.t0 === "posterUrl" ? 47 : _context41.t0 === "protocols" ? 49 : _context41.t0 === "showShare" ? 51 : _context41.t0 === "showTitle" ? 53 : _context41.t0 === "title" ? 55 : _context41.t0 === "viewRecordKey" ? 57 : _context41.t0 === "useTicketCodes" ? 59 : 65;
3346
3351
  break;
3347
3352
  case 23:
3348
3353
  embedUrl.searchParams.set("awm", "");
3349
- return _context41.abrupt("break", 59);
3354
+ return _context41.abrupt("break", 65);
3350
3355
  case 25:
3351
3356
  embedUrl.searchParams.set("ap", "");
3352
- return _context41.abrupt("break", 59);
3357
+ return _context41.abrupt("break", 65);
3353
3358
  case 27:
3354
3359
  embedUrl.searchParams.set("cap", "");
3355
- return _context41.abrupt("break", 59);
3360
+ return _context41.abrupt("break", 65);
3356
3361
  case 29:
3357
3362
  embedUrl.searchParams.set("end", options.clipEnd);
3358
- return _context41.abrupt("break", 59);
3363
+ return _context41.abrupt("break", 65);
3359
3364
  case 31:
3360
3365
  embedUrl.searchParams.set("start", options.clipStart);
3361
- return _context41.abrupt("break", 59);
3366
+ return _context41.abrupt("break", 65);
3362
3367
  case 33:
3363
3368
  if (options.controls !== "hide") {
3364
3369
  embedUrl.searchParams.set("ct", controlsMap[options.controls]);
3365
3370
  }
3366
- return _context41.abrupt("break", 59);
3371
+ return _context41.abrupt("break", 65);
3367
3372
  case 35:
3368
3373
  data["og:description"] = options.description;
3369
- return _context41.abrupt("break", 59);
3374
+ return _context41.abrupt("break", 65);
3370
3375
  case 37:
3371
3376
  embedUrl.searchParams.set("dr", "");
3372
- return _context41.abrupt("break", 59);
3377
+ return _context41.abrupt("break", 65);
3373
3378
  case 39:
3374
3379
  embedUrl.searchParams.set("ln", this.utils.B64(options.linkPath));
3375
- return _context41.abrupt("break", 59);
3380
+ return _context41.abrupt("break", 65);
3376
3381
  case 41:
3377
3382
  embedUrl.searchParams.set("lp", "");
3378
- return _context41.abrupt("break", 59);
3383
+ return _context41.abrupt("break", 65);
3379
3384
  case 43:
3380
3385
  embedUrl.searchParams.set("m", "");
3381
- return _context41.abrupt("break", 59);
3386
+ return _context41.abrupt("break", 65);
3382
3387
  case 45:
3383
3388
  embedUrl.searchParams.set("off", options.offerings.join(","));
3384
- return _context41.abrupt("break", 59);
3389
+ return _context41.abrupt("break", 65);
3385
3390
  case 47:
3386
3391
  embedUrl.searchParams.set("pst", options.posterUrl);
3387
- return _context41.abrupt("break", 59);
3392
+ return _context41.abrupt("break", 65);
3388
3393
  case 49:
3389
3394
  embedUrl.searchParams.set("ptc", options.protocols.join(","));
3390
- return _context41.abrupt("break", 59);
3395
+ return _context41.abrupt("break", 65);
3391
3396
  case 51:
3392
3397
  embedUrl.searchParams.set("sh", "");
3393
- return _context41.abrupt("break", 59);
3398
+ return _context41.abrupt("break", 65);
3394
3399
  case 53:
3395
3400
  embedUrl.searchParams.set("st", "");
3396
- return _context41.abrupt("break", 59);
3401
+ return _context41.abrupt("break", 65);
3397
3402
  case 55:
3398
3403
  data["og:title"] = options.title;
3399
- return _context41.abrupt("break", 59);
3404
+ return _context41.abrupt("break", 65);
3400
3405
  case 57:
3401
3406
  embedUrl.searchParams.set("vrk", options.viewRecordKey);
3402
- return _context41.abrupt("break", 59);
3407
+ return _context41.abrupt("break", 65);
3403
3408
  case 59:
3409
+ embedUrl.searchParams.set("ptk", "");
3410
+ if (options.tenantId) {
3411
+ embedUrl.searchParams.set("ten", options.tenantId);
3412
+ }
3413
+ if (options.ntpId) {
3414
+ embedUrl.searchParams.set("ntp", options.ntpId);
3415
+ }
3416
+ if (options.ticketCode) {
3417
+ embedUrl.searchParams.set("tk", Buffer.from(options.ticketCode).toString("base64"));
3418
+ }
3419
+ if (options.ticketSubject) {
3420
+ embedUrl.searchParams.set("sbj", Buffer.from(options.ticketSubject).toString("base64"));
3421
+ }
3422
+ return _context41.abrupt("break", 65);
3423
+ case 65:
3404
3424
  _i++;
3405
3425
  _context41.next = 18;
3406
3426
  break;
3407
- case 62:
3427
+ case 68:
3408
3428
  if (Object.keys(data).length > 0) {
3409
3429
  embedUrl.searchParams.set("data", this.utils.B64(JSON.stringify({
3410
3430
  meta_tags: data
3411
3431
  })));
3412
3432
  }
3413
3433
  if (!["owner", "editable", "viewable"].includes(permission)) {
3414
- _context41.next = 68;
3434
+ _context41.next = 74;
3415
3435
  break;
3416
3436
  }
3417
- _context41.next = 66;
3437
+ _context41.next = 72;
3418
3438
  return this.CreateSignedToken({
3419
3439
  objectId: objectId,
3420
3440
  versionHash: versionHash,
3421
3441
  duration: duration
3422
3442
  });
3423
- case 66:
3443
+ case 72:
3424
3444
  token = _context41.sent;
3425
3445
  embedUrl.searchParams.set("ath", token);
3426
- case 68:
3446
+ case 74:
3427
3447
  return _context41.abrupt("return", embedUrl.toString());
3428
- case 69:
3448
+ case 75:
3429
3449
  case "end":
3430
3450
  return _context41.stop();
3431
3451
  }
@@ -97,6 +97,7 @@ var LiveconfTemplate = {
97
97
  sync_audio_to_stream_id: -1,
98
98
  video_bitrate: null,
99
99
  video_seg_duration_ts: null,
100
+ video_time_base: null,
100
101
  xc_type: 3
101
102
  }
102
103
  }
@@ -156,57 +157,170 @@ var LiveConf = /*#__PURE__*/function () {
156
157
  return roundedFrameRate * 2;
157
158
  }
158
159
  }
160
+
161
+ /*
162
+ * Calculates mez segment durations based on input stream parameters
163
+ *
164
+ * Live input formats have fixed timebase:
165
+ * - MPEG-TS/SRT input stream timebase is 90000
166
+ * - RTMP input stream timebase is 1000 and gets translated to 16000 if not otherwise specified
167
+ *
168
+ * This causes frame duration irregularities for certain frame rates.
169
+ * For example RTMP 60fps has frames of durations 16 and 17. MPEG-TS 59.94fps has frames of
170
+ * durations 1001 and 1002.
171
+ *
172
+ * Live mez segmentation requires that the segment be cut at the specific number of frames, and when
173
+ * the frame durations are irregular we adjust both the video timebase and the video frame duration
174
+ * to make the math possible. This adjustment is also required for live-to-vod conversion.
175
+ *
176
+ * For example for MPEG-TS 59.94fps, the mez segment timebase needs to be 60000
177
+ * (and resulting frame duration is 1001) and for RTMP 60fps the timebase needs to be 15360 (resulting frame
178
+ * duration is 256).
179
+ *
180
+ * @sourceTimescale - adjusted source video stream timescale (eg. MPEGTS 90000, RTMP 16000 )
181
+ * @sampleRate - audio sample rate (commonly 48000 but can be different)
182
+ * @audioCodec - audio codec as a string (eg. "aac")
183
+ * @return - segment encoding parameters
184
+ */
159
185
  }, {
160
186
  key: "calcSegDuration",
161
187
  value: function calcSegDuration(_ref) {
162
- var sourceTimescale = _ref.sourceTimescale;
188
+ var sourceTimescale = _ref.sourceTimescale,
189
+ sampleRate = _ref.sampleRate,
190
+ audioCodec = _ref.audioCodec;
191
+ var seg = {};
192
+ switch (this.probeKind()) {
193
+ case "rtmp":
194
+ seg = this.calcSegDurationRtmp({
195
+ sourceTimescale: sourceTimescale,
196
+ sampleRate: sampleRate,
197
+ audioCodec: audioCodec
198
+ });
199
+ break;
200
+ case "udp":
201
+ case "srt":
202
+ seg = this.calcSegDurationMpegts({
203
+ sourceTimescale: sourceTimescale,
204
+ sampleRate: sampleRate,
205
+ audioCodec: audioCodec
206
+ });
207
+ break;
208
+ default:
209
+ throw "protocol not supported - " + this.probeKind();
210
+ }
211
+ if (audioCodec == "aac") {
212
+ seg.audio = 29.76 * sampleRate;
213
+ } else {
214
+ seg.audio = 29.76 * 48000; // Other codecs are resampled @48000
215
+ }
216
+
217
+ return seg;
218
+ }
219
+ }, {
220
+ key: "calcSegDurationMpegts",
221
+ value: function calcSegDurationMpegts(_ref2) {
222
+ var sourceTimescale = _ref2.sourceTimescale;
163
223
  var videoStream = this.getStreamDataForCodecType("video");
164
224
  var frameRate = videoStream.frame_rate;
165
225
  var seg = {};
166
- seg.audio = 29.76 * 48000;
167
226
  switch (frameRate) {
168
227
  case "24":
169
- seg.video = 30 * sourceTimescale;
228
+ seg.video = sourceTimescale * 30;
170
229
  seg.keyint = 48;
171
230
  seg.duration = "30";
172
231
  break;
173
232
  case "25":
174
- seg.video = 30 * sourceTimescale;
233
+ seg.video = sourceTimescale * 30;
175
234
  seg.keyint = 50;
176
235
  seg.duration = "30";
177
236
  break;
178
237
  case "30":
179
- seg.video = 30 * sourceTimescale;
238
+ seg.video = sourceTimescale * 30;
180
239
  seg.keyint = 60;
181
240
  seg.duration = "30";
182
241
  break;
183
242
  case "30000/1001":
184
- seg.video = 30.03 * sourceTimescale;
243
+ seg.video = sourceTimescale * 30;
185
244
  seg.keyint = 60;
186
245
  seg.duration = "30.03";
187
246
  break;
188
247
  case "48":
189
- seg.video = 30 * sourceTimescale;
248
+ seg.video = sourceTimescale * 30;
190
249
  seg.keyint = 96;
191
250
  seg.duration = "30";
192
251
  break;
193
252
  case "50":
194
- seg.video = 30 * sourceTimescale;
253
+ seg.video = sourceTimescale * 30;
195
254
  seg.keyint = 100;
196
255
  seg.duration = "30";
197
256
  break;
198
257
  case "60":
199
- seg.video = 30 * sourceTimescale;
258
+ seg.video = sourceTimescale * 30;
200
259
  seg.keyint = 120;
201
260
  seg.duration = "30";
202
261
  break;
203
262
  case "60000/1001":
204
- seg.video = 30.03 * sourceTimescale;
263
+ seg.videoTimeBase = 60000;
264
+ seg.video = seg.videoTimeBase * 30.03;
205
265
  seg.keyint = 120;
206
266
  seg.duration = "30.03";
207
267
  break;
208
268
  default:
209
- console.log("Unsupported frame rate", frameRate);
269
+ throw "unsupported frame rate for MPEGTS - " + frameRate;
270
+ break;
271
+ }
272
+ return seg;
273
+ }
274
+ }, {
275
+ key: "calcSegDurationRtmp",
276
+ value: function calcSegDurationRtmp(_ref3) {
277
+ var sourceTimescale = _ref3.sourceTimescale;
278
+ var videoStream = this.getStreamDataForCodecType("video");
279
+ var frameRate = videoStream.frame_rate;
280
+ var seg = {};
281
+ switch (frameRate) {
282
+ case "24":
283
+ seg.video = sourceTimescale * 30;
284
+ seg.keyint = 48;
285
+ seg.duration = "30";
286
+ break;
287
+ case "25":
288
+ seg.video = sourceTimescale * 30;
289
+ seg.keyint = 50;
290
+ seg.duration = "30";
291
+ break;
292
+ case "30":
293
+ seg.video = sourceTimescale * 30;
294
+ seg.keyint = 60;
295
+ seg.duration = "30";
296
+ break;
297
+ case "30000/1001":
298
+ seg.video = sourceTimescale * 30.03;
299
+ seg.keyint = 60;
300
+ seg.duration = "30.03";
301
+ break;
302
+ case "48":
303
+ seg.video = sourceTimescale * 30;
304
+ seg.keyint = 96;
305
+ seg.duration = "30";
306
+ break;
307
+ case "50":
308
+ seg.video = sourceTimescale * 30;
309
+ seg.keyint = 100;
310
+ seg.duration = "30";
311
+ break;
312
+ case "60":
313
+ seg.video = sourceTimescale * 30;
314
+ seg.keyint = 120;
315
+ seg.duration = "30";
316
+ break;
317
+ case "60000/1001":
318
+ seg.video = sourceTimescale * 30.03;
319
+ seg.keyint = 120;
320
+ seg.duration = "30.03";
321
+ break;
322
+ default:
323
+ throw "unsupported frame rate for RTMP - " + frameRate;
210
324
  break;
211
325
  }
212
326
  return seg;
@@ -218,32 +332,33 @@ var LiveConf = /*#__PURE__*/function () {
218
332
  var videoStream = this.getStreamDataForCodecType("video");
219
333
  switch (this.probeKind()) {
220
334
  case "udp":
335
+ case "srt":
221
336
  sync_id = videoStream.stream_id;
222
337
  break;
223
338
  case "rtmp":
224
- sync_id = -1; // Pending fabric API: videoStream.stream_index
339
+ sync_id = videoStream.stream_index;
225
340
  break;
226
341
  }
227
342
  return sync_id;
228
343
  }
229
344
  }, {
230
345
  key: "generateLiveConf",
231
- value: function generateLiveConf(_ref2) {
232
- var audioBitrate = _ref2.audioBitrate,
233
- audioIndex = _ref2.audioIndex,
234
- partTtl = _ref2.partTtl,
235
- channelLayout = _ref2.channelLayout;
346
+ value: function generateLiveConf(_ref4) {
347
+ var audioBitrate = _ref4.audioBitrate,
348
+ audioIndex = _ref4.audioIndex,
349
+ partTtl = _ref4.partTtl,
350
+ channelLayout = _ref4.channelLayout;
236
351
  // gather required data
237
352
  var conf = JSON.parse(JSON.stringify(LiveconfTemplate));
238
353
  var fileName = this.overwriteOriginUrl || this.probeData.format.filename;
239
354
  var audioStream = this.getStreamDataForCodecType("audio");
240
355
  var sampleRate = parseInt(audioStream.sample_rate);
356
+ var audioCodec = audioStream.codec_name;
241
357
  var videoStream = this.getStreamDataForCodecType("video");
242
358
  var sourceTimescale;
243
- console.log("AUDIO", audioStream);
244
- console.log("VIDEO", videoStream);
245
359
 
246
360
  // Fill in liveconf all formats have in common
361
+ conf.live_recording.probe_info = this.probeData;
247
362
  conf.live_recording.fabric_config.ingress_node_api = this.nodeUrl || null;
248
363
  conf.live_recording.fabric_config.ingress_node_id = this.nodeId || null;
249
364
  conf.live_recording.recording_config.recording_params.description;
@@ -267,6 +382,11 @@ var LiveConf = /*#__PURE__*/function () {
267
382
  sourceTimescale = 90000;
268
383
  conf.live_recording.recording_config.recording_params.source_timescale = sourceTimescale;
269
384
  break;
385
+ case "srt":
386
+ sourceTimescale = 90000;
387
+ conf.live_recording.recording_config.recording_params.source_timescale = sourceTimescale;
388
+ conf.live_recording.recording_config.recording_params.live_delay_nano = 4000000000;
389
+ break;
270
390
  case "rtmp":
271
391
  sourceTimescale = 16000;
272
392
  conf.live_recording.recording_config.recording_params.source_timescale = sourceTimescale;
@@ -279,7 +399,9 @@ var LiveConf = /*#__PURE__*/function () {
279
399
  break;
280
400
  }
281
401
  var segDurations = this.calcSegDuration({
282
- sourceTimescale: sourceTimescale
402
+ sourceTimescale: sourceTimescale,
403
+ sampleRate: sampleRate,
404
+ audioCodec: audioCodec
283
405
  });
284
406
 
285
407
  // Segment conditioning parameters
@@ -287,6 +409,15 @@ var LiveConf = /*#__PURE__*/function () {
287
409
  conf.live_recording.recording_config.recording_params.xc_params.audio_seg_duration_ts = segDurations.audio;
288
410
  conf.live_recording.recording_config.recording_params.xc_params.video_seg_duration_ts = segDurations.video;
289
411
  conf.live_recording.recording_config.recording_params.xc_params.force_keyint = segDurations.keyint;
412
+
413
+ // Optional override output timebase and frame duration (ts)
414
+ if (segDurations.videoTimeBase) {
415
+ conf.live_recording.recording_config.recording_params.xc_params.video_time_base = segDurations.videoTimeBase;
416
+ conf.live_recording.recording_config.recording_params.source_timescale = segDurations.videoTimeBase;
417
+ }
418
+ if (segDurations.videoFrameDurationTs) {
419
+ conf.live_recording.recording_config.recording_params.xc_params.video_frame_duration_ts = segDurations.videoFrameDurationTs;
420
+ }
290
421
  switch (videoStream.height) {
291
422
  case 2160:
292
423
  conf.live_recording.recording_config.recording_params.ladder_specs.unshift(LadderTemplate[2160], LadderTemplate[1080], LadderTemplate[720], LadderTemplate[540], LadderTemplate["540_low"]);