@eluvio/elv-client-js 4.2.23 → 4.2.25
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 +7 -12
- package/dist/src/ContentObjectAudit.js +2 -1
- package/dist/src/ContentObjectVerification.js +281 -0
- package/dist/src/Crypto.js +33 -5
- package/dist/src/ElvClient.js +9 -10
- package/dist/src/FrameClient.js +1 -1
- package/dist/src/HttpClient.js +90 -47
- package/dist/src/NetworkUrls.js +8 -0
- package/dist/src/RemoteSigner.js +170 -70
- package/dist/src/abr_profiles/abr_profile_live_drm.js +0 -10
- package/dist/src/client/ContentAccess.js +1165 -1149
- package/dist/src/client/ContentManagement.js +2 -2
- package/dist/src/client/Contracts.js +2 -2
- package/dist/src/client/LiveConf.js +171 -84
- package/dist/src/client/LiveStream.js +5649 -2155
- package/dist/src/client/NTP.js +172 -77
- package/dist/src/live_recording_config_profiles/live_recording_config_default.js +45 -0
- package/package.json +1 -1
- package/src/FrameClient.js +2 -0
- package/src/client/Contracts.js +1 -1
- package/src/client/LiveConf.js +46 -27
- package/src/client/LiveStream.js +337 -92
- package/utilities/LiveOutputs.js +9 -4
package/src/client/LiveConf.js
CHANGED
|
@@ -218,7 +218,8 @@ class LiveConf {
|
|
|
218
218
|
*
|
|
219
219
|
* Live input formats have fixed timebase:
|
|
220
220
|
* - MPEG-TS/SRT input stream timebase is 90000
|
|
221
|
-
* - RTMP input stream timebase is 1000 and gets translated to
|
|
221
|
+
* - RTMP input stream timebase is 1000 and gets translated to match the frame rate
|
|
222
|
+
* (eg. 24000 @24fps, 30000 @30fps/29.97fps, 60000 @60fps/59.94fps)
|
|
222
223
|
*
|
|
223
224
|
* This causes frame duration irregularities for certain frame rates.
|
|
224
225
|
* For example RTMP 60fps has frames of durations 16 and 17. MPEG-TS 59.94fps has frames of
|
|
@@ -229,10 +230,13 @@ class LiveConf {
|
|
|
229
230
|
* to make the math possible. This adjustment is also required for live-to-vod conversion.
|
|
230
231
|
*
|
|
231
232
|
* For example for MPEG-TS 59.94fps, the mez segment timebase needs to be 60000
|
|
232
|
-
* (and resulting frame duration is 1001) and for RTMP 60fps the timebase
|
|
233
|
-
* duration is
|
|
233
|
+
* (and resulting frame duration is 1001) and for RTMP 60fps the timebase is set to 60000
|
|
234
|
+
* (resulting frame duration is 1000). For every supported RTMP frame rate, the video timebase is
|
|
235
|
+
* set equal to the source timescale, with a frame duration of 1000 (1001 for the *000/1001
|
|
236
|
+
* fractional rates).
|
|
234
237
|
*
|
|
235
|
-
* @sourceTimescale - adjusted source video stream timescale (eg. MPEGTS 90000
|
|
238
|
+
* @sourceTimescale - adjusted source video stream timescale (eg. MPEGTS 90000; ignored for RTMP,
|
|
239
|
+
* which derives its own timebase per frame rate in calcSegDurationRtmp)
|
|
236
240
|
* @sampleRate - audio sample rate (commonly 48000 but can be different)
|
|
237
241
|
* @audioCodec - audio codec as a string (eg. "aac")
|
|
238
242
|
* @return - segment encoding parameters
|
|
@@ -333,57 +337,65 @@ class LiveConf {
|
|
|
333
337
|
return seg;
|
|
334
338
|
}
|
|
335
339
|
|
|
336
|
-
calcSegDurationRtmp(
|
|
340
|
+
calcSegDurationRtmp() {
|
|
337
341
|
let videoStream = this.getStreamDataForCodecType("video");
|
|
338
342
|
let frameRate = videoStream.frame_rate;
|
|
339
343
|
let seg = {};
|
|
340
344
|
|
|
341
345
|
switch(frameRate) {
|
|
342
346
|
case "24":
|
|
343
|
-
seg.videoTimeBase =
|
|
344
|
-
seg.videoFrameDurationTs =
|
|
345
|
-
seg.video =
|
|
347
|
+
seg.videoTimeBase = 24000;
|
|
348
|
+
seg.videoFrameDurationTs = 1000;
|
|
349
|
+
seg.video = seg.videoTimeBase * 30;
|
|
346
350
|
seg.keyint = 48;
|
|
347
351
|
seg.duration = "30";
|
|
348
352
|
break;
|
|
349
353
|
case "25":
|
|
350
|
-
seg.
|
|
354
|
+
seg.videoTimeBase = 25000;
|
|
355
|
+
seg.videoFrameDurationTs = 1000;
|
|
356
|
+
seg.video = seg.videoTimeBase * 30;
|
|
351
357
|
seg.keyint = 50;
|
|
352
358
|
seg.duration = "30";
|
|
353
359
|
break;
|
|
354
360
|
case "30":
|
|
355
|
-
seg.videoTimeBase =
|
|
356
|
-
seg.videoFrameDurationTs =
|
|
357
|
-
seg.video =
|
|
361
|
+
seg.videoTimeBase = 30000;
|
|
362
|
+
seg.videoFrameDurationTs = 1000;
|
|
363
|
+
seg.video = seg.videoTimeBase * 30;
|
|
358
364
|
seg.keyint = 60;
|
|
359
365
|
seg.duration = "30";
|
|
360
366
|
break;
|
|
361
367
|
case "30000/1001":
|
|
362
|
-
seg.
|
|
368
|
+
seg.videoTimeBase = 30000;
|
|
369
|
+
seg.videoFrameDurationTs = 1001;
|
|
370
|
+
seg.video = seg.videoTimeBase * 30.03;
|
|
363
371
|
seg.keyint = 60;
|
|
364
372
|
seg.duration = "30.03";
|
|
365
373
|
break;
|
|
366
374
|
case "48":
|
|
367
|
-
seg.videoTimeBase =
|
|
368
|
-
seg.videoFrameDurationTs =
|
|
369
|
-
seg.video =
|
|
375
|
+
seg.videoTimeBase = 48000;
|
|
376
|
+
seg.videoFrameDurationTs = 1000;
|
|
377
|
+
seg.video = seg.videoTimeBase * 30;
|
|
370
378
|
seg.keyint = 96;
|
|
371
379
|
seg.duration = "30";
|
|
372
380
|
break;
|
|
373
381
|
case "50":
|
|
374
|
-
seg.
|
|
382
|
+
seg.videoTimeBase = 50000;
|
|
383
|
+
seg.videoFrameDurationTs = 1000;
|
|
384
|
+
seg.video = seg.videoTimeBase * 30;
|
|
375
385
|
seg.keyint = 100;
|
|
376
386
|
seg.duration = "30";
|
|
377
387
|
break;
|
|
378
388
|
case "60":
|
|
379
|
-
seg.videoTimeBase =
|
|
380
|
-
seg.videoFrameDurationTs =
|
|
381
|
-
seg.video =
|
|
389
|
+
seg.videoTimeBase = 60000;
|
|
390
|
+
seg.videoFrameDurationTs = 1000;
|
|
391
|
+
seg.video = seg.videoTimeBase * 30;
|
|
382
392
|
seg.keyint = 120;
|
|
383
393
|
seg.duration = "30";
|
|
384
394
|
break;
|
|
385
395
|
case "60000/1001":
|
|
386
|
-
seg.
|
|
396
|
+
seg.videoTimeBase = 60000;
|
|
397
|
+
seg.videoFrameDurationTs = 1001;
|
|
398
|
+
seg.video = seg.videoTimeBase * 30.03;
|
|
387
399
|
seg.keyint = 120;
|
|
388
400
|
seg.duration = "30.03";
|
|
389
401
|
break;
|
|
@@ -514,6 +526,10 @@ class LiveConf {
|
|
|
514
526
|
const videoStream = this.getStreamDataForCodecType("video");
|
|
515
527
|
let sourceTimescale;
|
|
516
528
|
|
|
529
|
+
// Custom profile values take precedence over computed defaults
|
|
530
|
+
const customRecordingParams = customSettings.liveRecordingConfigProfile?.recording_params;
|
|
531
|
+
const customXcParams = customRecordingParams?.xc_params;
|
|
532
|
+
|
|
517
533
|
// Fill in liveconf all formats have in common
|
|
518
534
|
conf.live_recording.fabric_config.ingress_node_api = this.nodeUrl || null;
|
|
519
535
|
conf.live_recording.fabric_config.ingress_node_id = this.nodeId || null;
|
|
@@ -536,12 +552,12 @@ class LiveConf {
|
|
|
536
552
|
// Fill in specifics for protocol
|
|
537
553
|
switch(this.getFormat()) {
|
|
538
554
|
case "mpegts":
|
|
539
|
-
sourceTimescale = 90000;
|
|
555
|
+
sourceTimescale = customRecordingParams?.source_timescale ?? 90000;
|
|
540
556
|
conf.live_recording.recording_config.recording_params.source_timescale = sourceTimescale;
|
|
541
557
|
break;
|
|
542
558
|
case "rtmp":
|
|
543
559
|
case "flv":
|
|
544
|
-
sourceTimescale = 16000;
|
|
560
|
+
sourceTimescale = customRecordingParams?.source_timescale ?? 16000;
|
|
545
561
|
conf.live_recording.recording_config.recording_params.source_timescale = sourceTimescale;
|
|
546
562
|
break;
|
|
547
563
|
case "hls":
|
|
@@ -565,17 +581,20 @@ class LiveConf {
|
|
|
565
581
|
// Segment conditioning parameters
|
|
566
582
|
conf.live_recording.recording_config.recording_params.xc_params.seg_duration = segDurations.duration;
|
|
567
583
|
conf.live_recording.recording_config.recording_params.xc_params.audio_seg_duration_ts = segDurations.audio;
|
|
568
|
-
conf.live_recording.recording_config.recording_params.xc_params.video_seg_duration_ts =
|
|
584
|
+
conf.live_recording.recording_config.recording_params.xc_params.video_seg_duration_ts =
|
|
585
|
+
customXcParams?.video_seg_duration_ts ?? segDurations.video;
|
|
569
586
|
conf.live_recording.recording_config.recording_params.xc_params.force_keyint = segDurations.keyint;
|
|
570
587
|
|
|
571
588
|
// Optional override output timebase and frame duration (ts)
|
|
572
|
-
if(segDurations.videoTimeBase) {
|
|
589
|
+
if(segDurations.videoTimeBase && R.isNil(customXcParams?.video_time_base)) {
|
|
573
590
|
conf.live_recording.recording_config.recording_params.xc_params.video_time_base = segDurations.videoTimeBase;
|
|
574
591
|
|
|
575
592
|
// Note 'source_timescale' needs to be set to the output timebase and is used by playout
|
|
576
|
-
|
|
593
|
+
if(R.isNil(customRecordingParams?.source_timescale)) {
|
|
594
|
+
conf.live_recording.recording_config.recording_params.source_timescale = this.calcOutputTimebase(segDurations.videoTimeBase);
|
|
595
|
+
}
|
|
577
596
|
}
|
|
578
|
-
if(segDurations.videoFrameDurationTs) {
|
|
597
|
+
if(segDurations.videoFrameDurationTs && R.isNil(customXcParams?.video_frame_duration_ts)) {
|
|
579
598
|
conf.live_recording.recording_config.recording_params.xc_params.video_frame_duration_ts = segDurations.videoFrameDurationTs;
|
|
580
599
|
}
|
|
581
600
|
|