@gcorevideo/player 2.22.17 → 2.22.20

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.
Files changed (120) hide show
  1. package/assets/audio-selector/track-selector.ejs +3 -3
  2. package/assets/bottom-gear/bottomgear.ejs +3 -3
  3. package/assets/clappr-nerd-stats/clappr-nerd-stats.ejs +76 -78
  4. package/assets/clappr-nerd-stats/clappr-nerd-stats.scss +10 -7
  5. package/assets/dvr-controls/dvr_controls.scss +0 -12
  6. package/dist/core.js +5 -7
  7. package/dist/index.css +1245 -1251
  8. package/dist/index.js +425 -261
  9. package/dist/player.d.ts +121 -108
  10. package/dist/plugins/index.css +577 -583
  11. package/dist/plugins/index.js +355 -187
  12. package/docs/api/player.bitratetrackrecord.md +20 -0
  13. package/docs/api/player.clapprstats.exportmetrics.md +2 -2
  14. package/docs/api/player.clapprstats.md +0 -4
  15. package/docs/api/player.clapprstatschronograph.md +115 -0
  16. package/docs/api/player.clapprstatscounter.md +211 -0
  17. package/docs/api/player.clapprstatsevents.md +51 -0
  18. package/docs/api/player.clapprstatsmetrics.md +52 -0
  19. package/docs/api/player.clipspluginsettings.md +1 -1
  20. package/docs/api/player.md +57 -2
  21. package/docs/api/player.nerdstats.md +3 -3
  22. package/docs/api/player.playerconfig.md +1 -1
  23. package/docs/api/player.playerconfig.playbacktype.md +6 -1
  24. package/docs/api/player.timeupdate.md +6 -3
  25. package/lib/playback/dash-playback/DashPlayback.d.ts +0 -1
  26. package/lib/playback/dash-playback/DashPlayback.d.ts.map +1 -1
  27. package/lib/playback/dash-playback/DashPlayback.js +4 -5
  28. package/lib/playback/hls-playback/HlsPlayback.d.ts +1 -1
  29. package/lib/playback/hls-playback/HlsPlayback.d.ts.map +1 -1
  30. package/lib/playback/hls-playback/HlsPlayback.js +0 -1
  31. package/lib/playback.types.d.ts +2 -3
  32. package/lib/playback.types.d.ts.map +1 -1
  33. package/lib/plugins/audio-selector/AudioSelector.d.ts +1 -1
  34. package/lib/plugins/audio-selector/AudioSelector.d.ts.map +1 -1
  35. package/lib/plugins/audio-selector/AudioSelector.js +15 -8
  36. package/lib/plugins/bottom-gear/BottomGear.d.ts +1 -1
  37. package/lib/plugins/bottom-gear/BottomGear.js +2 -2
  38. package/lib/plugins/clappr-nerd-stats/NerdStats.d.ts +17 -14
  39. package/lib/plugins/clappr-nerd-stats/NerdStats.d.ts.map +1 -1
  40. package/lib/plugins/clappr-nerd-stats/NerdStats.js +175 -124
  41. package/lib/plugins/clappr-nerd-stats/formatter.d.ts +5 -0
  42. package/lib/plugins/clappr-nerd-stats/formatter.d.ts.map +1 -1
  43. package/lib/plugins/clappr-nerd-stats/formatter.js +56 -24
  44. package/lib/plugins/clappr-nerd-stats/speedtest/index.d.ts +2 -2
  45. package/lib/plugins/clappr-nerd-stats/speedtest/index.d.ts.map +1 -1
  46. package/lib/plugins/clappr-nerd-stats/speedtest/types.d.ts +1 -1
  47. package/lib/plugins/clappr-nerd-stats/speedtest/types.d.ts.map +1 -1
  48. package/lib/plugins/clappr-nerd-stats/types.d.ts +3 -0
  49. package/lib/plugins/clappr-nerd-stats/types.d.ts.map +1 -1
  50. package/lib/plugins/clappr-nerd-stats/utils.d.ts +7 -0
  51. package/lib/plugins/clappr-nerd-stats/utils.d.ts.map +1 -0
  52. package/lib/plugins/clappr-nerd-stats/utils.js +67 -0
  53. package/lib/plugins/clappr-stats/ClapprStats.d.ts +5 -2
  54. package/lib/plugins/clappr-stats/ClapprStats.d.ts.map +1 -1
  55. package/lib/plugins/clappr-stats/ClapprStats.js +31 -33
  56. package/lib/plugins/clappr-stats/types.d.ts +21 -22
  57. package/lib/plugins/clappr-stats/types.d.ts.map +1 -1
  58. package/lib/plugins/clappr-stats/types.js +22 -22
  59. package/lib/plugins/clappr-stats/utils.d.ts +2 -2
  60. package/lib/plugins/clappr-stats/utils.d.ts.map +1 -1
  61. package/lib/plugins/clappr-stats/utils.js +0 -1
  62. package/lib/plugins/click-to-pause/ClickToPause.js +1 -1
  63. package/lib/plugins/clips/Clips.d.ts +1 -1
  64. package/lib/plugins/dvr-controls/DvrControls.d.ts +6 -2
  65. package/lib/plugins/dvr-controls/DvrControls.d.ts.map +1 -1
  66. package/lib/plugins/dvr-controls/DvrControls.js +39 -27
  67. package/lib/plugins/media-control/MediaControl.d.ts +6 -2
  68. package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
  69. package/lib/plugins/media-control/MediaControl.js +20 -9
  70. package/lib/plugins/picture-in-picture/PictureInPicture.js +1 -1
  71. package/lib/plugins/seek-time/SeekTime.d.ts +1 -1
  72. package/lib/plugins/seek-time/SeekTime.d.ts.map +1 -1
  73. package/lib/plugins/seek-time/SeekTime.js +3 -4
  74. package/lib/plugins/subtitles/ClosedCaptions.js +1 -1
  75. package/lib/plugins/vast-ads/VastAds.js +1 -1
  76. package/lib/plugins/vast-ads/rollmanager.js +1 -1
  77. package/lib/testUtils.d.ts.map +1 -1
  78. package/lib/testUtils.js +7 -4
  79. package/lib/types.d.ts +1 -1
  80. package/package.json +3 -3
  81. package/src/playback/__tests__/HTML5Video.test.ts +2 -2
  82. package/src/playback/dash-playback/DashPlayback.ts +5 -7
  83. package/src/playback/hls-playback/HlsPlayback.ts +2 -4
  84. package/src/playback.types.ts +2 -3
  85. package/src/plugins/audio-selector/AudioSelector.ts +14 -7
  86. package/src/plugins/audio-selector/__tests__/AudioSelector.test.ts +8 -8
  87. package/src/plugins/audio-selector/__tests__/__snapshots__/AudioSelector.test.ts.snap +15 -15
  88. package/src/plugins/bottom-gear/BottomGear.ts +2 -2
  89. package/src/plugins/bottom-gear/__tests__/BottomGear.test.ts +8 -5
  90. package/src/plugins/bottom-gear/__tests__/__snapshots__/BottomGear.test.ts.snap +3 -3
  91. package/src/plugins/clappr-nerd-stats/NerdStats.ts +216 -143
  92. package/src/plugins/clappr-nerd-stats/formatter.ts +91 -47
  93. package/src/plugins/clappr-nerd-stats/speedtest/index.ts +2 -2
  94. package/src/plugins/clappr-nerd-stats/speedtest/types.ts +1 -1
  95. package/src/plugins/clappr-nerd-stats/types.ts +43 -3
  96. package/src/plugins/clappr-nerd-stats/utils.ts +75 -0
  97. package/src/plugins/clappr-stats/ClapprStats.ts +41 -40
  98. package/src/plugins/clappr-stats/__tests__/ClapprStats.test.ts +12 -12
  99. package/src/plugins/clappr-stats/types.ts +43 -44
  100. package/src/plugins/clappr-stats/utils.ts +4 -5
  101. package/src/plugins/click-to-pause/ClickToPause.ts +1 -1
  102. package/src/plugins/clips/Clips.ts +1 -1
  103. package/src/plugins/clips/__tests__/Clips.test.ts +1 -1
  104. package/src/plugins/clips/__tests__/__snapshots__/Clips.test.ts.snap +1 -1
  105. package/src/plugins/dvr-controls/DvrControls.ts +51 -37
  106. package/src/plugins/dvr-controls/__tests__/DvrControls.test.ts +84 -26
  107. package/src/plugins/dvr-controls/__tests__/__snapshots__/DvrControls.test.ts.snap +0 -12
  108. package/src/plugins/media-control/MediaControl.ts +21 -9
  109. package/src/plugins/media-control/__tests__/MediaControl.test.ts +8 -5
  110. package/src/plugins/media-control/__tests__/__snapshots__/MediaControl.test.ts.snap +20 -20
  111. package/src/plugins/picture-in-picture/PictureInPicture.ts +1 -1
  112. package/src/plugins/seek-time/SeekTime.ts +4 -5
  113. package/src/plugins/subtitles/ClosedCaptions.ts +1 -1
  114. package/src/plugins/subtitles/__tests__/ClosedCaptions.test.ts +1 -1
  115. package/src/plugins/vast-ads/VastAds.ts +1 -1
  116. package/src/plugins/vast-ads/rollmanager.ts +1 -1
  117. package/src/testUtils.ts +11 -5
  118. package/src/types.ts +1 -1
  119. package/temp/player.api.json +630 -12
  120. package/tsconfig.tsbuildinfo +1 -1
package/dist/player.d.ts CHANGED
@@ -161,7 +161,7 @@ export declare class BigMuteButton extends UICorePlugin {
161
161
  /**
162
162
  * @beta
163
163
  */
164
- declare type BitrateTrackRecord = {
164
+ export declare type BitrateTrackRecord = {
165
165
  start: number;
166
166
  end?: number;
167
167
  time?: number;
@@ -311,23 +311,14 @@ export declare class BottomGear extends UICorePlugin {
311
311
  private onMediaControlRendered;
312
312
  }
313
313
 
314
- /**
315
- * @beta
316
- */
317
- declare enum Chronograph {
318
- Startup = "startup",
319
- Watch = "watch",
320
- Pause = "pause",
321
- Buffering = "buffering",
322
- Session = "session"
323
- }
324
-
325
314
  /**
326
315
  * `PLUGIN` that measures data about playback, which can be useful for analyzing performance and UX.
327
316
  * @beta
328
317
  * @remarks
329
318
  * This plugin does not render anything and is supposed to be extended or used together with other plugins that actually render something.
330
319
  *
320
+ * @see {@link NerdStats} - a plugin that visualises the playback metrics
321
+ *
331
322
  * Configuration options - {@link ClapprStatsSettings}
332
323
  *
333
324
  * Events - {@link ClapprStatsEvents}
@@ -367,7 +358,7 @@ export declare class ClapprStats extends ContainerPlugin {
367
358
  * Returns the collected metrics.
368
359
  * @returns Measurements collected so far
369
360
  */
370
- exportMetrics(): Metrics;
361
+ exportMetrics(): ClapprStatsMetrics;
371
362
  private onBitrate;
372
363
  private stopReporting;
373
364
  private startTimers;
@@ -389,6 +380,102 @@ export declare class ClapprStats extends ContainerPlugin {
389
380
  private html5FetchFPS;
390
381
  }
391
382
 
383
+ /**
384
+ * @beta
385
+ */
386
+ export declare enum ClapprStatsChronograph {
387
+ Startup = "startup",
388
+ Watch = "watch",
389
+ Pause = "pause",
390
+ Buffering = "buffering",
391
+ Session = "session"
392
+ }
393
+
394
+ /**
395
+ * @beta
396
+ */
397
+ export declare enum ClapprStatsCounter {
398
+ Play = "play",
399
+ Pause = "pause",
400
+ Error = "error",
401
+ Buffering = "buffering",
402
+ DecodedFrames = "decodedFrames",
403
+ DroppedFrames = "droppedFrames",
404
+ Fps = "fps",
405
+ ChangeLevel = "changeLevel",
406
+ Seek = "seek",
407
+ Fullscreen = "fullscreen",
408
+ DvrUsage = "dvrUsage"
409
+ }
410
+
411
+ /**
412
+ * @beta
413
+ */
414
+ export declare enum ClapprStatsEvents {
415
+ /**
416
+ * Emitted periodically with current measurements.
417
+ */
418
+ REPORT = "clappr:stats:report"
419
+ }
420
+
421
+ /**
422
+ * @beta
423
+ */
424
+ export declare type ClapprStatsMetrics = {
425
+ /**
426
+ * Events count counters
427
+ */
428
+ counters: {
429
+ /**
430
+ *
431
+ */
432
+ [ClapprStatsCounter.Play]: number;
433
+ [ClapprStatsCounter.Pause]: number;
434
+ [ClapprStatsCounter.Error]: number;
435
+ [ClapprStatsCounter.Buffering]: number;
436
+ [ClapprStatsCounter.DecodedFrames]: number;
437
+ [ClapprStatsCounter.DroppedFrames]: number;
438
+ [ClapprStatsCounter.Fps]: number;
439
+ [ClapprStatsCounter.ChangeLevel]: number;
440
+ [ClapprStatsCounter.Seek]: number;
441
+ [ClapprStatsCounter.Fullscreen]: number;
442
+ [ClapprStatsCounter.DvrUsage]: number;
443
+ };
444
+ /**
445
+ * Time measurements - accumulated duration of time-based activities
446
+ */
447
+ chrono: {
448
+ /**
449
+ * Time spent in the startup phase
450
+ */
451
+ [ClapprStatsChronograph.Startup]: number;
452
+ /**
453
+ * Total time spent in the watch phase
454
+ */
455
+ [ClapprStatsChronograph.Watch]: number;
456
+ /**
457
+ *
458
+ */
459
+ [ClapprStatsChronograph.Pause]: number;
460
+ [ClapprStatsChronograph.Buffering]: number;
461
+ [ClapprStatsChronograph.Session]: number;
462
+ };
463
+ extra: {
464
+ playbackName: string;
465
+ playbackType: string;
466
+ bitratesHistory: BitrateTrackRecord[];
467
+ bitrateWeightedMean: number;
468
+ bitrateMostUsed: number;
469
+ buffersize: number;
470
+ watchHistory: Array<[number, number]>;
471
+ watchedPercentage: number;
472
+ bufferingPercentage: number;
473
+ bandwidth: number;
474
+ duration: number;
475
+ currentTime: number;
476
+ };
477
+ };
478
+
392
479
  export declare type ClapprStatsSettings = {
393
480
  /**
394
481
  * The interval in milliseconds of periodic measurements.
@@ -476,7 +563,7 @@ export declare class Clips extends UICorePlugin {
476
563
  }
477
564
 
478
565
  /**
479
- * Configuration options for the {@link ClipsPlugin} plugin.
566
+ * Configuration options for the {@link Clips} plugin.
480
567
  * @beta
481
568
  */
482
569
  export declare interface ClipsPluginSettings {
@@ -693,23 +780,6 @@ export declare type CorePluginConstructor = {
693
780
  type: string;
694
781
  };
695
782
 
696
- /**
697
- * @beta
698
- */
699
- declare enum Counter {
700
- Play = "play",
701
- Pause = "pause",
702
- Error = "error",
703
- Buffering = "buffering",
704
- DecodedFrames = "decodedFrames",
705
- DroppedFrames = "droppedFrames",
706
- Fps = "fps",
707
- ChangeLevel = "changeLevel",
708
- Seek = "seek",
709
- Fullscreen = "fullscreen",
710
- DvrUsage = "dvrUsage"
711
- }
712
-
713
783
  /**
714
784
  * A plain JS object that must conform to the DASH.js settings schema.
715
785
  * @public
@@ -1331,65 +1401,6 @@ export declare type MenuOption = {
1331
1401
  icon?: string;
1332
1402
  };
1333
1403
 
1334
- /**
1335
- * @beta
1336
- */
1337
- declare type Metrics = {
1338
- /**
1339
- * Events count counters
1340
- */
1341
- counters: {
1342
- /**
1343
- *
1344
- */
1345
- [Counter.Play]: number;
1346
- [Counter.Pause]: number;
1347
- [Counter.Error]: number;
1348
- [Counter.Buffering]: number;
1349
- [Counter.DecodedFrames]: number;
1350
- [Counter.DroppedFrames]: number;
1351
- [Counter.Fps]: number;
1352
- [Counter.ChangeLevel]: number;
1353
- [Counter.Seek]: number;
1354
- [Counter.Fullscreen]: number;
1355
- [Counter.DvrUsage]: number;
1356
- };
1357
- /**
1358
- * Time measurements - accumulated duration of time-based activities
1359
- */
1360
- chrono: {
1361
- /**
1362
- * Time spent in the startup phase
1363
- */
1364
- [Chronograph.Startup]: number;
1365
- /**
1366
- * Total time spent in the watch phase
1367
- */
1368
- [Chronograph.Watch]: number;
1369
- /**
1370
- *
1371
- */
1372
- [Chronograph.Pause]: number;
1373
- [Chronograph.Buffering]: number;
1374
- [Chronograph.Session]: number;
1375
- };
1376
- extra: {
1377
- playbackName: string;
1378
- playbackType: string;
1379
- bitratesHistory: BitrateTrackRecord[];
1380
- bitrateWeightedMean: number;
1381
- bitrateMostUsed: number;
1382
- buffersize: number;
1383
- watchHistory: Array<[number, number]>;
1384
- watchedPercentage: number;
1385
- bufferingPercentage: number;
1386
- bandwidth: number;
1387
- duration: number;
1388
- currentTime: number;
1389
- };
1390
- custom: Record<string, unknown>;
1391
- };
1392
-
1393
1404
  /**
1394
1405
  * `PLUGIN` that adds support for loading multiple streams and switching between them using the media control UI.
1395
1406
  * @beta
@@ -1444,15 +1455,15 @@ export declare class MultiCamera extends UICorePlugin {
1444
1455
  }
1445
1456
 
1446
1457
  /**
1447
- * `PLUGIN` that displays useful network-related statistics.
1458
+ * `PLUGIN` that displays useful statistics regarding the playback as well as the network quality estimation.
1448
1459
  * @beta
1449
1460
  *
1450
1461
  * @remarks
1451
1462
  * Depends on:
1452
1463
  *
1453
- * - {@link BottomGear}
1464
+ * - {@link BottomGear} - where the button is attached
1454
1465
  *
1455
- * - {@link ClapprStats}
1466
+ * - {@link ClapprStats} - to get the metrics from
1456
1467
  *
1457
1468
  * The plugin is rendered as an item in the gear menu.
1458
1469
  *
@@ -1461,9 +1472,9 @@ export declare class MultiCamera extends UICorePlugin {
1461
1472
  */
1462
1473
  declare class NerdStats extends UICorePlugin {
1463
1474
  private container;
1464
- private customMetrics;
1475
+ private speedtestMetrics;
1465
1476
  private metrics;
1466
- private showing;
1477
+ private open;
1467
1478
  private shortcut;
1468
1479
  private iconPosition;
1469
1480
  private static readonly buttonTemplate;
@@ -1482,17 +1493,17 @@ declare class NerdStats extends UICorePlugin {
1482
1493
  * @internal
1483
1494
  */
1484
1495
  get attributes(): {
1485
- 'data-clappr-nerd-stats': string;
1486
1496
  class: string;
1487
1497
  };
1488
1498
  /**
1489
1499
  * @internal
1490
1500
  */
1491
1501
  get events(): {
1492
- 'click [data-show-stats-button]': string;
1493
- 'click [data-close-button]': string;
1494
- 'click [data-refresh-button]': string;
1502
+ click: string;
1503
+ 'click #nerd-stats-close': string;
1504
+ 'click #nerd-stats-refresh': string;
1495
1505
  };
1506
+ private clicked;
1496
1507
  private get statsBoxElem();
1497
1508
  private get statsBoxWidthThreshold();
1498
1509
  private get playerWidth();
@@ -1503,6 +1514,7 @@ declare class NerdStats extends UICorePlugin {
1503
1514
  */
1504
1515
  bindEvents(): void;
1505
1516
  private onCoreReady;
1517
+ private onActiveContainerChanged;
1506
1518
  /**
1507
1519
  * @internal
1508
1520
  */
@@ -1511,17 +1523,19 @@ declare class NerdStats extends UICorePlugin {
1511
1523
  private show;
1512
1524
  private hide;
1513
1525
  private onPlayerResize;
1514
- private addGeneralMetrics;
1515
- private addCustomMetrics;
1526
+ private updateResolution;
1527
+ private estimateQuality;
1516
1528
  private updateMetrics;
1529
+ private updateEstimatedQuality;
1517
1530
  private setStatsBoxSize;
1518
1531
  /**
1519
1532
  * @internal
1520
1533
  */
1521
1534
  render(): this;
1522
- private addToBottomGear;
1523
- private clearCustomMetrics;
1535
+ private attach;
1536
+ private clearSpeedtestMetrics;
1524
1537
  private refreshSpeedTest;
1538
+ private formatPlaybackName;
1525
1539
  }
1526
1540
  export { NerdStats as ClapprNerdStats }
1527
1541
  export { NerdStats }
@@ -2041,7 +2055,7 @@ export declare interface PlayerConfig extends Record<string, unknown> {
2041
2055
  mute?: boolean;
2042
2056
  /**
2043
2057
  * Stream type.
2044
- * @remark
2058
+ * @remarks
2045
2059
  * Should only be set if known in advance, as it should not change once determined.
2046
2060
  * Otherwise it might cause inconsistencies in the UI plugins behavior, for instance, glitches with rendering of the DVR controls or seek bar.
2047
2061
  */
@@ -2447,7 +2461,7 @@ export declare class SeekTime extends UICorePlugin {
2447
2461
  private $seekTimeEl;
2448
2462
  bindEvents(): void;
2449
2463
  private onContainerChanged;
2450
- private updateDuration;
2464
+ private onTimeUpdate;
2451
2465
  private showTime;
2452
2466
  private hideTime;
2453
2467
  private calculateHoverPosition;
@@ -2966,10 +2980,9 @@ export declare type TimeProgress = {
2966
2980
  /**
2967
2981
  * For the plugin development
2968
2982
  * @beta
2983
+ * @deprecated Use TimePosition instead
2969
2984
  */
2970
- export declare type TimeUpdate = TimePosition & {
2971
- firstFragDateTime: number;
2972
- };
2985
+ export declare type TimeUpdate = TimePosition;
2973
2986
 
2974
2987
  /**
2975
2988
  * Playback time position in seconds since the beginning of the stream.