@gcorevideo/player 2.22.14 → 2.22.16

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 (80) hide show
  1. package/assets/clips/clips.ejs +1 -0
  2. package/assets/clips/clips.scss +23 -3
  3. package/assets/context-menu/context_menu.ejs +14 -6
  4. package/assets/context-menu/context_menu.scss +18 -4
  5. package/assets/level-selector/list.ejs +9 -3
  6. package/assets/media-control/media-control.ejs +1 -9
  7. package/assets/media-control/media-control.scss +0 -25
  8. package/assets/media-control/width370.scss +4 -4
  9. package/dist/core.js +5 -23
  10. package/dist/index.css +424 -412
  11. package/dist/index.js +294 -286
  12. package/dist/player.d.ts +211 -144
  13. package/dist/plugins/index.css +1513 -1501
  14. package/dist/plugins/index.js +224 -227
  15. package/docs/api/{player.audioselector.md → player.audiotracks.md} +3 -3
  16. package/docs/api/player.contextmenu.md +2 -0
  17. package/docs/api/player.contextmenupluginsettings.md +2 -40
  18. package/docs/api/{player.contextmenupluginsettings.label.md → player.contextmenupluginsettings.options.md} +3 -3
  19. package/docs/api/player.md +78 -23
  20. package/docs/api/player.mediacontrol.md +8 -14
  21. package/docs/api/player.mediacontrolelement.md +4 -2
  22. package/docs/api/{player.contextmenupluginsettings.preventshowcontextmenu.md → player.mediacontrollayerelement.md} +5 -3
  23. package/docs/api/player.mediacontrolleftelement.md +16 -0
  24. package/docs/api/player.mediacontrolrightelement.md +16 -0
  25. package/docs/api/player.mediacontrolsettings.md +23 -0
  26. package/docs/api/{player.contextmenupluginsettings.url.md → player.menuoption.md} +10 -3
  27. package/docs/api/player.playbackrate.md +1 -1
  28. package/docs/api/player.playerconfig.md +1 -1
  29. package/docs/api/player.playerconfig.playbacktype.md +1 -1
  30. package/docs/api/{player.levelselector.events.md → player.qualitylevels.events.md} +2 -2
  31. package/docs/api/{player.levelselector.md → player.qualitylevels.md} +6 -6
  32. package/docs/api/{player.levelselectorpluginsettings.labels.md → player.qualitylevelspluginsettings.labels.md} +2 -2
  33. package/docs/api/{player.levelselectorpluginsettings.md → player.qualitylevelspluginsettings.md} +6 -6
  34. package/docs/api/{player.levelselectorpluginsettings.restrictresolution.md → player.qualitylevelspluginsettings.restrictresolution.md} +2 -2
  35. package/lib/Player.d.ts.map +1 -1
  36. package/lib/Player.js +4 -1
  37. package/lib/playback/hls-playback/HlsPlayback.d.ts.map +1 -1
  38. package/lib/playback/hls-playback/HlsPlayback.js +0 -21
  39. package/lib/plugins/click-to-pause/ClickToPause.js +1 -1
  40. package/lib/plugins/clips/Clips.d.ts +21 -16
  41. package/lib/plugins/clips/Clips.d.ts.map +1 -1
  42. package/lib/plugins/clips/Clips.js +96 -98
  43. package/lib/plugins/clips/types.d.ts +19 -0
  44. package/lib/plugins/clips/types.d.ts.map +1 -0
  45. package/lib/plugins/clips/types.js +1 -0
  46. package/lib/plugins/clips/utils.d.ts +4 -0
  47. package/lib/plugins/clips/utils.d.ts.map +1 -0
  48. package/lib/plugins/clips/utils.js +36 -0
  49. package/lib/plugins/context-menu/ContextMenu.d.ts +33 -12
  50. package/lib/plugins/context-menu/ContextMenu.d.ts.map +1 -1
  51. package/lib/plugins/context-menu/ContextMenu.js +40 -37
  52. package/lib/plugins/media-control/MediaControl.d.ts +4 -7
  53. package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
  54. package/lib/plugins/media-control/MediaControl.js +19 -31
  55. package/lib/plugins/utils.d.ts +9 -1
  56. package/lib/plugins/utils.d.ts.map +1 -1
  57. package/lib/plugins/utils.js +9 -10
  58. package/lib/plugins/vast-ads/loaderxml.js +2 -2
  59. package/lib/testUtils.d.ts.map +1 -1
  60. package/lib/testUtils.js +2 -5
  61. package/package.json +1 -1
  62. package/src/Player.ts +4 -3
  63. package/src/playback/hls-playback/HlsPlayback.ts +0 -22
  64. package/src/plugins/click-to-pause/ClickToPause.ts +1 -1
  65. package/src/plugins/clips/Clips.ts +116 -135
  66. package/src/plugins/clips/__tests__/Clips.test.ts +72 -0
  67. package/src/plugins/clips/__tests__/__snapshots__/Clips.test.ts.snap +14 -0
  68. package/src/plugins/clips/types.ts +22 -0
  69. package/src/plugins/clips/utils.ts +54 -0
  70. package/src/plugins/context-menu/ContextMenu.ts +72 -56
  71. package/src/plugins/level-selector/__tests__/__snapshots__/QualityLevels.test.ts.snap +18 -18
  72. package/src/plugins/media-control/MediaControl.ts +31 -58
  73. package/src/plugins/media-control/__tests__/MediaControl.test.ts +66 -30
  74. package/src/plugins/media-control/__tests__/__snapshots__/MediaControl.test.ts.snap +7 -35
  75. package/src/plugins/utils.ts +9 -7
  76. package/src/plugins/vast-ads/loaderxml.ts +2 -2
  77. package/src/testUtils.ts +2 -5
  78. package/temp/player.api.json +332 -262
  79. package/tsconfig.tsbuildinfo +1 -1
  80. 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.
@@ -697,11 +693,11 @@ export declare type ContainerSize = {
697
693
  * @beta
698
694
  * @remarks
699
695
  * Configuration options - {@link ContextMenuPluginSettings}
696
+ *
697
+ * Should not be used together with {@link ClickToPause} plugin
700
698
  */
701
699
  export declare class ContextMenu extends UIContainerPlugin {
702
- private _label;
703
- private _url;
704
- private menuOptions;
700
+ private open;
705
701
  /**
706
702
  * @internal
707
703
  */
@@ -719,14 +715,11 @@ export declare class ContextMenu extends UIContainerPlugin {
719
715
  class: string;
720
716
  };
721
717
  private static readonly template;
722
- private get label();
723
- private get url();
724
- private get exposeVersion();
725
718
  /**
726
719
  * @internal
727
720
  */
728
721
  get events(): {
729
- 'click [data-version]': string;
722
+ 'click [role="menuitem"]': string;
730
723
  };
731
724
  constructor(container: Container);
732
725
  /**
@@ -737,10 +730,11 @@ export declare class ContextMenu extends UIContainerPlugin {
737
730
  * @internal
738
731
  */
739
732
  destroy(): UIObject;
740
- private toggleContextMenu;
733
+ private onContainerClick;
734
+ private onContextMenu;
741
735
  private show;
742
736
  private hide;
743
- private onOpenMainPage;
737
+ private runAction;
744
738
  /**
745
739
  * @internal
746
740
  */
@@ -753,9 +747,7 @@ export declare class ContextMenu extends UIContainerPlugin {
753
747
  * @beta
754
748
  */
755
749
  export declare interface ContextMenuPluginSettings {
756
- label?: string;
757
- url?: string;
758
- preventShowContextMenu?: boolean;
750
+ options?: MenuOption[];
759
751
  }
760
752
 
761
753
  /**
@@ -1027,116 +1019,6 @@ export declare interface InitEventData {
1027
1019
  */
1028
1020
  export declare type LangTag = string;
1029
1021
 
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
1022
  export { Logger }
1141
1023
 
1142
1024
  /**
@@ -1177,10 +1059,16 @@ export { LogTracer }
1177
1059
  * @beta
1178
1060
  * @remarks
1179
1061
  * The methods exposed are to be used by the other plugins that extend the media control UI.
1062
+ *
1063
+ * Configuration options:
1064
+ *
1065
+ * - `mediaControl`: {@link MediaControlSettings} - specifies the allowed media control elements in each area
1066
+ *
1067
+ * - `persistConfig`: boolean - `common` option, makes the plugin persist the media control settings
1068
+ *
1069
+ * - `chromeless`: boolean
1180
1070
  */
1181
1071
  export declare class MediaControl extends UICorePlugin {
1182
- private customAreaElements;
1183
- private customAreaHandler?;
1184
1072
  private buttonsColor;
1185
1073
  private currentDurationValue;
1186
1074
  private currentPositionValue;
@@ -1199,7 +1087,10 @@ export declare class MediaControl extends UICorePlugin {
1199
1087
  private kibo;
1200
1088
  private lastMouseX;
1201
1089
  private lastMouseY;
1090
+ private metadataLoaded;
1091
+ private hasUpdate;
1202
1092
  private persistConfig;
1093
+ private renderTimerId;
1203
1094
  private rendered;
1204
1095
  private settings;
1205
1096
  private userDisabled;
@@ -1212,7 +1103,6 @@ export declare class MediaControl extends UICorePlugin {
1212
1103
  private $multiCameraSelector;
1213
1104
  private $playPauseToggle;
1214
1105
  private $playStopToggle;
1215
- private $playbackRate;
1216
1106
  private $position;
1217
1107
  private $seekBarContainer;
1218
1108
  private $seekBarHover;
@@ -1383,7 +1273,6 @@ export declare class MediaControl extends UICorePlugin {
1383
1273
  */
1384
1274
  getElement(name: MediaControlElement): ZeptoResult | null;
1385
1275
  putElement(name: MediaControlElement, element: ZeptoResult): void;
1386
- handleCustomArea(handler: (name: string, content: HTMLElement) => void): void;
1387
1276
  /**
1388
1277
  * Toggle the visibility of a media control element
1389
1278
  * @param name - The name of the media control element
@@ -1406,6 +1295,7 @@ export declare class MediaControl extends UICorePlugin {
1406
1295
  * @internal
1407
1296
  */
1408
1297
  destroy(): UIObject;
1298
+ private cancelRenderTimer;
1409
1299
  private configure;
1410
1300
  /**
1411
1301
  * @internal
@@ -1431,10 +1321,66 @@ export declare class MediaControl extends UICorePlugin {
1431
1321
  }
1432
1322
 
1433
1323
  /**
1434
- * Media control elements, mount points for additional plugins
1324
+ * Built-in media control elements.
1325
+ * @beta
1326
+ */
1327
+ export declare type MediaControlElement = MediaControlLeftElement | MediaControlLayerElement | MediaControlRightElement;
1328
+
1329
+ /**
1330
+ * Media control elements that appear in main layer, spanning the entire width of the player.
1331
+ * @beta
1332
+ */
1333
+ export declare type MediaControlLayerElement = 'seekbar' | 'seekBarContainer';
1334
+
1335
+ /**
1336
+ * Media control elements that appear in the left area.
1337
+ * @beta
1338
+ */
1339
+ export declare type MediaControlLeftElement = 'clipText' | 'duration' | 'dvr' | 'playpause' | 'playstop' | 'position' | 'volume';
1340
+
1341
+ /**
1342
+ * Media control elements that appear in the right area.
1435
1343
  * @beta
1436
1344
  */
1437
- export declare type MediaControlElement = 'audiotracks' | 'cc' | 'clipText' | 'dvr' | 'duration' | 'fullscreen' | 'gear' | 'multicamera' | 'pip' | 'playbackRate' | 'position' | 'seekBarContainer' | 'vr' | 'volume';
1345
+ export declare type MediaControlRightElement = 'audiotracks' | 'cc' | 'fullscreen' | 'hd-indicator' | 'gear' | 'multicamera' | 'pip' | 'vr';
1346
+
1347
+ /**
1348
+ * Specifies the allowed media control elements in each area.
1349
+ * Can be used to restrict rendered media control elements.
1350
+ * @beta
1351
+ */
1352
+ export declare type MediaControlSettings = {
1353
+ left: MediaControlLeftElement[];
1354
+ right: MediaControlRightElement[];
1355
+ default: MediaControlLayerElement[];
1356
+ seekEnabled: boolean;
1357
+ };
1358
+
1359
+ /**
1360
+ * @beta
1361
+ */
1362
+ export declare type MenuOption = {
1363
+ /**
1364
+ * Menu item label text. One of `label` or `labelKey` must be specified.
1365
+ */
1366
+ label?: string;
1367
+ /**
1368
+ * Menu item label localisation key, if specified, the `label` will be ignored
1369
+ */
1370
+ labelKey?: string;
1371
+ /**
1372
+ * Menu item name. Must be unique.
1373
+ */
1374
+ name: string;
1375
+ /**
1376
+ * Menu item handler function
1377
+ */
1378
+ handler?: () => void;
1379
+ /**
1380
+ * Menu item icon, plain HTML string
1381
+ */
1382
+ icon?: string;
1383
+ };
1438
1384
 
1439
1385
  /**
1440
1386
  * @beta
@@ -1681,13 +1627,14 @@ export declare type PlaybackModule = 'dash' | 'hls' | 'html5_video';
1681
1627
  * { value: 1, label: '1x' },
1682
1628
  * ],
1683
1629
  * defaultValue: 1,
1684
- * } as PlaybackRateSettings,
1630
+ * },
1685
1631
  * })
1686
1632
  * ```
1687
1633
  */
1688
1634
  export declare class PlaybackRate extends UICorePlugin {
1689
- private playbackRates;
1690
1635
  private selectedRate;
1636
+ private metadataLoaded;
1637
+ private mountTimerId;
1691
1638
  /**
1692
1639
  * @internal
1693
1640
  */
@@ -1701,6 +1648,7 @@ export declare class PlaybackRate extends UICorePlugin {
1701
1648
  private static readonly buttonTemplate;
1702
1649
  private static readonly listTemplate;
1703
1650
  constructor(core: Core);
1651
+ private get playbackRates();
1704
1652
  /**
1705
1653
  * @internal
1706
1654
  */
@@ -1722,17 +1670,22 @@ export declare class PlaybackRate extends UICorePlugin {
1722
1670
  private onActiveContainerChange;
1723
1671
  private onMediaControlRendered;
1724
1672
  private onGearRendered;
1725
- private addGearItem;
1673
+ private mount;
1726
1674
  private onMetaDataLoaded;
1727
1675
  private allRateElements;
1728
1676
  private rateElement;
1729
1677
  private onPlaybackRateChange;
1730
- private shouldRender;
1678
+ private shouldMount;
1731
1679
  /**
1732
1680
  * @internal
1733
1681
  */
1734
1682
  render(): this;
1683
+ /**
1684
+ * @internal
1685
+ */
1686
+ destroy(): UIObject;
1735
1687
  private onPlay;
1688
+ private syncRate;
1736
1689
  private resetPlaybackRate;
1737
1690
  private onStop;
1738
1691
  private onSelect;
@@ -2043,9 +1996,10 @@ export declare interface PlayerConfig extends Record<string, unknown> {
2043
1996
  */
2044
1997
  mute?: boolean;
2045
1998
  /**
2046
- * The type of playback (live stream or video on demand).
2047
- *
2048
- * @defaultValue 'vod'
1999
+ * Stream type.
2000
+ * @remark
2001
+ * Should only be set if known in advance, as it should not change once determined.
2002
+ * Otherwise it might cause inconsistencies in the UI plugins behavior, for instance, glitches with rendering of the DVR controls or seek bar.
2049
2003
  */
2050
2004
  playbackType?: PlaybackType;
2051
2005
  /**
@@ -2305,6 +2259,119 @@ export declare interface QualityLevel {
2305
2259
  bitrate: number;
2306
2260
  }
2307
2261
 
2262
+ /**
2263
+ * `PLUGIN` that provides a UI to select the desired quality level of the playback.
2264
+ * @beta
2265
+ *
2266
+ * @remarks
2267
+ * Depends on:
2268
+ *
2269
+ * - {@link MediaControl}
2270
+ *
2271
+ * - {@link BottomGear}
2272
+ *
2273
+ * The plugin is rendered as an item in the gear menu, which, when clicked, shows a list of quality levels to choose from.
2274
+ *
2275
+ * Configuration options - {@link QualityLevelsPluginSettings}
2276
+ *
2277
+ * @example
2278
+ * ```ts
2279
+ * new Player({
2280
+ * qualityLevels: {
2281
+ * restrictResolution: 360,
2282
+ * labels: { 360: 'SD', 720: 'HD' },
2283
+ * },
2284
+ * })
2285
+ * ```
2286
+ */
2287
+ declare class QualityLevels extends UICorePlugin {
2288
+ private levels;
2289
+ private levelLabels;
2290
+ private removeAuto;
2291
+ private isHd;
2292
+ private currentText;
2293
+ private selectedLevelId;
2294
+ private static readonly buttonTemplate;
2295
+ private static readonly listTemplate;
2296
+ /**
2297
+ * @internal
2298
+ */
2299
+ get name(): string;
2300
+ /**
2301
+ * @internal
2302
+ */
2303
+ get supportedVersion(): {
2304
+ min: string;
2305
+ };
2306
+ /**
2307
+ * @internal
2308
+ */
2309
+ static get version(): string;
2310
+ /**
2311
+ * @internal
2312
+ */
2313
+ get attributes(): {
2314
+ class: string;
2315
+ 'data-level-selector': string;
2316
+ };
2317
+ get events(): {
2318
+ 'click .gear-sub-menu_btn': string;
2319
+ 'click .go-back': string;
2320
+ };
2321
+ /**
2322
+ * @internal
2323
+ */
2324
+ bindEvents(): void;
2325
+ private onCoreReady;
2326
+ private onGearRendered;
2327
+ private onActiveContainerChange;
2328
+ private updateHd;
2329
+ private onStop;
2330
+ private shouldRender;
2331
+ /**
2332
+ * @internal
2333
+ */
2334
+ render(): this;
2335
+ private renderDropdown;
2336
+ private updateButton;
2337
+ private get pluginOptions();
2338
+ private get maxLevel();
2339
+ private onLevelsAvailable;
2340
+ private makeLevelsLabels;
2341
+ private onSelect;
2342
+ private goBack;
2343
+ private setLevel;
2344
+ private allLevelElements;
2345
+ private levelElement;
2346
+ private onLevelSwitchStart;
2347
+ private onLevelSwitchEnd;
2348
+ private updateText;
2349
+ private getLevelLabel;
2350
+ private onBitrate;
2351
+ private highlightCurrentLevel;
2352
+ }
2353
+ export { QualityLevels as LevelSelector }
2354
+ export { QualityLevels }
2355
+
2356
+ /**
2357
+ * Configuration options for the {@link QualityLevels} plugin.
2358
+ * @beta
2359
+ */
2360
+ export declare interface QualityLevelsPluginSettings {
2361
+ /**
2362
+ * The maximum resolution to allow in the level selector.
2363
+ */
2364
+ restrictResolution?: number;
2365
+ /**
2366
+ * The labels to show in the level selector.
2367
+ * @example
2368
+ * ```ts
2369
+ * { 360: 'SD', 720: 'HD' }
2370
+ * ```
2371
+ */
2372
+ labels?: Record<number, string>;
2373
+ }
2374
+
2308
2375
  export { reportError_2 as reportError }
2309
2376
 
2310
2377
  /**