@gcorevideo/player 2.24.14 → 2.25.0

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 (40) hide show
  1. package/assets/clips/clips.ejs +1 -1
  2. package/assets/clips/clips.scss +7 -5
  3. package/assets/media-control/width370.scss +3 -5
  4. package/dist/core.js +1 -1
  5. package/dist/index.css +870 -871
  6. package/dist/index.embed.js +171 -100
  7. package/dist/index.js +150 -78
  8. package/dist/player.d.ts +106 -42
  9. package/docs/api/player.md +18 -20
  10. package/docs/api/player.mediacontrol.defaultsettings.md +32 -0
  11. package/docs/api/player.mediacontrol.extendsettings.md +77 -0
  12. package/docs/api/player.mediacontrol.md +31 -11
  13. package/docs/api/player.mediacontrol.mount.md +8 -8
  14. package/docs/api/player.mediacontrol.slot.md +97 -0
  15. package/docs/api/player.mediacontrolelement.md +6 -3
  16. package/docs/api/player.mediacontrolpluginsettings.md +13 -0
  17. package/docs/api/player.mediacontrolsettings.md +5 -5
  18. package/docs/api/{player.mediacontrol.enablecontrolbutton.md → player.mediacontrolslotmountpoint.md} +4 -8
  19. package/docs/api/{player.mediacontrol.disabledcontrolbutton.md → player.standardmediacontrolelement.md} +4 -8
  20. package/lib/plugins/clips/Clips.d.ts +1 -0
  21. package/lib/plugins/clips/Clips.d.ts.map +1 -1
  22. package/lib/plugins/clips/Clips.js +16 -2
  23. package/lib/plugins/dvr-controls/DvrControls.js +1 -1
  24. package/lib/plugins/media-control/MediaControl.d.ts +87 -34
  25. package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
  26. package/lib/plugins/media-control/MediaControl.js +121 -76
  27. package/package.json +1 -1
  28. package/src/plugins/clips/Clips.ts +17 -2
  29. package/src/plugins/clips/__tests__/Clips.test.ts +1 -1
  30. package/src/plugins/clips/__tests__/__snapshots__/Clips.test.ts.snap +1 -1
  31. package/src/plugins/dvr-controls/DvrControls.ts +1 -1
  32. package/src/plugins/dvr-controls/__tests__/DvrControls.test.ts +1 -1
  33. package/src/plugins/media-control/MediaControl.ts +170 -141
  34. package/src/plugins/media-control/__tests__/MediaControl.test.ts +24 -17
  35. package/src/plugins/media-control/__tests__/__snapshots__/MediaControl.test.ts.snap +125 -93
  36. package/temp/player.api.json +186 -108
  37. package/tsconfig.tsbuildinfo +1 -1
  38. package/docs/api/player.mediacontrollayerelement.md +0 -16
  39. package/docs/api/player.mediacontrolleftelement.md +0 -16
  40. package/docs/api/player.mediacontrolrightelement.md +0 -16
@@ -2,35 +2,34 @@ import { UICorePlugin, Core } from '@clappr/core';
2
2
  import { ZeptoResult } from '../../types.js';
3
3
  import '../../../assets/media-control/media-control.scss';
4
4
  /**
5
- * Media control elements that appear in the left area.
6
- * @beta
7
- */
8
- export type MediaControlLeftElement = 'clipText' | 'duration' | 'dvr' | 'playpause' | 'playstop' | 'position' | 'volume' | 'clips';
9
- /**
10
- * Media control elements that appear in main layer, spanning the entire width of the player.
5
+ * Built-in media control elements.
11
6
  * @beta
12
7
  */
13
- export type MediaControlLayerElement = 'seekbar' | 'seekBarContainer' | '_';
8
+ export type StandardMediaControlElement = 'duration' | 'fullscreen' | 'hd-indicator' | 'playpause' | 'playstop' | 'position' | 'seekbar' | 'volume';
14
9
  /**
15
- * Media control elements that appear in the right area.
10
+ * Identifies a location for mounting custom media control elements.
16
11
  * @beta
17
12
  */
18
- export type MediaControlRightElement = 'audiotracks' | 'cc' | 'fullscreen' | 'hd-indicator' | 'gear' | 'multicamera' | 'pip' | 'vr';
13
+ export type MediaControlSlotMountPoint = 'root' | 'base' | 'left' | 'right' | 'center' | 'seekbar';
19
14
  /**
20
- * Built-in media control elements.
15
+ * Media control element.
16
+ * Each element's token in the media control layout settings determines where the element is rendered.
21
17
  * @beta
18
+ * @remarks
19
+ * Standard media control elements are defined in the {@link StandardMediaControlElement} type.
20
+ * Custom media control elements can be identified by a unique token.
22
21
  */
23
- export type MediaControlElement = MediaControlLeftElement | MediaControlLayerElement | MediaControlRightElement;
24
- export type MediaControlSlotSelector = 'root' | 'base' | 'left' | 'right' | 'center' | 'seekbar';
22
+ export type MediaControlElement = string;
25
23
  /**
26
- * Specifies the allowed media control elements in each area.
27
- * Can be used to restrict rendered media control elements.
24
+ * Specifies the layout of media control elements.
25
+ * Actual elements will be rendered according to the playback settings. Custom elements rendered by the plugins
26
+ * will be mounted at the specified locations.
28
27
  * @beta
29
28
  */
30
29
  export type MediaControlSettings = {
31
- left: MediaControlLeftElement[];
32
- right: MediaControlRightElement[];
33
- default: MediaControlLayerElement[];
30
+ left: MediaControlElement[];
31
+ right: MediaControlElement[];
32
+ default: MediaControlElement[];
34
33
  seekEnabled: boolean;
35
34
  };
36
35
  /**
@@ -41,26 +40,30 @@ export declare enum ExtendedEvents {
41
40
  MEDIACONTROL_VOLUME = "mediacontrol:volume",
42
41
  MEDIACONTROL_MENU_COLLAPSE = "mediacontrol:menu:collapse"
43
42
  }
43
+ export type MediaControlPluginSettings = {
44
+ hideMediaControlDelay?: number;
45
+ };
44
46
  /**
45
- * `PLUGIN` that provides basic playback controls UI and a foundation for developing custom UI.
47
+ * `PLUGIN` that provides framework for building media control UI.
46
48
  * @beta
47
49
  * @remarks
48
50
  * The methods exposed are to be used by the other plugins that extend the media control UI.
49
51
  *
50
- * Configuration options:
52
+ * Configuration options (root level)
53
+ *
54
+ * - `hideMediaControlDelay`: number - specifies the delay in milliseconds before the media control UI is hidden after the last user interaction
51
55
  *
52
- * - `mediaControl`: {@link MediaControlSettings} - specifies the allowed media control elements in each area
56
+ * - `mediaControl`: {@link MediaControlSettings} - specifies the media control dashboard layout
53
57
  *
54
58
  * - `persistConfig`: boolean - `common` option, makes the plugin persist the media control settings
55
59
  *
56
- * - `chromeless`: boolean
60
+ * - `chromeless`: boolean - `common` option, hides the media control UI
57
61
  */
58
62
  export declare class MediaControl extends UICorePlugin {
59
63
  private buttonsColor;
60
64
  private currentDurationValue;
61
65
  private currentPositionValue;
62
66
  private currentSeekBarPercentage;
63
- private disabledClickableList;
64
67
  private displayedDuration;
65
68
  private displayedPosition;
66
69
  private displayedSeekBarPercentage;
@@ -85,7 +88,6 @@ export declare class MediaControl extends UICorePlugin {
85
88
  private verticalVolume;
86
89
  private $duration;
87
90
  private $fullscreenToggle;
88
- private $multiCameraSelector;
89
91
  private $playPauseToggle;
90
92
  private $playStopToggle;
91
93
  private $position;
@@ -111,6 +113,42 @@ export declare class MediaControl extends UICorePlugin {
111
113
  get supportedVersion(): {
112
114
  min: string;
113
115
  };
116
+ /**
117
+ * @returns Default media control layout settings
118
+ * @remark
119
+ * The method can be used to change the default dashboard layout, for example, removing the standard UI elements
120
+ * @example
121
+ * ```ts
122
+ * const settings = MediaControl.defaultSettings()
123
+ * settings.left = settings.filter(item => item !== 'playpause' && item !== 'playstop')
124
+ * ...
125
+ * new Player({
126
+ * mediaControl: settings,
127
+ * })
128
+ * ```
129
+ */
130
+ static defaultSettings(): any;
131
+ /**
132
+ * Extend the default media control layout settings
133
+ * @param settings - Additional settings
134
+ * @returns The extended settings
135
+ * @remarks
136
+ * This method allows adding custom elements to the media control dashboard.
137
+ * The default settings are not modified.
138
+ * @example
139
+ * ```ts
140
+ * new Player({
141
+ * mediaControl: MediaControl.extendSettings({
142
+ * left: ['*'], // add all custom elements to the left panel
143
+ * }),
144
+ * })
145
+ * ```
146
+ */
147
+ static extendSettings(settings: Partial<MediaControlSettings>): {
148
+ left: string[];
149
+ right: string[];
150
+ default: string[];
151
+ };
114
152
  private get disabled();
115
153
  /**
116
154
  * Use in mediacontrol-based plugins to access the active container
@@ -244,10 +282,33 @@ export declare class MediaControl extends UICorePlugin {
244
282
  private onHdUpdate;
245
283
  private createCachedElements;
246
284
  /**
247
- * Get a media control element DOM node
285
+ * Mount a media control to its configured location
248
286
  * @param name - The name of the media control element
249
287
  * @param element - The DOM node/fragment to mount
250
- * @deprecated Use {@link MediaControl.mount} instead
288
+ * @remarks
289
+ * Media controls layout is configured via {@link MediaControlSettings}.
290
+ * A plugin implementing custom elements on the media control dashboard,
291
+ * should use this method to mount the element to the correct location.
292
+ * The actual location is defined by the occurence of the element token in the `left`, `right` or `default` section
293
+ * of the {@link MediaControlSettings}.
294
+ * @example
295
+ * ```ts
296
+ * class MyPlugin extends UICorePlugin {
297
+ * override render() {
298
+ * // mount the element where it is configured in the layout
299
+ * this.core.getPlugin('media_control').slot('my-element', this.$el)
300
+ * }
301
+ * }
302
+ * ...
303
+ * Player.registerPlugin(MyPlugin)
304
+ * ...
305
+ * // Configuration of the media control layout
306
+ * new Player({
307
+ * mediaControl: {
308
+ * left: ['my-element'], // the element will be mounted to the left panel
309
+ * },
310
+ * })
311
+ * ```
251
312
  */
252
313
  slot(name: MediaControlElement, element: ZeptoResult): void;
253
314
  /**
@@ -267,7 +328,7 @@ export declare class MediaControl extends UICorePlugin {
267
328
  * }
268
329
  * ```
269
330
  */
270
- mount(name: MediaControlSlotSelector, element: ZeptoResult): void;
331
+ mount(name: MediaControlSlotMountPoint, element: ZeptoResult): void;
271
332
  private getMountParent;
272
333
  /**
273
334
  * Toggle the visibility of a media control element
@@ -303,14 +364,6 @@ export declare class MediaControl extends UICorePlugin {
303
364
  private hideControllAds;
304
365
  private static getPageX;
305
366
  private static getPageY;
306
- /**
307
- * Enable the user interaction disabled earlier
308
- */
309
- enableControlButton(): void;
310
- /**
311
- * Disable the user interaction for the control buttons
312
- */
313
- disabledControlButton(): void;
314
367
  private isSeekEnabledForHtml5Playback;
315
368
  private getElementLocation;
316
369
  private onDvrStateChanged;
@@ -1 +1 @@
1
- {"version":3,"file":"MediaControl.d.ts","sourceRoot":"","sources":["../../../src/plugins/media-control/MediaControl.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,YAAY,EAMZ,IAAI,EACL,MAAM,cAAc,CAAA;AASrB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAI5C,OAAO,kDAAkD,CAAA;AAWzD;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAC/B,UAAU,GACV,UAAU,GACV,KAAK,GACL,WAAW,GAC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AC,WAAW;IAiCnB,OAAO,CAAC,gBAAgB;IAMxB;;OAEG;IACM,OAAO;IAUhB,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,SAAS;IAIjB;;OAEG;IACM,MAAM;IAsEf,OAAO,CAAC,qBAAqB;IAiB7B,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,MAAM,CAAC,QAAQ;IAIvB,OAAO,CAAC,MAAM,CAAC,QAAQ;IAevB,OAAO,CAAC,6BAA6B;IAQrC,OAAO,CAAC,kBAAkB;IAgB1B,OAAO,CAAC,iBAAiB;CAO1B"}
@@ -20,26 +20,24 @@ import volumeMaxIcon from '../../../assets/icons/new/volume-max.svg';
20
20
  import volumeOffIcon from '../../../assets/icons/new/volume-off.svg';
21
21
  import fullscreenOffIcon from '../../../assets/icons/new/fullscreen-off.svg';
22
22
  import fullscreenOnIcon from '../../../assets/icons/new/fullscreen-on.svg';
23
- const MANAGED_ELEMENTS = [
24
- 'dvr',
23
+ const STANDARD_MEDIA_CONTROL_ELEMENTS = [
25
24
  'duration',
26
25
  'fullscreen',
27
26
  'hd-indicator',
27
+ 'playpause',
28
+ 'playstop',
28
29
  'position',
29
30
  'seekbar',
30
31
  'volume',
31
32
  ];
33
+ // TODO export
32
34
  const DEFAULT_SETTINGS = {
33
- default: [],
34
- left: ['dvr'],
35
+ default: ['seekbar'],
36
+ left: ['playpause', 'playstop', 'position', 'duration', 'volume'],
35
37
  right: [
36
- 'audiotracks',
37
- 'cc',
38
+ '*',
39
+ // 'hd-indicator',
38
40
  'fullscreen',
39
- 'gear',
40
- 'multicamera',
41
- 'pip',
42
- 'vr',
43
41
  ],
44
42
  seekEnabled: true,
45
43
  };
@@ -50,14 +48,6 @@ const INITIAL_SETTINGS = {
50
48
  seekEnabled: false,
51
49
  };
52
50
  const T = 'plugins.media_control';
53
- const LEFT_ORDER = [
54
- 'playpause',
55
- 'playstop',
56
- 'volume',
57
- 'position',
58
- 'duration',
59
- 'dvr',
60
- ];
61
51
  /**
62
52
  * Extended events for the {@link MediaControl} plugin
63
53
  * @beta
@@ -68,25 +58,21 @@ export var ExtendedEvents;
68
58
  ExtendedEvents["MEDIACONTROL_MENU_COLLAPSE"] = "mediacontrol:menu:collapse";
69
59
  })(ExtendedEvents || (ExtendedEvents = {}));
70
60
  const { Config, Fullscreen, formatTime, extend, removeArrayItem } = Utils;
71
- function orderByOrderPattern(arr, order) {
72
- const arrWithoutDuplicates = [...new Set(arr)];
73
- const ordered = order.filter((item) => arrWithoutDuplicates.includes(item));
74
- const rest = arrWithoutDuplicates.filter((item) => !order.includes(item));
75
- return [...ordered, ...rest];
76
- }
77
61
  /**
78
- * `PLUGIN` that provides basic playback controls UI and a foundation for developing custom UI.
62
+ * `PLUGIN` that provides framework for building media control UI.
79
63
  * @beta
80
64
  * @remarks
81
65
  * The methods exposed are to be used by the other plugins that extend the media control UI.
82
66
  *
83
- * Configuration options:
67
+ * Configuration options (root level)
84
68
  *
85
- * - `mediaControl`: {@link MediaControlSettings} - specifies the allowed media control elements in each area
69
+ * - `hideMediaControlDelay`: number - specifies the delay in milliseconds before the media control UI is hidden after the last user interaction
70
+ *
71
+ * - `mediaControl`: {@link MediaControlSettings} - specifies the media control dashboard layout
86
72
  *
87
73
  * - `persistConfig`: boolean - `common` option, makes the plugin persist the media control settings
88
74
  *
89
- * - `chromeless`: boolean
75
+ * - `chromeless`: boolean - `common` option, hides the media control UI
90
76
  */
91
77
  export class MediaControl extends UICorePlugin {
92
78
  // private advertisementPlaying = false
@@ -94,7 +80,7 @@ export class MediaControl extends UICorePlugin {
94
80
  currentDurationValue = 0;
95
81
  currentPositionValue = 0;
96
82
  currentSeekBarPercentage = 0;
97
- disabledClickableList = [];
83
+ // private disabledClickableList: DisabledClickable[] = []
98
84
  displayedDuration = null;
99
85
  displayedPosition = null;
100
86
  displayedSeekBarPercentage = null;
@@ -119,7 +105,6 @@ export class MediaControl extends UICorePlugin {
119
105
  verticalVolume = false;
120
106
  $duration = null;
121
107
  $fullscreenToggle = null;
122
- $multiCameraSelector = null;
123
108
  $playPauseToggle = null;
124
109
  $playStopToggle = null;
125
110
  $position = null;
@@ -147,6 +132,46 @@ export class MediaControl extends UICorePlugin {
147
132
  get supportedVersion() {
148
133
  return { min: CLAPPR_VERSION };
149
134
  }
135
+ /**
136
+ * @returns Default media control layout settings
137
+ * @remark
138
+ * The method can be used to change the default dashboard layout, for example, removing the standard UI elements
139
+ * @example
140
+ * ```ts
141
+ * const settings = MediaControl.defaultSettings()
142
+ * settings.left = settings.filter(item => item !== 'playpause' && item !== 'playstop')
143
+ * ...
144
+ * new Player({
145
+ * mediaControl: settings,
146
+ * })
147
+ * ```
148
+ */
149
+ static defaultSettings() {
150
+ return $.extend(true, {}, DEFAULT_SETTINGS);
151
+ }
152
+ /**
153
+ * Extend the default media control layout settings
154
+ * @param settings - Additional settings
155
+ * @returns The extended settings
156
+ * @remarks
157
+ * This method allows adding custom elements to the media control dashboard.
158
+ * The default settings are not modified.
159
+ * @example
160
+ * ```ts
161
+ * new Player({
162
+ * mediaControl: MediaControl.extendSettings({
163
+ * left: ['*'], // add all custom elements to the left panel
164
+ * }),
165
+ * })
166
+ * ```
167
+ */
168
+ static extendSettings(settings) {
169
+ return {
170
+ left: mergeElements(DEFAULT_SETTINGS.left, settings.left ?? []),
171
+ right: mergeElements(DEFAULT_SETTINGS.right, settings.right ?? []),
172
+ default: mergeElements(DEFAULT_SETTINGS.default, settings.default ?? []),
173
+ };
174
+ }
150
175
  get disabled() {
151
176
  const playbackIsNOOP = this.core.activeContainer &&
152
177
  this.core.activeContainer.getPlaybackType() === Playback.NO_OP;
@@ -410,9 +435,7 @@ export class MediaControl extends UICorePlugin {
410
435
  this.applyButtonStyle(this.$volumeIcon);
411
436
  }
412
437
  changeTogglePlay() {
413
- // assert.ok(this.$playPauseToggle, 'play/pause toggle must be present');
414
438
  this.$playPauseToggle?.html('');
415
- // assert.ok(this.$playStopToggle, 'play/stop toggle must be present');
416
439
  this.$playStopToggle?.html('');
417
440
  if (this.container && this.container.isPlaying()) {
418
441
  this.$playPauseToggle?.append(pauseIcon);
@@ -778,36 +801,32 @@ export class MediaControl extends UICorePlugin {
778
801
  }
779
802
  }
780
803
  updateSettings() {
781
- const newSettings = $.extend(true, {
804
+ // TODO use this.options.mediaControl to additionally filter the settings
805
+ const container = $.extend(true, {
782
806
  left: [],
783
807
  default: [],
784
808
  right: [],
785
809
  }, this.core.activeContainer.settings);
786
- newSettings.left.push('clips'); // TODO settings
787
- // TODO make order controlled via CSS
788
- newSettings.left = orderByOrderPattern([...newSettings.left, 'volume', 'clips'], LEFT_ORDER);
789
- if (this.core.activePlayback.getPlaybackType() === Playback.LIVE &&
790
- this.core.activePlayback.dvrEnabled) {
791
- newSettings.left.push('dvr');
792
- }
793
- // actual order of the items appear rendered is controlled by CSS
794
- newSettings.right = DEFAULT_SETTINGS.right; // TODO get from the options
810
+ container.left.push('volume');
811
+ const setup = this.options.mediaControl ?? DEFAULT_SETTINGS;
795
812
  if ((!this.fullScreenOnVideoTagSupported && !fullscreenEnabled()) ||
796
813
  this.options.fullscreenDisable) {
797
814
  // remove fullscreen from settings if it is not available
798
- removeArrayItem(newSettings.default, 'fullscreen');
799
- removeArrayItem(newSettings.left, 'fullscreen');
800
- removeArrayItem(newSettings.right, 'fullscreen');
815
+ removeArrayItem(container.default, 'fullscreen');
816
+ removeArrayItem(container.left, 'fullscreen');
817
+ removeArrayItem(container.right, 'fullscreen');
801
818
  }
802
- removeArrayItem(newSettings.default, 'hd-indicator');
803
- removeArrayItem(newSettings.left, 'hd-indicator');
804
819
  // TODO get from container's settings
805
820
  if (this.core.activePlayback.name === 'html5_video') {
806
- newSettings.seekEnabled = this.isSeekEnabledForHtml5Playback();
821
+ container.seekEnabled = this.isSeekEnabledForHtml5Playback();
822
+ // TODO remove seekbar if seek is disabled?
807
823
  }
808
- const settingsChanged = !isEqualSettings(this.settings, newSettings);
824
+ container.left = evalSettings(container.left, setup.left);
825
+ container.right = evalSettings(container.right, setup.right);
826
+ container.default = evalSettings(container.default, setup.default);
827
+ const settingsChanged = !isEqualSettings(this.settings, container);
809
828
  if (settingsChanged) {
810
- this.settings = newSettings;
829
+ this.settings = container;
811
830
  this.hasUpdate = true;
812
831
  this.render();
813
832
  }
@@ -833,15 +852,37 @@ export class MediaControl extends UICorePlugin {
833
852
  this.$volumeBarBackground = this.$el.find('.bar-background[data-volume]');
834
853
  this.$volumeBarFill = this.$el.find('.bar-fill-1[data-volume]');
835
854
  this.$volumeBarScrubber = this.$el.find('.bar-scrubber[data-volume]');
836
- this.$multiCameraSelector = this.$el.find('.media-control-multicamera[data-multicamera]');
837
855
  this.resetIndicators();
838
856
  this.initializeIcons();
839
857
  }
840
858
  /**
841
- * Get a media control element DOM node
859
+ * Mount a media control to its configured location
842
860
  * @param name - The name of the media control element
843
861
  * @param element - The DOM node/fragment to mount
844
- * @deprecated Use {@link MediaControl.mount} instead
862
+ * @remarks
863
+ * Media controls layout is configured via {@link MediaControlSettings}.
864
+ * A plugin implementing custom elements on the media control dashboard,
865
+ * should use this method to mount the element to the correct location.
866
+ * The actual location is defined by the occurence of the element token in the `left`, `right` or `default` section
867
+ * of the {@link MediaControlSettings}.
868
+ * @example
869
+ * ```ts
870
+ * class MyPlugin extends UICorePlugin {
871
+ * override render() {
872
+ * // mount the element where it is configured in the layout
873
+ * this.core.getPlugin('media_control').slot('my-element', this.$el)
874
+ * }
875
+ * }
876
+ * ...
877
+ * Player.registerPlugin(MyPlugin)
878
+ * ...
879
+ * // Configuration of the media control layout
880
+ * new Player({
881
+ * mediaControl: {
882
+ * left: ['my-element'], // the element will be mounted to the left panel
883
+ * },
884
+ * })
885
+ * ```
845
886
  */
846
887
  slot(name, element) {
847
888
  const panel = this.getElementLocation(name);
@@ -1061,7 +1102,6 @@ export class MediaControl extends UICorePlugin {
1061
1102
  return this;
1062
1103
  }
1063
1104
  const timeout = this.options.hideMediaControlDelay || 2000;
1064
- trace(`${T} render`, { settings: this.settings });
1065
1105
  this.$el.html(MediaControl.template({ settings: this.settings }));
1066
1106
  // const style = Styler.getStyleFor(mediaControlStyle, { baseUrl: this.options.baseUrl });
1067
1107
  // this.$el.append(style[0]);
@@ -1158,22 +1198,6 @@ export class MediaControl extends UICorePlugin {
1158
1198
  }
1159
1199
  return 0;
1160
1200
  }
1161
- /**
1162
- * Enable the user interaction disabled earlier
1163
- */
1164
- enableControlButton() {
1165
- this.disabledClickableList.forEach((element) => {
1166
- element.el.css({ 'pointer-events': element.pointerEventValue });
1167
- });
1168
- }
1169
- /**
1170
- * Disable the user interaction for the control buttons
1171
- */
1172
- disabledControlButton() {
1173
- this.disabledClickableList.forEach((element) => {
1174
- element.el.css({ 'pointer-events': 'none' });
1175
- });
1176
- }
1177
1201
  // TODO drop
1178
1202
  isSeekEnabledForHtml5Playback() {
1179
1203
  if (this.core.getPlaybackType() === Playback.LIVE) {
@@ -1182,13 +1206,14 @@ export class MediaControl extends UICorePlugin {
1182
1206
  return isFinite(this.core.activePlayback.getDuration());
1183
1207
  }
1184
1208
  getElementLocation(name) {
1185
- if (this.settings.right?.includes(name)) {
1186
- return this.getRightPanel();
1187
- }
1188
- if (this.settings.left?.includes(name)) {
1209
+ if (this.settings.left.includes(name) || this.settings.left.includes('*')) {
1189
1210
  return this.getLeftPanel();
1190
1211
  }
1191
- if (this.settings.default?.includes(name)) {
1212
+ if (this.settings.right.includes(name) ||
1213
+ this.settings.right.includes('*')) {
1214
+ return this.getRightPanel();
1215
+ }
1216
+ if (this.settings.default.includes(name)) {
1192
1217
  return this.getCenterPanel();
1193
1218
  }
1194
1219
  return null;
@@ -1206,7 +1231,8 @@ MediaControl.extend = function (properties) {
1206
1231
  return extend(MediaControl, properties);
1207
1232
  };
1208
1233
  function serializeSettings(s) {
1209
- return s.left.slice()
1234
+ return s.left
1235
+ .slice()
1210
1236
  .sort()
1211
1237
  .concat(s.right.slice().sort())
1212
1238
  .concat(s.default.slice().sort())
@@ -1221,3 +1247,22 @@ function mountTo(parent, element) {
1221
1247
  parent.append(element);
1222
1248
  }
1223
1249
  }
1250
+ function isStandardMediaControl(name) {
1251
+ return STANDARD_MEDIA_CONTROL_ELEMENTS.includes(name);
1252
+ }
1253
+ function evalSettings(container, setup) {
1254
+ return setup.filter((item) => {
1255
+ if (isStandardMediaControl(item)) {
1256
+ return container.includes(item);
1257
+ }
1258
+ return true;
1259
+ });
1260
+ }
1261
+ function mergeElements(a, b) {
1262
+ return b.reduce((acc, item) => {
1263
+ if (!acc.includes(item)) {
1264
+ acc.push(item);
1265
+ }
1266
+ return acc;
1267
+ }, a);
1268
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gcorevideo/player",
3
- "version": "2.24.14",
3
+ "version": "2.25.0",
4
4
  "description": "Gcore JavaScript video player",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -26,6 +26,8 @@ export interface ClipsPluginSettings {
26
26
  const VERSION = '2.22.16'
27
27
  const CLAPPR_VERSION = '0.11.4'
28
28
 
29
+ const COMPACT_WIDTH = 495;
30
+
29
31
  /**
30
32
  * `PLUGIN` that allows marking up the timeline of the video
31
33
  * @beta
@@ -61,7 +63,7 @@ export class Clips extends UICorePlugin {
61
63
  */
62
64
  override get attributes() {
63
65
  return {
64
- class: 'media-control-clips',
66
+ class: 'media-control-clips gplayer-mc-clips',
65
67
  }
66
68
  }
67
69
 
@@ -145,6 +147,7 @@ export class Clips extends UICorePlugin {
145
147
  private onContainerChanged() {
146
148
  trace(`${T} onContainerChanged`)
147
149
  // TODO figure out the conditions of changing the container (without destroying the previous one)
150
+ // probably it is the case with the MultiCamera plugin
148
151
  if (this.oldContainer) {
149
152
  this.stopListening(
150
153
  this.oldContainer,
@@ -162,13 +165,25 @@ export class Clips extends UICorePlugin {
162
165
  Events.CONTAINER_TIMEUPDATE,
163
166
  this.onTimeUpdate,
164
167
  )
168
+ this.toggleCompact()
165
169
  }
166
170
 
167
171
  private playerResize() {
168
172
  const duration = this.core.activeContainer.getDuration()
173
+ // TODO check
169
174
  if (duration) {
170
175
  this.makeSvg(duration)
171
176
  }
177
+ this.toggleCompact()
178
+ }
179
+
180
+ private toggleCompact() {
181
+ const elText = this.$el.find('#gplayer-mc-clips-text')
182
+ if (this.core.activeContainer.el.clientWidth <= COMPACT_WIDTH) {
183
+ elText.addClass('compact')
184
+ } else {
185
+ elText.removeClass('compact')
186
+ }
172
187
  }
173
188
 
174
189
  private onTimeUpdate(event: TimeProgress) {
@@ -218,7 +233,7 @@ export class Clips extends UICorePlugin {
218
233
 
219
234
  private setClipText(text: string) {
220
235
  if (text) {
221
- this.$el.show().find('#clips-text').text(text)
236
+ this.$el.show().find('#gplayer-mc-clips-text').text(text)
222
237
  } else {
223
238
  this.$el.hide()
224
239
  }
@@ -57,7 +57,7 @@ describe('Clips', () => {
57
57
  })
58
58
  })
59
59
  it(`text should be "${expected}"`, () => {
60
- expect(clips.$el.find('#clips-text').text()).toBe(expected)
60
+ expect(clips.$el.find('#gplayer-mc-clips-text').text()).toBe(expected)
61
61
  })
62
62
  })
63
63
  })
@@ -1,7 +1,7 @@
1
1
  // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
3
  exports[`Clips > should render indicator 1`] = `
4
- "<div class="media-clip-text" id="clips-text">Introduction</div><svg width="0" height="0">
4
+ "<div class="gplayer-mc-clips-text compact" id="gplayer-mc-clips-text">Introduction</div><svg width="0" height="0">
5
5
  <defs>
6
6
  <clipPath id="myClip">
7
7
  <rect x="0" y="0" width="148" height="30"></rect>
@@ -131,7 +131,7 @@ export class DvrControls extends UICorePlugin {
131
131
  // TODO -> to MediaControl (auto hide)
132
132
  mediaControl.toggleElement('duration', false)
133
133
  mediaControl.toggleElement('position', false)
134
- mediaControl.mount('left', this.$el) // TODO use independent mount point
134
+ mediaControl.slot('dvr', this.$el) // TODO use independent mount point
135
135
  }
136
136
 
137
137
  private onDvrStateChanged(dvrInUse: boolean) {
@@ -72,7 +72,7 @@ describe('DvrControls', () => {
72
72
  )
73
73
  })
74
74
  it('should mount to the media control', () => {
75
- expect(mediaControl.mount).toHaveBeenCalledWith('left', dvrControls.$el)
75
+ expect(mediaControl.slot).toHaveBeenCalledWith('dvr', dvrControls.$el)
76
76
  })
77
77
  if (dvrEnabled) {
78
78
  if (dvrInUse) {