@gcorevideo/player 2.22.15 → 2.22.17

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 (124) hide show
  1. package/assets/clips/clips.ejs +1 -0
  2. package/assets/clips/clips.scss +23 -3
  3. package/assets/level-selector/list.ejs +9 -3
  4. package/assets/media-control/media-control.ejs +1 -9
  5. package/assets/media-control/media-control.scss +0 -25
  6. package/assets/media-control/width370.scss +4 -4
  7. package/dist/core.js +6 -8
  8. package/dist/index.css +855 -855
  9. package/dist/index.js +609 -664
  10. package/dist/player.d.ts +426 -302
  11. package/dist/plugins/index.css +551 -551
  12. package/dist/plugins/index.js +648 -703
  13. package/docs/api/{player.audioselector.md → player.audiotracks.md} +3 -3
  14. package/docs/api/player.clapprstats.exportmetrics.md +1 -1
  15. package/docs/api/player.clapprstats.md +5 -15
  16. package/docs/api/player.clapprstatssettings.md +13 -0
  17. package/docs/api/{player.contextmenupluginsettings.preventshowcontextmenu.md → player.clips.destroy.md} +7 -3
  18. package/docs/api/{player.contextmenupluginsettings.label.md → player.clips.disable.md} +7 -3
  19. package/docs/api/player.clips.enable.md +18 -0
  20. package/docs/api/player.clips.md +170 -0
  21. package/docs/api/player.clips.render.md +18 -0
  22. package/docs/api/player.clips.supportedversion.md +16 -0
  23. package/docs/api/player.clips.version.md +14 -0
  24. package/docs/api/player.clipspluginsettings.md +2 -2
  25. package/docs/api/player.clipspluginsettings.text.md +1 -1
  26. package/docs/api/player.contextmenu.md +2 -0
  27. package/docs/api/player.contextmenupluginsettings.md +2 -40
  28. package/docs/api/{player.contextmenupluginsettings.url.md → player.contextmenupluginsettings.options.md} +3 -3
  29. package/docs/api/player.md +101 -37
  30. package/docs/api/player.mediacontrol.md +9 -15
  31. package/docs/api/{player.mediacontrol.getelement.md → player.mediacontrol.mount.md} +20 -7
  32. package/docs/api/player.mediacontrolelement.md +4 -2
  33. package/docs/api/player.mediacontrollayerelement.md +16 -0
  34. package/docs/api/player.mediacontrolleftelement.md +16 -0
  35. package/docs/api/player.mediacontrolrightelement.md +16 -0
  36. package/docs/api/player.mediacontrolsettings.md +23 -0
  37. package/docs/api/player.menuoption.md +21 -0
  38. package/docs/api/{player.clapprnerdstats._constructor_.md → player.nerdstats._constructor_.md} +3 -3
  39. package/docs/api/{player.clapprnerdstats.md → player.nerdstats.md} +5 -5
  40. package/docs/api/player.playbackrate.md +1 -1
  41. package/docs/api/player.playerconfig.md +1 -1
  42. package/docs/api/player.playerconfig.playbacktype.md +1 -1
  43. package/docs/api/player.qualitylevel.height.md +1 -1
  44. package/docs/api/player.qualitylevel.level.md +1 -1
  45. package/docs/api/player.qualitylevel.md +4 -4
  46. package/docs/api/player.qualitylevel.width.md +1 -1
  47. package/docs/api/{player.levelselector.events.md → player.qualitylevels.events.md} +2 -2
  48. package/docs/api/{player.levelselector.md → player.qualitylevels.md} +6 -6
  49. package/docs/api/{player.levelselectorpluginsettings.labels.md → player.qualitylevelspluginsettings.labels.md} +2 -2
  50. package/docs/api/{player.levelselectorpluginsettings.md → player.qualitylevelspluginsettings.md} +6 -6
  51. package/docs/api/{player.levelselectorpluginsettings.restrictresolution.md → player.qualitylevelspluginsettings.restrictresolution.md} +2 -2
  52. package/docs/api/player.timeposition.current.md +1 -1
  53. package/docs/api/player.timeposition.md +2 -2
  54. package/docs/api/player.timeposition.total.md +1 -1
  55. package/docs/api/player.timeprogress.md +6 -4
  56. package/docs/api/player.timevalue.md +1 -1
  57. package/lib/index.plugins.d.ts +2 -1
  58. package/lib/index.plugins.d.ts.map +1 -1
  59. package/lib/index.plugins.js +2 -1
  60. package/lib/playback/dash-playback/DashPlayback.d.ts.map +1 -1
  61. package/lib/playback/dash-playback/DashPlayback.js +5 -7
  62. package/lib/playback.types.d.ts +22 -9
  63. package/lib/playback.types.d.ts.map +1 -1
  64. package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.d.ts +4 -0
  65. package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.d.ts.map +1 -1
  66. package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.js +20 -23
  67. package/lib/plugins/clappr-nerd-stats/NerdStats.d.ts +83 -0
  68. package/lib/plugins/clappr-nerd-stats/NerdStats.d.ts.map +1 -0
  69. package/lib/plugins/clappr-nerd-stats/NerdStats.js +339 -0
  70. package/lib/plugins/clappr-stats/ClapprStats.d.ts +27 -32
  71. package/lib/plugins/clappr-stats/ClapprStats.d.ts.map +1 -1
  72. package/lib/plugins/clappr-stats/ClapprStats.js +94 -202
  73. package/lib/plugins/clappr-stats/types.d.ts +65 -24
  74. package/lib/plugins/clappr-stats/types.d.ts.map +1 -1
  75. package/lib/plugins/clappr-stats/types.js +37 -2
  76. package/lib/plugins/clappr-stats/utils.d.ts.map +1 -1
  77. package/lib/plugins/clappr-stats/utils.js +1 -2
  78. package/lib/plugins/clips/Clips.d.ts +21 -16
  79. package/lib/plugins/clips/Clips.d.ts.map +1 -1
  80. package/lib/plugins/clips/Clips.js +96 -98
  81. package/lib/plugins/clips/types.d.ts +19 -0
  82. package/lib/plugins/clips/types.d.ts.map +1 -0
  83. package/lib/plugins/clips/types.js +1 -0
  84. package/lib/plugins/clips/utils.d.ts +4 -0
  85. package/lib/plugins/clips/utils.d.ts.map +1 -0
  86. package/lib/plugins/clips/utils.js +36 -0
  87. package/lib/plugins/media-control/MediaControl.d.ts +4 -7
  88. package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
  89. package/lib/plugins/media-control/MediaControl.js +19 -31
  90. package/lib/plugins/utils.d.ts +9 -1
  91. package/lib/plugins/utils.d.ts.map +1 -1
  92. package/lib/plugins/utils.js +9 -10
  93. package/lib/plugins/vast-ads/loaderxml.js +2 -2
  94. package/lib/testUtils.d.ts +2 -1
  95. package/lib/testUtils.d.ts.map +1 -1
  96. package/lib/testUtils.js +5 -7
  97. package/package.json +1 -1
  98. package/src/index.plugins.ts +2 -1
  99. package/src/playback/dash-playback/DashPlayback.ts +5 -8
  100. package/src/playback.types.ts +23 -8
  101. package/src/plugins/clappr-nerd-stats/{ClapprNerdStats.ts → NerdStats.ts} +25 -30
  102. package/src/plugins/clappr-stats/ClapprStats.ts +242 -306
  103. package/src/plugins/clappr-stats/__tests__/ClapprStats.test.ts +133 -0
  104. package/src/plugins/clappr-stats/types.ts +72 -25
  105. package/src/plugins/clappr-stats/utils.ts +1 -2
  106. package/src/plugins/clips/Clips.ts +116 -135
  107. package/src/plugins/clips/__tests__/Clips.test.ts +72 -0
  108. package/src/plugins/clips/__tests__/__snapshots__/Clips.test.ts.snap +14 -0
  109. package/src/plugins/clips/types.ts +22 -0
  110. package/src/plugins/clips/utils.ts +54 -0
  111. package/src/plugins/error-screen/__tests__/ErrorScreen.test.ts +3 -4
  112. package/src/plugins/level-selector/__tests__/__snapshots__/QualityLevels.test.ts.snap +18 -18
  113. package/src/plugins/media-control/MediaControl.ts +31 -58
  114. package/src/plugins/media-control/__tests__/__snapshots__/MediaControl.test.ts.snap +7 -35
  115. package/src/plugins/subtitles/__tests__/ClosedCaptions.test.ts +1 -0
  116. package/src/plugins/utils.ts +9 -7
  117. package/src/plugins/vast-ads/loaderxml.ts +2 -2
  118. package/src/testUtils.ts +5 -7
  119. package/temp/player.api.json +693 -471
  120. package/tsconfig.tsbuildinfo +1 -1
  121. package/docs/api/player.clapprstats.setupdatemetrics.md +0 -56
  122. package/docs/api/player.clipsplugin.gettext.md +0 -58
  123. package/docs/api/player.clipsplugin.md +0 -59
  124. package/docs/api/player.mediacontrol.handlecustomarea.md +0 -52
package/dist/player.d.ts CHANGED
@@ -51,7 +51,7 @@ import { UIObject } from '@clappr/core';
51
51
  *
52
52
  * - {@link MediaControl}
53
53
  */
54
- export declare class AudioSelector extends UICorePlugin {
54
+ declare class AudioTracks extends UICorePlugin {
55
55
  private currentTrack;
56
56
  private tracks;
57
57
  /**
@@ -80,28 +80,22 @@ export declare class AudioSelector extends UICorePlugin {
80
80
  */
81
81
  get events(): {
82
82
  'click [data-audiotracks-select]': string;
83
- 'click [data-audiotracks-button]': string;
83
+ 'click #audiotracks-button': string;
84
84
  };
85
85
  /**
86
86
  * @internal
87
87
  */
88
88
  bindEvents(): void;
89
89
  private onCoreReady;
90
- private bindPlaybackEvents;
91
- private setupAudioTrackListeners;
92
- private onStop;
93
90
  private onActiveContainerChanged;
94
91
  private shouldRender;
95
92
  /**
96
93
  * @internal
97
94
  */
98
95
  render(): this;
99
- private fillTracks;
100
- private findTrackBy;
101
96
  private onTrackSelect;
102
97
  private selectAudioTrack;
103
- private onShowLevelSelectMenu;
104
- private hideSelectTrackMenu;
98
+ private hideMenu;
105
99
  private toggleContextMenu;
106
100
  private buttonElement;
107
101
  private buttonElementText;
@@ -111,6 +105,8 @@ export declare class AudioSelector extends UICorePlugin {
111
105
  private updateText;
112
106
  private highlightCurrentTrack;
113
107
  }
108
+ export { AudioTracks as AudioSelector }
109
+ export { AudioTracks }
114
110
 
115
111
  /**
116
112
  * `PLUGIN` that displays a big mute button over the video when it's muted.
@@ -316,101 +312,32 @@ export declare class BottomGear extends UICorePlugin {
316
312
  }
317
313
 
318
314
  /**
319
- * `PLUGIN` that displays useful network-related statistics.
320
315
  * @beta
321
- *
322
- * @remarks
323
- * Depends on:
324
- *
325
- * - {@link BottomGear}
326
- *
327
- * - {@link ClapprStats}
328
- *
329
- * The plugin is rendered as an item in the gear menu.
330
- *
331
- * When clicked, it shows an overlay window with the information about the network speed, latency, etc,
332
- * and recommended quality level.
333
316
  */
334
- export declare class ClapprNerdStats extends UICorePlugin {
335
- private container;
336
- private customMetrics;
337
- private metrics;
338
- private showing;
339
- private shortcut;
340
- private iconPosition;
341
- private static readonly buttonTemplate;
342
- /**
343
- * @internal
344
- */
345
- get name(): string;
346
- /**
347
- * @internal
348
- */
349
- get supportedVersion(): {
350
- min: string;
351
- };
352
- private static readonly template;
353
- /**
354
- * @internal
355
- */
356
- get attributes(): {
357
- 'data-clappr-nerd-stats': string;
358
- class: string;
359
- };
360
- /**
361
- * @internal
362
- */
363
- get events(): {
364
- 'click [data-show-stats-button]': string;
365
- 'click [data-close-button]': string;
366
- 'click [data-refresh-button]': string;
367
- };
368
- private get statsBoxElem();
369
- private get statsBoxWidthThreshold();
370
- private get playerWidth();
371
- private get playerHeight();
372
- constructor(core: Core);
373
- /**
374
- * @internal
375
- */
376
- bindEvents(): void;
377
- private onCoreReady;
378
- private toggle;
379
- private show;
380
- private hide;
381
- private onPlayerResize;
382
- private addGeneralMetrics;
383
- private addCustomMetrics;
384
- private updateMetrics;
385
- private setStatsBoxSize;
386
- /**
387
- * @internal
388
- */
389
- render(): this;
390
- private addToBottomGear;
391
- private clearCustomMetrics;
392
- private refreshSpeedTest;
317
+ declare enum Chronograph {
318
+ Startup = "startup",
319
+ Watch = "watch",
320
+ Pause = "pause",
321
+ Buffering = "buffering",
322
+ Session = "session"
393
323
  }
394
324
 
395
325
  /**
396
- * `PLUGIN` that collects useful statistics about playback performance.
326
+ * `PLUGIN` that measures data about playback, which can be useful for analyzing performance and UX.
397
327
  * @beta
398
328
  * @remarks
399
329
  * This plugin does not render anything and is supposed to be extended or used together with other plugins that actually render something.
330
+ *
331
+ * Configuration options - {@link ClapprStatsSettings}
332
+ *
333
+ * Events - {@link ClapprStatsEvents}
400
334
  */
401
335
  export declare class ClapprStats extends ContainerPlugin {
402
- private bwMeasureCount;
403
- private intervalId;
336
+ private timerId;
404
337
  private lastDecodedFramesCount;
405
338
  private metrics;
406
- private completion;
407
- private _onReport;
408
- private runBandwidthTestEvery;
409
- private runEach;
410
339
  private timers;
411
- private updateFn;
412
- private urisToMeasureBandwidth;
413
- private uriToMeasureLatency;
340
+ private runEach;
414
341
  /**
415
342
  * @internal
416
343
  */
@@ -421,18 +348,12 @@ export declare class ClapprStats extends ContainerPlugin {
421
348
  get supportedVersion(): {
422
349
  min: string;
423
350
  };
424
- private get _playbackName();
425
- private get _playbackType();
426
- private _now;
427
- private _inc;
351
+ private get playbackName();
352
+ private get playbackType();
353
+ private now;
354
+ private inc;
428
355
  private start;
429
- private _stop;
430
- /**
431
- * Registers a callback to receive the metrics.
432
- * @param updateMetricsFn - The callback to receive the metrics
433
- */
434
- setUpdateMetrics(updateMetricsFn: MetricsUpdateFn): void;
435
- private _defaultReport;
356
+ private stop;
436
357
  constructor(container: Container);
437
358
  /**
438
359
  * @internal
@@ -444,7 +365,7 @@ export declare class ClapprStats extends ContainerPlugin {
444
365
  destroy(): void;
445
366
  /**
446
367
  * Returns the collected metrics.
447
- * @returns Currently collected metrics
368
+ * @returns Measurements collected so far
448
369
  */
449
370
  exportMetrics(): Metrics;
450
371
  private onBitrate;
@@ -460,17 +381,22 @@ export declare class ClapprStats extends ContainerPlugin {
460
381
  private onBuffering;
461
382
  private onBufferfull;
462
383
  private onProgress;
463
- private _newMetrics;
464
- private _onCompletion;
465
- private _buildReport;
466
- private _fetchFPS;
467
- private _calculateBitrates;
468
- private _calculatePercentages;
469
- private _html5FetchFPS;
470
- private _measureLatency;
471
- private _measureBandwidth;
384
+ private onCompletion;
385
+ private buildReport;
386
+ private fetchFPS;
387
+ private calcBitrates;
388
+ private calcBufferingPercentage;
389
+ private html5FetchFPS;
472
390
  }
473
391
 
392
+ export declare type ClapprStatsSettings = {
393
+ /**
394
+ * The interval in milliseconds of periodic measurements.
395
+ * The plugin will emit a {@link ClapprStatsEvents.REPORT} event with the collected metrics at the specified interval.
396
+ */
397
+ runEach?: number;
398
+ };
399
+
474
400
  /**
475
401
  * A small `PLUGIN` that toggles the playback state on click over the video container
476
402
  * @beta
@@ -499,21 +425,23 @@ export declare class ClickToPause extends ContainerPlugin {
499
425
  }
500
426
 
501
427
  /**
502
- * `PLUGIN` that shows text over the seekbar to indicate the current clip.
428
+ * `PLUGIN` that allows marking up the timeline of the video
503
429
  * @beta
504
430
  * @remarks
431
+ * The plugin decorates the seekbar with notches to indicate the clips of the video and displays current clip text in the left panel
432
+ *
505
433
  * Depends on:
506
434
  *
507
435
  * - {@link MediaControl}
508
436
  *
509
437
  * Configuration options - {@link ClipsPluginSettings}
510
438
  */
511
- export declare class ClipsPlugin extends UICorePlugin {
439
+ export declare class Clips extends UICorePlugin {
440
+ private barStyle;
512
441
  private clips;
513
- private duration;
514
- private durationGetting;
515
- private _oldContainer;
442
+ private oldContainer;
516
443
  private svgMask;
444
+ private static readonly template;
517
445
  /**
518
446
  * @internal
519
447
  */
@@ -524,34 +452,37 @@ export declare class ClipsPlugin extends UICorePlugin {
524
452
  get attributes(): {
525
453
  class: string;
526
454
  };
455
+ get version(): string;
456
+ get supportedVersion(): {
457
+ min: string;
458
+ };
527
459
  /**
528
460
  * @internal
529
461
  */
530
462
  bindEvents(): void;
531
- private _onCoreReady;
532
- private _onMediaControlContainerChanged;
463
+ render(): this;
464
+ destroy(): UIObject;
465
+ disable(): void;
466
+ enable(): void;
467
+ private onCoreReady;
468
+ private onMcRender;
469
+ private onContainerChanged;
533
470
  private playerResize;
534
- private _bindContainerEvents;
535
471
  private onTimeUpdate;
536
472
  private parseClips;
537
- /**
538
- * Returns the text of the current clip.
539
- * @param time - The current time of the player.
540
- * @returns The text of the current clip.
541
- */
542
- getText(time: number): string;
543
473
  private makeSvg;
544
474
  private setSVGMask;
545
475
  private setClipText;
546
476
  }
547
477
 
548
478
  /**
549
- * Configuration options for the {@link ClipsPlugin | clips} plugin.
479
+ * Configuration options for the {@link ClipsPlugin} plugin.
550
480
  * @beta
551
481
  */
552
482
  export declare interface ClipsPluginSettings {
553
483
  /**
554
- * The text to display over the seekbar.
484
+ * The compiled text of the clips description, one clip per line in format :
485
+ * `HH:MM:SS text` or `MM:SS text` or `SS text`
555
486
  */
556
487
  text: string;
557
488
  }
@@ -697,11 +628,11 @@ export declare type ContainerSize = {
697
628
  * @beta
698
629
  * @remarks
699
630
  * Configuration options - {@link ContextMenuPluginSettings}
631
+ *
632
+ * Should not be used together with {@link ClickToPause} plugin
700
633
  */
701
634
  export declare class ContextMenu extends UIContainerPlugin {
702
- private _label;
703
- private _url;
704
- private menuOptions;
635
+ private open;
705
636
  /**
706
637
  * @internal
707
638
  */
@@ -719,14 +650,11 @@ export declare class ContextMenu extends UIContainerPlugin {
719
650
  class: string;
720
651
  };
721
652
  private static readonly template;
722
- private get label();
723
- private get url();
724
- private get exposeVersion();
725
653
  /**
726
654
  * @internal
727
655
  */
728
656
  get events(): {
729
- 'click [data-version]': string;
657
+ 'click [role="menuitem"]': string;
730
658
  };
731
659
  constructor(container: Container);
732
660
  /**
@@ -737,10 +665,11 @@ export declare class ContextMenu extends UIContainerPlugin {
737
665
  * @internal
738
666
  */
739
667
  destroy(): UIObject;
740
- private toggleContextMenu;
668
+ private onContainerClick;
669
+ private onContextMenu;
741
670
  private show;
742
671
  private hide;
743
- private onOpenMainPage;
672
+ private runAction;
744
673
  /**
745
674
  * @internal
746
675
  */
@@ -753,9 +682,7 @@ export declare class ContextMenu extends UIContainerPlugin {
753
682
  * @beta
754
683
  */
755
684
  export declare interface ContextMenuPluginSettings {
756
- label?: string;
757
- url?: string;
758
- preventShowContextMenu?: boolean;
685
+ options?: MenuOption[];
759
686
  }
760
687
 
761
688
  /**
@@ -766,6 +693,23 @@ export declare type CorePluginConstructor = {
766
693
  type: string;
767
694
  };
768
695
 
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
+
769
713
  /**
770
714
  * A plain JS object that must conform to the DASH.js settings schema.
771
715
  * @public
@@ -1027,116 +971,6 @@ export declare interface InitEventData {
1027
971
  */
1028
972
  export declare type LangTag = string;
1029
973
 
1030
- /**
1031
- * `PLUGIN` that provides a UI to select the desired quality level of the playback.
1032
- * @beta
1033
- *
1034
- * @remarks
1035
- * Depends on:
1036
- *
1037
- * - {@link MediaControl}
1038
- *
1039
- * - {@link BottomGear}
1040
- *
1041
- * The plugin is rendered as an item in the gear menu, which, when clicked, shows a list of quality levels to choose from.
1042
- *
1043
- * Configuration options - {@link LevelSelectorPluginSettings}
1044
- *
1045
- * @example
1046
- * ```ts
1047
- * new Player({
1048
- * levelSelector: {
1049
- * restrictResolution: 360,
1050
- * labels: { 360: 'SD', 720: 'HD' },
1051
- * },
1052
- * })
1053
- * ```
1054
- */
1055
- export declare class LevelSelector extends UICorePlugin {
1056
- private levels;
1057
- private levelLabels;
1058
- private removeAuto;
1059
- private isHd;
1060
- private currentText;
1061
- private selectedLevelId;
1062
- private static readonly buttonTemplate;
1063
- private static readonly listTemplate;
1064
- /**
1065
- * @internal
1066
- */
1067
- get name(): string;
1068
- /**
1069
- * @internal
1070
- */
1071
- get supportedVersion(): {
1072
- min: string;
1073
- };
1074
- /**
1075
- * @internal
1076
- */
1077
- static get version(): string;
1078
- /**
1079
- * @internal
1080
- */
1081
- get attributes(): {
1082
- class: string;
1083
- 'data-level-selector': string;
1084
- };
1085
- get events(): {
1086
- 'click .gear-sub-menu_btn': string;
1087
- 'click .go-back': string;
1088
- };
1089
- /**
1090
- * @internal
1091
- */
1092
- bindEvents(): void;
1093
- private onCoreReady;
1094
- private onGearRendered;
1095
- private onActiveContainerChange;
1096
- private updateHd;
1097
- private onStop;
1098
- private shouldRender;
1099
- /**
1100
- * @internal
1101
- */
1102
- render(): this;
1103
- private renderDropdown;
1104
- private updateButton;
1105
- private get maxLevel();
1106
- private onLevelsAvailable;
1107
- private makeLevelsLabels;
1108
- private onSelect;
1109
- private goBack;
1110
- private setLevel;
1111
- private allLevelElements;
1112
- private levelElement;
1113
- private onLevelSwitchStart;
1114
- private onLevelSwitchEnd;
1115
- private updateText;
1116
- private getLevelLabel;
1117
- private onBitrate;
1118
- private highlightCurrentLevel;
1119
- }
1120
-
1121
- /**
1122
- * Configuration options for the {@link LevelSelector | level selector} plugin.
1123
- * @beta
1124
- */
1125
- export declare interface LevelSelectorPluginSettings {
1126
- /**
1127
- * The maximum resolution to allow in the level selector.
1128
- */
1129
- restrictResolution?: number;
1130
- /**
1131
- * The labels to show in the level selector.
1132
- * @example
1133
- * ```ts
1134
- * { 360: 'SD', 720: 'HD' }
1135
- * ```
1136
- */
1137
- labels?: Record<number, string>;
1138
- }
1139
-
1140
974
  export { Logger }
1141
975
 
1142
976
  /**
@@ -1177,10 +1011,16 @@ export { LogTracer }
1177
1011
  * @beta
1178
1012
  * @remarks
1179
1013
  * The methods exposed are to be used by the other plugins that extend the media control UI.
1014
+ *
1015
+ * Configuration options:
1016
+ *
1017
+ * - `mediaControl`: {@link MediaControlSettings} - specifies the allowed media control elements in each area
1018
+ *
1019
+ * - `persistConfig`: boolean - `common` option, makes the plugin persist the media control settings
1020
+ *
1021
+ * - `chromeless`: boolean
1180
1022
  */
1181
1023
  export declare class MediaControl extends UICorePlugin {
1182
- private customAreaElements;
1183
- private customAreaHandler?;
1184
1024
  private buttonsColor;
1185
1025
  private currentDurationValue;
1186
1026
  private currentPositionValue;
@@ -1199,20 +1039,20 @@ export declare class MediaControl extends UICorePlugin {
1199
1039
  private kibo;
1200
1040
  private lastMouseX;
1201
1041
  private lastMouseY;
1042
+ private metadataLoaded;
1043
+ private hasUpdate;
1202
1044
  private persistConfig;
1045
+ private renderTimerId;
1203
1046
  private rendered;
1204
1047
  private settings;
1205
1048
  private userDisabled;
1206
1049
  private userKeepVisible;
1207
1050
  private verticalVolume;
1208
- private $clipText;
1209
- private $clipTextContainer;
1210
1051
  private $duration;
1211
1052
  private $fullscreenToggle;
1212
1053
  private $multiCameraSelector;
1213
1054
  private $playPauseToggle;
1214
1055
  private $playStopToggle;
1215
- private $playbackRate;
1216
1056
  private $position;
1217
1057
  private $seekBarContainer;
1218
1058
  private $seekBarHover;
@@ -1373,17 +1213,15 @@ export declare class MediaControl extends UICorePlugin {
1373
1213
  * ```ts
1374
1214
  * class MyPlugin extends UICorePlugin {
1375
1215
  * override render() {
1376
- * const mediaControl = this.core.getPlugin('media_control')
1377
- * const clipText = mediaControl.getElement('clipText')
1378
- * clipText?.el.text('Here we go')
1216
+ * this.$el.html('<div data-clips>Here we go</div>')
1217
+ * this.core.getPlugin('media_control').mount('clips', this.$el)
1379
1218
  * return this
1380
1219
  * }
1381
1220
  * }
1382
1221
  * ```
1383
1222
  */
1384
- getElement(name: MediaControlElement): ZeptoResult | null;
1223
+ mount(name: MediaControlElement, element: ZeptoResult): void;
1385
1224
  putElement(name: MediaControlElement, element: ZeptoResult): void;
1386
- handleCustomArea(handler: (name: string, content: HTMLElement) => void): void;
1387
1225
  /**
1388
1226
  * Toggle the visibility of a media control element
1389
1227
  * @param name - The name of the media control element
@@ -1406,6 +1244,7 @@ export declare class MediaControl extends UICorePlugin {
1406
1244
  * @internal
1407
1245
  */
1408
1246
  destroy(): UIObject;
1247
+ private cancelRenderTimer;
1409
1248
  private configure;
1410
1249
  /**
1411
1250
  * @internal
@@ -1431,35 +1270,108 @@ export declare class MediaControl extends UICorePlugin {
1431
1270
  }
1432
1271
 
1433
1272
  /**
1434
- * Media control elements, mount points for additional plugins
1273
+ * Built-in media control elements.
1274
+ * @beta
1275
+ */
1276
+ export declare type MediaControlElement = MediaControlLeftElement | MediaControlLayerElement | MediaControlRightElement;
1277
+
1278
+ /**
1279
+ * Media control elements that appear in main layer, spanning the entire width of the player.
1280
+ * @beta
1281
+ */
1282
+ export declare type MediaControlLayerElement = 'seekbar' | 'seekBarContainer';
1283
+
1284
+ /**
1285
+ * Media control elements that appear in the left area.
1435
1286
  * @beta
1436
1287
  */
1437
- export declare type MediaControlElement = 'audiotracks' | 'cc' | 'clipText' | 'dvr' | 'duration' | 'fullscreen' | 'gear' | 'multicamera' | 'pip' | 'playbackRate' | 'position' | 'seekBarContainer' | 'vr' | 'volume';
1288
+ export declare type MediaControlLeftElement = 'clipText' | 'duration' | 'dvr' | 'playpause' | 'playstop' | 'position' | 'volume' | 'clips';
1289
+
1290
+ /**
1291
+ * Media control elements that appear in the right area.
1292
+ * @beta
1293
+ */
1294
+ export declare type MediaControlRightElement = 'audiotracks' | 'cc' | 'fullscreen' | 'hd-indicator' | 'gear' | 'multicamera' | 'pip' | 'vr';
1295
+
1296
+ /**
1297
+ * Specifies the allowed media control elements in each area.
1298
+ * Can be used to restrict rendered media control elements.
1299
+ * @beta
1300
+ */
1301
+ export declare type MediaControlSettings = {
1302
+ left: MediaControlLeftElement[];
1303
+ right: MediaControlRightElement[];
1304
+ default: MediaControlLayerElement[];
1305
+ seekEnabled: boolean;
1306
+ };
1307
+
1308
+ /**
1309
+ * @beta
1310
+ */
1311
+ export declare type MenuOption = {
1312
+ /**
1313
+ * Menu item label text. One of `label` or `labelKey` must be specified.
1314
+ */
1315
+ label?: string;
1316
+ /**
1317
+ * Menu item label localisation key, if specified, the `label` will be ignored
1318
+ */
1319
+ labelKey?: string;
1320
+ /**
1321
+ * Menu item name. Must be unique.
1322
+ */
1323
+ name: string;
1324
+ /**
1325
+ * Menu item handler function
1326
+ */
1327
+ handler?: () => void;
1328
+ /**
1329
+ * Menu item icon, plain HTML string
1330
+ */
1331
+ icon?: string;
1332
+ };
1438
1333
 
1439
1334
  /**
1440
1335
  * @beta
1441
1336
  */
1442
1337
  declare type Metrics = {
1338
+ /**
1339
+ * Events count counters
1340
+ */
1443
1341
  counters: {
1444
- play: number;
1445
- pause: number;
1446
- error: number;
1447
- buffering: number;
1448
- decodedFrames: number;
1449
- droppedFrames: number;
1450
- fps: number;
1451
- changeLevel: number;
1452
- seek: number;
1453
- fullscreen: number;
1454
- dvrUsage: number;
1455
- };
1456
- timers: {
1457
- startup: number;
1458
- watch: number;
1459
- pause: number;
1460
- buffering: number;
1461
- session: number;
1462
- latency: number;
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;
1463
1375
  };
1464
1376
  extra: {
1465
1377
  playbackName: string;
@@ -1478,11 +1390,6 @@ declare type Metrics = {
1478
1390
  custom: Record<string, unknown>;
1479
1391
  };
1480
1392
 
1481
- /**
1482
- * @beta
1483
- */
1484
- declare type MetricsUpdateFn = (metrics: Metrics) => void;
1485
-
1486
1393
  /**
1487
1394
  * `PLUGIN` that adds support for loading multiple streams and switching between them using the media control UI.
1488
1395
  * @beta
@@ -1536,6 +1443,89 @@ export declare class MultiCamera extends UICorePlugin {
1536
1443
  private highlightCurrentLevel;
1537
1444
  }
1538
1445
 
1446
+ /**
1447
+ * `PLUGIN` that displays useful network-related statistics.
1448
+ * @beta
1449
+ *
1450
+ * @remarks
1451
+ * Depends on:
1452
+ *
1453
+ * - {@link BottomGear}
1454
+ *
1455
+ * - {@link ClapprStats}
1456
+ *
1457
+ * The plugin is rendered as an item in the gear menu.
1458
+ *
1459
+ * When clicked, it shows an overlay window with the information about the network speed, latency, etc,
1460
+ * and recommended quality level.
1461
+ */
1462
+ declare class NerdStats extends UICorePlugin {
1463
+ private container;
1464
+ private customMetrics;
1465
+ private metrics;
1466
+ private showing;
1467
+ private shortcut;
1468
+ private iconPosition;
1469
+ private static readonly buttonTemplate;
1470
+ /**
1471
+ * @internal
1472
+ */
1473
+ get name(): string;
1474
+ /**
1475
+ * @internal
1476
+ */
1477
+ get supportedVersion(): {
1478
+ min: string;
1479
+ };
1480
+ private static readonly template;
1481
+ /**
1482
+ * @internal
1483
+ */
1484
+ get attributes(): {
1485
+ 'data-clappr-nerd-stats': string;
1486
+ class: string;
1487
+ };
1488
+ /**
1489
+ * @internal
1490
+ */
1491
+ get events(): {
1492
+ 'click [data-show-stats-button]': string;
1493
+ 'click [data-close-button]': string;
1494
+ 'click [data-refresh-button]': string;
1495
+ };
1496
+ private get statsBoxElem();
1497
+ private get statsBoxWidthThreshold();
1498
+ private get playerWidth();
1499
+ private get playerHeight();
1500
+ constructor(core: Core);
1501
+ /**
1502
+ * @internal
1503
+ */
1504
+ bindEvents(): void;
1505
+ private onCoreReady;
1506
+ /**
1507
+ * @internal
1508
+ */
1509
+ destroy(): UIObject;
1510
+ private toggle;
1511
+ private show;
1512
+ private hide;
1513
+ private onPlayerResize;
1514
+ private addGeneralMetrics;
1515
+ private addCustomMetrics;
1516
+ private updateMetrics;
1517
+ private setStatsBoxSize;
1518
+ /**
1519
+ * @internal
1520
+ */
1521
+ render(): this;
1522
+ private addToBottomGear;
1523
+ private clearCustomMetrics;
1524
+ private refreshSpeedTest;
1525
+ }
1526
+ export { NerdStats as ClapprNerdStats }
1527
+ export { NerdStats }
1528
+
1539
1529
  /**
1540
1530
  * `PLUGIN` that enables picture in picture mode.
1541
1531
  * @beta
@@ -1681,13 +1671,14 @@ export declare type PlaybackModule = 'dash' | 'hls' | 'html5_video';
1681
1671
  * { value: 1, label: '1x' },
1682
1672
  * ],
1683
1673
  * defaultValue: 1,
1684
- * } as PlaybackRateSettings,
1674
+ * },
1685
1675
  * })
1686
1676
  * ```
1687
1677
  */
1688
1678
  export declare class PlaybackRate extends UICorePlugin {
1689
- private playbackRates;
1690
1679
  private selectedRate;
1680
+ private metadataLoaded;
1681
+ private mountTimerId;
1691
1682
  /**
1692
1683
  * @internal
1693
1684
  */
@@ -1701,6 +1692,7 @@ export declare class PlaybackRate extends UICorePlugin {
1701
1692
  private static readonly buttonTemplate;
1702
1693
  private static readonly listTemplate;
1703
1694
  constructor(core: Core);
1695
+ private get playbackRates();
1704
1696
  /**
1705
1697
  * @internal
1706
1698
  */
@@ -1722,17 +1714,22 @@ export declare class PlaybackRate extends UICorePlugin {
1722
1714
  private onActiveContainerChange;
1723
1715
  private onMediaControlRendered;
1724
1716
  private onGearRendered;
1725
- private addGearItem;
1717
+ private mount;
1726
1718
  private onMetaDataLoaded;
1727
1719
  private allRateElements;
1728
1720
  private rateElement;
1729
1721
  private onPlaybackRateChange;
1730
- private shouldRender;
1722
+ private shouldMount;
1731
1723
  /**
1732
1724
  * @internal
1733
1725
  */
1734
1726
  render(): this;
1727
+ /**
1728
+ * @internal
1729
+ */
1730
+ destroy(): UIObject;
1735
1731
  private onPlay;
1732
+ private syncRate;
1736
1733
  private resetPlaybackRate;
1737
1734
  private onStop;
1738
1735
  private onSelect;
@@ -2043,9 +2040,10 @@ export declare interface PlayerConfig extends Record<string, unknown> {
2043
2040
  */
2044
2041
  mute?: boolean;
2045
2042
  /**
2046
- * The type of playback (live stream or video on demand).
2047
- *
2048
- * @defaultValue 'vod'
2043
+ * Stream type.
2044
+ * @remark
2045
+ * Should only be set if known in advance, as it should not change once determined.
2046
+ * Otherwise it might cause inconsistencies in the UI plugins behavior, for instance, glitches with rendering of the DVR controls or seek bar.
2049
2047
  */
2050
2048
  playbackType?: PlaybackType;
2051
2049
  /**
@@ -2283,20 +2281,21 @@ export declare class Poster extends UIContainerPlugin {
2283
2281
  }
2284
2282
 
2285
2283
  /**
2286
- * A level of quality within a media source.
2284
+ * A level of quality within a media source/representation.
2287
2285
  * @public
2288
2286
  */
2289
2287
  export declare interface QualityLevel {
2290
2288
  /**
2291
2289
  * Zero-based index of the quality level.
2290
+ * Quality levels go from low to high
2292
2291
  */
2293
2292
  level: number;
2294
2293
  /**
2295
- * Width of the video, pixels.
2294
+ * Width of the video frame, pixels.
2296
2295
  */
2297
2296
  width: number;
2298
2297
  /**
2299
- * Height of the video, pixels.
2298
+ * Height of the video frame, pixels.
2300
2299
  */
2301
2300
  height: number;
2302
2301
  /**
@@ -2305,6 +2304,119 @@ export declare interface QualityLevel {
2305
2304
  bitrate: number;
2306
2305
  }
2307
2306
 
2307
+ /**
2308
+ * `PLUGIN` that provides a UI to select the desired quality level of the playback.
2309
+ * @beta
2310
+ *
2311
+ * @remarks
2312
+ * Depends on:
2313
+ *
2314
+ * - {@link MediaControl}
2315
+ *
2316
+ * - {@link BottomGear}
2317
+ *
2318
+ * The plugin is rendered as an item in the gear menu, which, when clicked, shows a list of quality levels to choose from.
2319
+ *
2320
+ * Configuration options - {@link QualityLevelsPluginSettings}
2321
+ *
2322
+ * @example
2323
+ * ```ts
2324
+ * new Player({
2325
+ * qualityLevels: {
2326
+ * restrictResolution: 360,
2327
+ * labels: { 360: 'SD', 720: 'HD' },
2328
+ * },
2329
+ * })
2330
+ * ```
2331
+ */
2332
+ declare class QualityLevels extends UICorePlugin {
2333
+ private levels;
2334
+ private levelLabels;
2335
+ private removeAuto;
2336
+ private isHd;
2337
+ private currentText;
2338
+ private selectedLevelId;
2339
+ private static readonly buttonTemplate;
2340
+ private static readonly listTemplate;
2341
+ /**
2342
+ * @internal
2343
+ */
2344
+ get name(): string;
2345
+ /**
2346
+ * @internal
2347
+ */
2348
+ get supportedVersion(): {
2349
+ min: string;
2350
+ };
2351
+ /**
2352
+ * @internal
2353
+ */
2354
+ static get version(): string;
2355
+ /**
2356
+ * @internal
2357
+ */
2358
+ get attributes(): {
2359
+ class: string;
2360
+ 'data-level-selector': string;
2361
+ };
2362
+ get events(): {
2363
+ 'click .gear-sub-menu_btn': string;
2364
+ 'click .go-back': string;
2365
+ };
2366
+ /**
2367
+ * @internal
2368
+ */
2369
+ bindEvents(): void;
2370
+ private onCoreReady;
2371
+ private onGearRendered;
2372
+ private onActiveContainerChange;
2373
+ private updateHd;
2374
+ private onStop;
2375
+ private shouldRender;
2376
+ /**
2377
+ * @internal
2378
+ */
2379
+ render(): this;
2380
+ private renderDropdown;
2381
+ private updateButton;
2382
+ private get pluginOptions();
2383
+ private get maxLevel();
2384
+ private onLevelsAvailable;
2385
+ private makeLevelsLabels;
2386
+ private onSelect;
2387
+ private goBack;
2388
+ private setLevel;
2389
+ private allLevelElements;
2390
+ private levelElement;
2391
+ private onLevelSwitchStart;
2392
+ private onLevelSwitchEnd;
2393
+ private updateText;
2394
+ private getLevelLabel;
2395
+ private onBitrate;
2396
+ private highlightCurrentLevel;
2397
+ }
2398
+ export { QualityLevels as LevelSelector }
2399
+ export { QualityLevels }
2400
+
2401
+ /**
2402
+ * Configuration options for the {@link QualityLevels} plugin.
2403
+ * @beta
2404
+ */
2405
+ export declare interface QualityLevelsPluginSettings {
2406
+ /**
2407
+ * The maximum resolution to allow in the level selector.
2408
+ */
2409
+ restrictResolution?: number;
2410
+ /**
2411
+ * The labels to show in the level selector.
2412
+ * @example
2413
+ * ```ts
2414
+ * { 360: 'SD', 720: 'HD' }
2415
+ * ```
2416
+ */
2417
+ labels?: Record<number, string>;
2418
+ }
2419
+
2308
2420
  export { reportError_2 as reportError }
2309
2421
 
2310
2422
  /**
@@ -2823,21 +2935,32 @@ export declare type ThumbnailsPluginSettings = {
2823
2935
  */
2824
2936
  export declare interface TimePosition {
2825
2937
  /**
2826
- * Current playback time, 0..duration, seconds.
2938
+ * Current playback time, 0..duration
2827
2939
  */
2828
2940
  current: TimeValue;
2829
2941
  /**
2830
- * Total duration of the media, seconds.
2942
+ * Total duration of the media content (or DVR window size or segment duration for live streams)
2831
2943
  */
2832
2944
  total: TimeValue;
2833
2945
  }
2834
2946
 
2835
2947
  /**
2836
- * For the plugin development
2948
+ * Time progress information indicated by Clappr CONTAINER_PROGRESS and PLAYBACK_PROGRESS events.
2837
2949
  * @beta
2838
2950
  */
2839
- export declare type TimeProgress = TimePosition & {
2840
- start: number;
2951
+ export declare type TimeProgress = {
2952
+ /**
2953
+ * Current playback time
2954
+ */
2955
+ start: TimeValue;
2956
+ /**
2957
+ * Current buffer length beginning from the start (=current) time
2958
+ */
2959
+ current: TimeValue;
2960
+ /**
2961
+ * Total duration of the media content
2962
+ */
2963
+ total: TimeValue;
2841
2964
  };
2842
2965
 
2843
2966
  /**
@@ -2849,7 +2972,8 @@ export declare type TimeUpdate = TimePosition & {
2849
2972
  };
2850
2973
 
2851
2974
  /**
2852
- * Playback time in seconds since the beginning of the stream (or a segment for the live streams)
2975
+ * Playback time position in seconds since the beginning of the stream.
2976
+ * For the live streams this is limited to the length of a segment. When DVR is enabled, this refers to the
2853
2977
  * @public
2854
2978
  */
2855
2979
  export declare type TimeValue = number;