@gcorevideo/player 2.20.6 → 2.20.7

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 (34) hide show
  1. package/dist/core.js +1 -1
  2. package/dist/index.css +662 -662
  3. package/dist/index.js +5143 -5123
  4. package/dist/plugins/index.css +524 -524
  5. package/dist/plugins/index.js +5111 -5096
  6. package/lib/plugins/bottom-gear/BottomGear.d.ts.map +1 -1
  7. package/lib/plugins/bottom-gear/BottomGear.js +5 -8
  8. package/lib/plugins/level-selector/LevelSelector.d.ts +15 -5
  9. package/lib/plugins/level-selector/LevelSelector.d.ts.map +1 -1
  10. package/lib/plugins/level-selector/LevelSelector.js +22 -22
  11. package/lib/plugins/media-control/MediaControl.d.ts +10 -0
  12. package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
  13. package/lib/plugins/media-control/MediaControl.js +11 -0
  14. package/lib/plugins/source-controller/SourceController.d.ts +1 -0
  15. package/lib/plugins/source-controller/SourceController.d.ts.map +1 -1
  16. package/lib/plugins/source-controller/SourceController.js +8 -4
  17. package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.d.ts +7 -3
  18. package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.d.ts.map +1 -1
  19. package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.js +35 -27
  20. package/lib/testUtils.d.ts +5 -8
  21. package/lib/testUtils.d.ts.map +1 -1
  22. package/lib/testUtils.js +15 -9
  23. package/package.json +1 -1
  24. package/src/plugins/bottom-gear/BottomGear.ts +5 -7
  25. package/src/plugins/bottom-gear/__tests__/BottomGear.test.ts +36 -0
  26. package/src/plugins/bottom-gear/__tests__/__snapshots__/BottomGear.test.ts.snap +41 -0
  27. package/src/plugins/level-selector/LevelSelector.ts +50 -29
  28. package/src/plugins/level-selector/__tests__/LevelSelector.test.ts +15 -16
  29. package/src/plugins/media-control/MediaControl.ts +11 -0
  30. package/src/plugins/source-controller/SourceController.ts +9 -4
  31. package/src/plugins/source-controller/__tests__/SourceController.test.ts +35 -1
  32. package/src/plugins/spinner-three-bounce/SpinnerThreeBounce.ts +80 -57
  33. package/src/testUtils.ts +16 -9
  34. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"BottomGear.d.ts","sourceRoot":"","sources":["../../../src/plugins/bottom-gear/BottomGear.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAoC,MAAM,cAAc,CAAC;AAO9E,OAAO,uCAAuC,CAAC;AAC/C,OAAO,gDAAgD,CAAC;AAGxD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAMnD;;;GAGG;AACH,oBAAY,UAAU;IACpB;;OAEG;IACH,0BAA0B,+BAA+B;CAC1D;AAED;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAE1D;;;;;;;;;GASG;AACH,qBAAa,UAAW,SAAQ,YAAY;IAC1C,OAAO,CAAC,IAAI,CAAS;IAErB;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED;;OAEG;IACH,MAAM,KAAK,OAAO,WAEjB;IAED,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAuB;IAEvD;;OAEG;IACH,IAAa,UAAU;;;MAKtB;IAED;;OAEG;IACH,IAAa,MAAM;;MAIlB;IAED;;OAEG;IACM,UAAU;IAUnB;;;OAGG;IACH,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,WAAW,GAAG,IAAI;IAIrD;;;OAGG;IACH,UAAU,CAAC,OAAO,EAAE,WAAW;IAI/B,OAAO,CAAC,wBAAwB;IAKhC,OAAO,CAAC,mBAAmB;IAK3B,OAAO,CAAC,oBAAoB;IAU5B;;OAEG;IACM,MAAM;IAmBf,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,IAAI;CAGb"}
1
+ {"version":3,"file":"BottomGear.d.ts","sourceRoot":"","sources":["../../../src/plugins/bottom-gear/BottomGear.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAoC,MAAM,cAAc,CAAC;AAO9E,OAAO,uCAAuC,CAAC;AAC/C,OAAO,gDAAgD,CAAC;AAGxD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAOnD;;;GAGG;AACH,oBAAY,UAAU;IACpB;;OAEG;IACH,0BAA0B,+BAA+B;CAC1D;AAED;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAE1D;;;;;;;;;GASG;AACH,qBAAa,UAAW,SAAQ,YAAY;IAC1C,OAAO,CAAC,IAAI,CAAS;IAErB;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED;;OAEG;IACH,MAAM,KAAK,OAAO,WAEjB;IAED,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAuB;IAEvD;;OAEG;IACH,IAAa,UAAU;;;MAKtB;IAED;;OAEG;IACH,IAAa,MAAM;;MAIlB;IAED;;OAEG;IACM,UAAU;IAUnB;;;OAGG;IACH,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,WAAW,GAAG,IAAI;IAIrD;;;OAGG;IACH,UAAU,CAAC,OAAO,EAAE,WAAW;IAI/B,OAAO,CAAC,wBAAwB;IAKhC,OAAO,CAAC,mBAAmB;IAK3B,OAAO,CAAC,oBAAoB;IAM5B;;OAEG;IACM,MAAM;IAoBf,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,IAAI;CAGb"}
@@ -7,6 +7,7 @@ import '../../../assets/bottom-gear/gear.scss';
7
7
  import '../../../assets/bottom-gear/gear-sub-menu.scss';
8
8
  import gearIcon from '../../../assets/icons/new/gear.svg';
9
9
  import gearHdIcon from '../../../assets/icons/new/gear-hd.svg';
10
+ import { MediaControlEvents } from '../media-control/MediaControl';
10
11
  const VERSION = '2.19.12';
11
12
  const T = 'plugins.bottom_gear';
12
13
  /**
@@ -102,14 +103,9 @@ export class BottomGear extends UICorePlugin {
102
103
  this.listenTo(this.core.activeContainer, ClapprEvents.CONTAINER_HIGHDEFINITIONUPDATE, this.highDefinitionUpdate);
103
104
  }
104
105
  highDefinitionUpdate(isHd) {
105
- trace(`${this.name} highDefinitionUpdate`, { isHd });
106
+ trace(`${T} highDefinitionUpdate`, { isHd });
106
107
  this.isHd = isHd;
107
- if (isHd) {
108
- this.$el.find('.gear-icon').html(gearHdIcon);
109
- }
110
- else {
111
- this.$el.find('.gear-icon').html(gearIcon);
112
- }
108
+ this.$el.find('.gear-icon').html(isHd ? gearHdIcon : gearIcon);
113
109
  }
114
110
  /**
115
111
  * @internal
@@ -127,7 +123,8 @@ export class BottomGear extends UICorePlugin {
127
123
  this.$el.html(BottomGear.template({ icon, items }));
128
124
  mediaControl.getElement('gear')?.html(this.el);
129
125
  this.core.trigger('gear:rendered'); // @deprecated
130
- mediaControl.trigger(GearEvents.MEDIACONTROL_GEAR_RENDERED);
126
+ mediaControl.trigger(GearEvents.MEDIACONTROL_GEAR_RENDERED); // TODO drop
127
+ mediaControl.trigger(MediaControlEvents.MEDIACONTROL_GEAR_RENDERED);
131
128
  return this;
132
129
  }
133
130
  refresh() {
@@ -1,5 +1,19 @@
1
1
  import { UICorePlugin } from '@clappr/core';
2
2
  import '../../../assets/level-selector/style.scss';
3
+ export interface LevelSelectorPluginSettings {
4
+ /**
5
+ * The maximum resolution to allow in the level selector.
6
+ */
7
+ restrictResolution?: number;
8
+ /**
9
+ * The labels to show in the level selector.
10
+ * @example
11
+ * ```ts
12
+ * { 360: 'SD', 720: 'HD' }
13
+ * ```
14
+ */
15
+ labels?: Record<number, string>;
16
+ }
3
17
  /**
4
18
  * A {@link MediaControl | media control} plugin that provides a UI to control the quality level of the playback.
5
19
  * @beta
@@ -15,11 +29,7 @@ import '../../../assets/level-selector/style.scss';
15
29
  *
16
30
  * When clicked, it shows a list of quality levels to choose from.
17
31
  *
18
- * Configuration options:
19
- *
20
- * - `labels`: The labels to show in the level selector. [video resolution]: string
21
- *
22
- * - `restrictResolution`: The maximum resolution to allow in the level selector.
32
+ * Configuration options - {@link LevelSelectorPluginSettings}
23
33
  *
24
34
  * @example
25
35
  * ```ts
@@ -1 +1 @@
1
- {"version":3,"file":"LevelSelector.d.ts","sourceRoot":"","sources":["../../../src/plugins/level-selector/LevelSelector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,YAAY,EAAE,MAAM,cAAc,CAAA;AAe7D,OAAO,2CAA2C,CAAA;AAOlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,aAAc,SAAQ,YAAY;IAC7C,OAAO,CAAC,MAAM,CAAqB;IAEnC,OAAO,CAAC,WAAW,CAAe;IAElC,OAAO,CAAC,UAAU,CAAQ;IAE1B,OAAO,CAAC,IAAI,CAAQ;IAEpB,OAAO,CAAC,MAAM,CAAQ;IAEtB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAyC;IAE/E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAuC;IAE3E;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED;;OAEG;IACH,MAAM,KAAK,OAAO,WAEjB;IAED;;OAEG;IACH,IAAa,UAAU;;;MAKtB;IAED,OAAO,CAAC,WAAW,CAAS;IAE5B,OAAO,CAAC,eAAe,CAAK;IAE5B,IAAa,MAAM;;;;MAMlB;IAED;;OAEG;IACM,UAAU;IAKnB,OAAO,CAAC,kBAAkB;IAsC1B,OAAO,CAAC,MAAM;IAcd,OAAO,CAAC,YAAY;IAmBpB;;OAEG;IACM,MAAM;IAYf,OAAO,CAAC,YAAY;IAcpB,OAAO,CAAC,cAAc;IActB,OAAO,KAAK,QAAQ,G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IACH,IAAa,UAAU;;;MAKtB;IAED,OAAO,CAAC,WAAW,CAAS;IAE5B,OAAO,CAAC,eAAe,CAAK;IAE5B,IAAa,MAAM;;;;MAMlB;IAED;;OAEG;IACM,UAAU;IAUnB,OAAO,CAAC,kBAAkB;IAwC1B,OAAO,CAAC,MAAM;IAcd,OAAO,CAAC,YAAY;IAcpB;;OAEG;IACM,MAAM;IAUf,OAAO,CAAC,YAAY;IAiBpB,OAAO,CAAC,cAAc;IAetB,OAAO,KAAK,QAAQ,GASnB;IAED,OAAO,CAAC,UAAU;IAkBlB,OAAO,CAAC,gBAAgB;IAYxB,OAAO,CAAC,aAAa;IAUrB,OAAO,CAAC,MAAM;IAOd,OAAO,CAAC,QAAQ;IAmBhB,OAAO,CAAC,qBAAqB;IAO7B,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,qBAAqB;IAe7B,OAAO,CAAC,WAAW,CAAmC;CACvD"}
@@ -1,5 +1,6 @@
1
1
  import { Events, template, UICorePlugin } from '@clappr/core';
2
2
  import { reportError, trace } from '@gcorevideo/utils';
3
+ import assert from 'assert';
3
4
  import { CLAPPR_VERSION } from '../../build.js';
4
5
  import buttonHtml from '../../../assets/level-selector/button.ejs';
5
6
  import listHtml from '../../../assets/level-selector/list.ejs';
@@ -8,7 +9,6 @@ import arrowRightIcon from '../../../assets/icons/new/arrow-right.svg';
8
9
  import arrowLeftIcon from '../../../assets/icons/new/arrow-left.svg';
9
10
  import checkIcon from '../../../assets/icons/new/check.svg';
10
11
  import '../../../assets/level-selector/style.scss';
11
- import assert from 'assert';
12
12
  const T = 'plugins.level_selector';
13
13
  const VERSION = '2.19.4';
14
14
  /**
@@ -26,11 +26,7 @@ const VERSION = '2.19.4';
26
26
  *
27
27
  * When clicked, it shows a list of quality levels to choose from.
28
28
  *
29
- * Configuration options:
30
- *
31
- * - `labels`: The labels to show in the level selector. [video resolution]: string
32
- *
33
- * - `restrictResolution`: The maximum resolution to allow in the level selector.
29
+ * Configuration options - {@link LevelSelectorPluginSettings}
34
30
  *
35
31
  * @example
36
32
  * ```ts
@@ -90,14 +86,15 @@ export class LevelSelector extends UICorePlugin {
90
86
  * @internal
91
87
  */
92
88
  bindEvents() {
93
- this.listenTo(this.core, Events.CORE_ACTIVE_CONTAINER_CHANGED, () => this.bindPlaybackEvents());
94
- this.listenTo(this.core, 'gear:rendered', this.render);
89
+ const mediaControl = this.core.getPlugin('media_control');
90
+ assert(mediaControl, 'media_control plugin is required');
91
+ this.listenTo(this.core, Events.CORE_ACTIVE_CONTAINER_CHANGED, this.bindPlaybackEvents);
95
92
  }
96
93
  bindPlaybackEvents() {
97
94
  this.removeAuto = false;
98
95
  this.isHd = false;
99
96
  const activePlayback = this.core.activePlayback;
100
- this.listenTo(activePlayback, Events.PLAYBACK_LEVELS_AVAILABLE, (levels) => this.fillLevels(levels));
97
+ this.listenTo(activePlayback, Events.PLAYBACK_LEVELS_AVAILABLE, this.fillLevels);
101
98
  this.listenTo(activePlayback, Events.PLAYBACK_LEVEL_SWITCH_START, this.onLevelSwitchStart);
102
99
  this.listenTo(activePlayback, Events.PLAYBACK_LEVEL_SWITCH_END, this.onLevelSwitchEnd);
103
100
  this.listenTo(activePlayback, Events.PLAYBACK_BITRATE, this.updateCurrentLevel);
@@ -106,26 +103,24 @@ export class LevelSelector extends UICorePlugin {
106
103
  this.isHd = isHd;
107
104
  this.deferRender();
108
105
  });
109
- if (activePlayback?.levels?.length > 0) {
106
+ if (activePlayback.levels?.length > 0) {
110
107
  this.fillLevels(activePlayback.levels);
111
108
  }
112
109
  }
113
110
  onStop() {
114
111
  trace(`${T} onStop`);
115
- const currentPlayback = this.core.activePlayback;
116
- this.listenToOnce(currentPlayback, Events.PLAYBACK_PLAY, () => {
117
- trace(`${T} on PLAYBACK_PLAY after stop`, { selectedLevelId: this.selectedLevelId });
118
- if (currentPlayback.getPlaybackType() === 'live') {
112
+ this.listenToOnce(this.core.activePlayback, Events.PLAYBACK_PLAY, () => {
113
+ trace(`${T} on PLAYBACK_PLAY after stop`, {
114
+ selectedLevelId: this.selectedLevelId,
115
+ });
116
+ if (this.core.activePlayback.getPlaybackType() === 'live') {
119
117
  if (this.selectedLevelId !== -1) {
120
- currentPlayback.currentLevel = this.selectedLevelId;
118
+ this.core.activePlayback.currentLevel = this.selectedLevelId;
121
119
  }
122
120
  }
123
121
  });
124
122
  }
125
123
  shouldRender() {
126
- if (!this.core.activeContainer) {
127
- return false;
128
- }
129
124
  const activePlayback = this.core.activePlayback;
130
125
  if (!activePlayback) {
131
126
  return false;
@@ -141,7 +136,6 @@ export class LevelSelector extends UICorePlugin {
141
136
  * @internal
142
137
  */
143
138
  render() {
144
- assert(this.core.getPlugin('bottom_gear'), 'bottom_gear plugin is required');
145
139
  if (!this.shouldRender()) {
146
140
  return this;
147
141
  }
@@ -158,7 +152,10 @@ export class LevelSelector extends UICorePlugin {
158
152
  });
159
153
  this.$el.html(html);
160
154
  const gear = this.core.getPlugin('bottom_gear');
161
- gear.getElement('quality')?.html(this.el);
155
+ if (!gear) {
156
+ trace(`${T} renderButton: bottom_gear plugin not found`);
157
+ }
158
+ gear?.getElement('quality')?.html(this.el);
162
159
  }
163
160
  }
164
161
  renderDropdown() {
@@ -172,12 +169,14 @@ export class LevelSelector extends UICorePlugin {
172
169
  });
173
170
  this.$el.html(html);
174
171
  const gear = this.core.getPlugin('bottom_gear');
172
+ trace(`${T} renderDropdown: bottom_gear plugin not found`);
175
173
  gear?.setContent(this.el);
176
174
  }
177
175
  get maxLevel() {
178
176
  const maxRes = this.core.options.levelSelector?.restrictResolution;
179
177
  return maxRes
180
- ? this.levels.findIndex((level) => (level.height > level.width ? level.width : level.height) === maxRes)
178
+ ? this.levels.findIndex((level) => (level.height > level.width ? level.width : level.height) ===
179
+ maxRes)
181
180
  : -1;
182
181
  }
183
182
  fillLevels(levels) {
@@ -187,7 +186,8 @@ export class LevelSelector extends UICorePlugin {
187
186
  if (maxResolution) {
188
187
  this.removeAuto = true;
189
188
  const initialLevel = levels
190
- .filter((level) => (level.width > level.height ? level.height : level.width) <= maxResolution)
189
+ .filter((level) => (level.width > level.height ? level.height : level.width) <=
190
+ maxResolution)
191
191
  .pop();
192
192
  this.setLevel(initialLevel?.level ?? 0);
193
193
  }
@@ -7,6 +7,16 @@ import '../../../assets/media-control/plugins.scss';
7
7
  * @beta
8
8
  */
9
9
  export type MediaControlElement = 'audioTracksSelector' | 'bottomGear' | 'clipText' | 'gear' | 'pip' | 'playbackRate' | 'seekBarContainer' | 'subtitlesSelector';
10
+ /**
11
+ * Custom events emitted by the plugins to communicate with one another
12
+ * @beta
13
+ */
14
+ export declare enum MediaControlEvents {
15
+ /**
16
+ * Emitted when the gear menu is rendered
17
+ */
18
+ MEDIACONTROL_GEAR_RENDERED = "mediacontrol:gear:rendered"
19
+ }
10
20
  /**
11
21
  * The MediaControl provides a foundation for developing custom media controls UI.
12
22
  * @beta
@@ -1 +1 @@
1
- {"version":3,"file":"MediaControl.d.ts","sourceRoot":"","sources":["../../../src/plugins/media-control/MediaControl.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,YAAY,EAMZ,IAAI,EACL,MAAM,cAAc,CAAA;AAQrB,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAGlD,OAAO,kDAAkD,CAAA;AACzD,OAAO,4CAA4C,CAAA;AAWnD;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAC3B,qBAAqB,GACrB,YAAY,GACZ,UAAU,GACV,MAAM,GACN,KAAK,GACL,cAAc,GACd,kBAAkB,GAClB,mBAAmB,CAAA;AA6BvB;;;;;;;;;;;;GAYG;AACH,qBAAa,YAAa,SAAQ,YAAY;IAC5C,OAAO,CAAC,oBAAoB,CAAQ;IAEpC,OAAO,C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MrB,OAAO,CAAC,6BAA6B;CAOtC"}
@@ -17,6 +17,17 @@ import volumeMaxIcon from '../../../assets/icons/new/volume-max.svg';
17
17
  import volumeOffIcon from '../../../assets/icons/new/volume-off.svg';
18
18
  import fullscreenOffIcon from '../../../assets/icons/new/fullscreen-off.svg';
19
19
  import fullscreenOnIcon from '../../../assets/icons/new/fullscreen-on.svg';
20
+ /**
21
+ * Custom events emitted by the plugins to communicate with one another
22
+ * @beta
23
+ */
24
+ export var MediaControlEvents;
25
+ (function (MediaControlEvents) {
26
+ /**
27
+ * Emitted when the gear menu is rendered
28
+ */
29
+ MediaControlEvents["MEDIACONTROL_GEAR_RENDERED"] = "mediacontrol:gear:rendered";
30
+ })(MediaControlEvents || (MediaControlEvents = {}));
20
31
  const T = 'plugins.media_control';
21
32
  const LEFT_ORDER = [
22
33
  'playpause',
@@ -21,6 +21,7 @@ export declare class SourceController extends CorePlugin {
21
21
  private currentSourceIndex;
22
22
  private sourcesDelay;
23
23
  private active;
24
+ private switching;
24
25
  private sync;
25
26
  /**
26
27
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"SourceController.d.ts","sourceRoot":"","sources":["../../../src/plugins/source-controller/SourceController.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,KAAK,IAAI,IAAI,UAAU,EACxB,MAAM,cAAc,CAAA;AAwBrB;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;IAuC9C,OAAO,CAAC,WAAW,CAA8B;IAEjD,OAAO,CAAC,kBAAkB,CAAI;IAE9B,OAAO,CAAC,YAAY,CAA6B;IAEjD,OAAO,CAAC,MAAM,CAAQ;IAEtB,OAAO,CAAC,IAAI,CAAiB;IAE7B;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;gBAEW,IAAI,EAAE,UAAU;IAW5B;;OAEG;IACM,UAAU;IAWnB,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,wBAAwB;IAoBhC,OAAO,CAAC,2BAA2B;IAsCnC,OAAO,CAAC,KAAK;IAKb,OAAO,CAAC,aAAa;IA2BrB,OAAO,CAAC,kBAAkB;IAe1B;;OAEG;IACH,MAAM,KAAK,OAAO,WAEjB;CACF"}
1
+ {"version":3,"file":"SourceController.d.ts","sourceRoot":"","sources":["../../../src/plugins/source-controller/SourceController.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,KAAK,IAAI,IAAI,UAAU,EACxB,MAAM,cAAc,CAAA;AAwBrB;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;IAuC9C,OAAO,CAAC,WAAW,CAA8B;IAEjD,OAAO,CAAC,kBAAkB,CAAI;IAE9B,OAAO,CAAC,YAAY,CAA6B;IAEjD,OAAO,CAAC,MAAM,CAAQ;IAEtB,OAAO,CAAC,SAAS,CAAQ;IAEzB,OAAO,CAAC,IAAI,CAAiB;IAE7B;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;gBAEW,IAAI,EAAE,UAAU;IAW5B;;OAEG;IACM,UAAU;IAWnB,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,wBAAwB;IAoBhC,OAAO,CAAC,2BAA2B;IAwCnC,OAAO,CAAC,KAAK;IAKb,OAAO,CAAC,aAAa;IA4BrB,OAAO,CAAC,kBAAkB;IAe1B;;OAEG;IACH,MAAM,KAAK,OAAO,WAEjB;CACF"}
@@ -71,6 +71,7 @@ export class SourceController extends CorePlugin {
71
71
  currentSourceIndex = 0;
72
72
  sourcesDelay = {};
73
73
  active = false;
74
+ switching = false;
74
75
  sync = noSync;
75
76
  /**
76
77
  * @internal
@@ -135,15 +136,18 @@ export class SourceController extends CorePlugin {
135
136
  description: error?.description,
136
137
  level: error?.level,
137
138
  },
139
+ switching: this.switching,
138
140
  retrying: this.active,
139
141
  currentSource: this.sourcesList[this.currentSourceIndex],
140
142
  });
143
+ if (this.switching) {
144
+ return;
145
+ }
141
146
  switch (error.code) {
142
147
  case PlaybackErrorCode.MediaSourceUnavailable:
143
148
  this.core.activeContainer?.getPlugin('poster_custom')?.disable();
144
- setTimeout(() => this.retryPlayback(), 0);
149
+ this.retryPlayback();
145
150
  break;
146
- // TODO handle other errors
147
151
  default:
148
152
  break;
149
153
  }
@@ -155,7 +159,6 @@ export class SourceController extends CorePlugin {
155
159
  });
156
160
  if (this.active) {
157
161
  this.reset();
158
- // TODO make poster reset its state on enable
159
162
  this.core.activeContainer?.getPlugin('poster_custom')?.enable();
160
163
  this.core.activeContainer?.getPlugin('spinner')?.hide();
161
164
  }
@@ -171,6 +174,7 @@ export class SourceController extends CorePlugin {
171
174
  currentSource: this.sourcesList[this.currentSourceIndex],
172
175
  });
173
176
  this.active = true;
177
+ this.switching = true;
174
178
  this.core.activeContainer?.getPlugin('spinner')?.show(0);
175
179
  this.getNextMediaSource().then((nextSource) => {
176
180
  trace(`${T} retryPlayback syncing...`, {
@@ -179,12 +183,12 @@ export class SourceController extends CorePlugin {
179
183
  const rnd = RETRY_DELAY_BLUR * Math.random();
180
184
  this.sync(() => {
181
185
  trace(`${T} retryPlayback loading...`);
186
+ this.switching = false;
182
187
  this.core.load(nextSource.source, nextSource.mimeType);
183
188
  trace(`${T} retryPlayback loaded`, {
184
189
  nextSource,
185
190
  });
186
191
  setTimeout(() => {
187
- // this.core.activePlayback.consent()
188
192
  this.core.activePlayback.play();
189
193
  trace(`${T} retryPlayback playing`);
190
194
  }, rnd);
@@ -17,6 +17,7 @@ export declare enum SpinnerEvents {
17
17
  * The plugin emits
18
18
  */
19
19
  export declare class SpinnerThreeBounce extends UIContainerPlugin {
20
+ private userShown;
20
21
  /**
21
22
  * @internal
22
23
  */
@@ -34,7 +35,6 @@ export declare class SpinnerThreeBounce extends UIContainerPlugin {
34
35
  'data-spinner': string;
35
36
  class: string;
36
37
  };
37
- private hideTimeout;
38
38
  private showTimeout;
39
39
  private template;
40
40
  private hasFatalError;
@@ -46,13 +46,17 @@ export declare class SpinnerThreeBounce extends UIContainerPlugin {
46
46
  private onStop;
47
47
  private onError;
48
48
  /**
49
- * Shows the spinner
49
+ * Shows the spinner.
50
+ *
51
+ * When called, the spinner will not hide (due to its built-in logic) until {@link SpinnerThreeBounce#hide} is called
50
52
  */
51
53
  show(delay?: number): void;
52
54
  /**
53
- * Hides the spinner
55
+ * Hides the spinner.
54
56
  */
55
57
  hide(): void;
58
+ private _show;
59
+ private _hide;
56
60
  /**
57
61
  * @internal
58
62
  */
@@ -1 +1 @@
1
- {"version":3,"file":"SpinnerThreeBounce.d.ts","sourceRoot":"","sources":["../../../src/plugins/spinner-three-bounce/SpinnerThreeBounce.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAA0B,iBAAiB,EAAY,MAAM,cAAc,CAAC;AAK9F,OAAO,mDAAmD,CAAC;AAM3D;;GAEG;AACH,oBAAY,aAAa;IACvB;;;OAGG;IACH,IAAI,yBAAyB;CAC9B;AAED;;;;;GAKG;AACH,qBAAa,kBAAmB,SAAQ,iBAAiB;IACvD;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED;;OAEG;IACH,IAAa,UAAU;;;MAKtB;IAED,OAAO,CAAC,WAAW,CAAwB;IAE3C,OAAO,CAAC,WAAW,CAAwB;IAE3C,OAAO,CAAC,QAAQ,CAAyB;IAEzC,OAAO,CAAC,aAAa,CAAQ;IAE7B,OAAO,CAAC,YAAY,CAAQ;gBAEhB,SAAS,EAAE,SAAS;IAWhC,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,MAAM;IAKd,OAAO,CAAC,MAAM;IAUd,OAAO,CAAC,OAAO;IAef;;OAEG;IACH,IAAI,CAAC,KAAK,SAAM;IAchB;;OAEG;IACH,IAAI;IAaJ;;OAEG;IACM,MAAM;CAmBhB"}
1
+ {"version":3,"file":"SpinnerThreeBounce.d.ts","sourceRoot":"","sources":["../../../src/plugins/spinner-three-bounce/SpinnerThreeBounce.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,SAAS,EAET,iBAAiB,EAElB,MAAM,cAAc,CAAA;AAKrB,OAAO,mDAAmD,CAAA;AAM1D;;GAEG;AACH,oBAAY,aAAa;IACvB;;;OAGG;IACH,IAAI,yBAAyB;CAC9B;AAED;;;;;GAKG;AACH,qBAAa,kBAAmB,SAAQ,iBAAiB;IACvD,OAAO,CAAC,SAAS,CAAQ;IAEzB;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED;;OAEG;IACH,IAAa,UAAU;;;MAKtB;IAED,OAAO,CAAC,WAAW,CAAuB;IAE1C,OAAO,CAAC,QAAQ,CAAwB;IAExC,OAAO,CAAC,aAAa,CAAQ;IAE7B,OAAO,CAAC,YAAY,CAAQ;gBAEhB,SAAS,EAAE,SAAS;IAmBhC,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,MAAM;IAKd,OAAO,CAAC,MAAM;IAUd,OAAO,CAAC,OAAO;IAef;;;;OAIG;IACH,IAAI,CAAC,KAAK,SAAM;IAMhB;;OAEG;IACH,IAAI;IAKJ,OAAO,CAAC,KAAK;IASb,OAAO,CAAC,KAAK;IAeb;;OAEG;IACM,MAAM;CAmBhB"}
@@ -1,9 +1,9 @@
1
1
  // Copyright 2014 Globo.com Player authors. All rights reserved.
2
2
  // Use of this source code is governed by a BSD-style
3
3
  // license that can be found in the LICENSE file.
4
- import { Events as ClapprEvents, UIContainerPlugin, template } from '@clappr/core';
5
- import { PlaybackErrorCode } from '../../playback.types.js';
4
+ import { Events as ClapprEvents, UIContainerPlugin, template, } from '@clappr/core';
6
5
  import { trace } from '@gcorevideo/utils';
6
+ import { PlaybackErrorCode } from '../../playback.types.js';
7
7
  import spinnerHTML from '../../../assets/spinner-three-bounce/spinner.ejs';
8
8
  import '../../../assets/spinner-three-bounce/spinner.scss';
9
9
  import { CLAPPR_VERSION } from '../../build.js';
@@ -26,6 +26,7 @@ export var SpinnerEvents;
26
26
  * The plugin emits
27
27
  */
28
28
  export class SpinnerThreeBounce extends UIContainerPlugin {
29
+ userShown = false;
29
30
  /**
30
31
  * @internal
31
32
  */
@@ -44,10 +45,9 @@ export class SpinnerThreeBounce extends UIContainerPlugin {
44
45
  get attributes() {
45
46
  return {
46
47
  'data-spinner': '',
47
- 'class': 'spinner-three-bounce'
48
+ class: 'spinner-three-bounce',
48
49
  };
49
50
  }
50
- hideTimeout = null;
51
51
  showTimeout = null;
52
52
  template = template(spinnerHTML);
53
53
  hasFatalError = false;
@@ -64,17 +64,17 @@ export class SpinnerThreeBounce extends UIContainerPlugin {
64
64
  }
65
65
  onBuffering() {
66
66
  this.hasBuffering = true;
67
- this.show();
67
+ this._show();
68
68
  }
69
69
  onBufferFull() {
70
70
  if (!this.hasFatalError && this.hasBuffering) {
71
- this.hide();
71
+ this._hide();
72
72
  }
73
73
  this.hasBuffering = false;
74
74
  }
75
75
  onPlay() {
76
76
  trace(`${T} onPlay`);
77
- this.hide();
77
+ this._hide();
78
78
  }
79
79
  onStop() {
80
80
  trace(`${T} onStop`, {
@@ -82,7 +82,7 @@ export class SpinnerThreeBounce extends UIContainerPlugin {
82
82
  hasFatalError: this.hasFatalError,
83
83
  });
84
84
  if (!(this.hasFatalError && this.options.spinner?.showOnError)) {
85
- this.hide();
85
+ this._hide();
86
86
  }
87
87
  }
88
88
  onError(e) {
@@ -94,42 +94,50 @@ export class SpinnerThreeBounce extends UIContainerPlugin {
94
94
  error: e.code,
95
95
  });
96
96
  if (this.options.spinner?.showOnError) {
97
- this.show();
97
+ this._show();
98
98
  }
99
99
  else {
100
- this.hide();
100
+ this._hide();
101
101
  }
102
102
  }
103
103
  /**
104
- * Shows the spinner
104
+ * Shows the spinner.
105
+ *
106
+ * When called, the spinner will not hide (due to its built-in logic) until {@link SpinnerThreeBounce#hide} is called
105
107
  */
106
108
  show(delay = 300) {
107
109
  trace(`${T} show`);
110
+ this.userShown = true;
111
+ this._show(delay);
112
+ }
113
+ /**
114
+ * Hides the spinner.
115
+ */
116
+ hide() {
117
+ this.userShown = false;
118
+ this._hide();
119
+ }
120
+ _show(delay = 300) {
108
121
  if (this.showTimeout === null) {
109
- if (this.hideTimeout !== null) {
110
- clearTimeout(this.hideTimeout);
111
- this.hideTimeout = null;
112
- }
113
122
  this.showTimeout = setTimeout(() => {
114
123
  this.showTimeout = null;
115
124
  this.$el.show();
116
125
  }, delay);
117
126
  }
118
127
  }
119
- /**
120
- * Hides the spinner
121
- */
122
- hide() {
128
+ _hide() {
129
+ trace(`${T} _hide`, {
130
+ userShown: this.userShown,
131
+ });
132
+ if (this.userShown) {
133
+ return;
134
+ }
123
135
  if (this.showTimeout !== null) {
124
136
  clearTimeout(this.showTimeout);
125
137
  this.showTimeout = null;
126
138
  }
127
- this.hideTimeout = setTimeout(() => {
128
- this.hideTimeout = null;
129
- if (this.showTimeout === null) {
130
- this.$el.hide();
131
- }
132
- }, 0);
139
+ this.$el.hide();
140
+ this.trigger(SpinnerEvents.SYNC); // TODO test
133
141
  }
134
142
  /**
135
143
  * @internal
@@ -146,10 +154,10 @@ export class SpinnerThreeBounce extends UIContainerPlugin {
146
154
  });
147
155
  this.container.$el.append(this.$el[0]);
148
156
  if (showOnStart || this.container.buffering) {
149
- this.show();
157
+ this._show();
150
158
  }
151
159
  else {
152
- this.hide();
160
+ this._hide();
153
161
  }
154
162
  return this;
155
163
  }
@@ -1,3 +1,4 @@
1
+ import { UICorePlugin } from '@clappr/core';
1
2
  import Events from 'eventemitter3';
2
3
  /**
3
4
  * @internal
@@ -35,10 +36,7 @@ export declare class _MockPlayback extends Events {
35
36
  }
36
37
  export declare function createMockCore(options?: Record<string, unknown>, container?: any): Events<string | symbol, any> & {
37
38
  el: HTMLDivElement;
38
- $el: {
39
- 0: HTMLDivElement;
40
- append: import("vitest").Mock<(...args: any[]) => any>;
41
- };
39
+ $el: any;
42
40
  activePlayback: any;
43
41
  activeContainer: any;
44
42
  options: {
@@ -47,6 +45,7 @@ export declare function createMockCore(options?: Record<string, unknown>, contai
47
45
  configure: import("vitest").Mock<(...args: any[]) => any>;
48
46
  getPlugin: import("vitest").Mock<(...args: any[]) => any>;
49
47
  load: import("vitest").Mock<(...args: any[]) => any>;
48
+ trigger: <T extends string | symbol>(event: T, ...args: any[]) => boolean;
50
49
  };
51
50
  export declare function createMockPlugin(): Events<string | symbol, any> & {
52
51
  enable: import("vitest").Mock<(...args: any[]) => any>;
@@ -87,12 +86,10 @@ export declare function createMockPlayback(name?: string): Events<string | symbo
87
86
  trigger(event: string, ...args: any[]): void;
88
87
  };
89
88
  export declare function createMockContainer(playback?: any): Events<string | symbol, any> & {
90
- $el: {
91
- html: import("vitest").Mock<(...args: any[]) => any>;
92
- 0: HTMLDivElement;
93
- };
89
+ $el: any;
94
90
  el: HTMLDivElement;
95
91
  getPlugin: import("vitest").Mock<(...args: any[]) => any>;
96
92
  playback: any;
97
93
  };
94
+ export declare function createMockMediaControl(core: any): UICorePlugin;
98
95
  //# sourceMappingURL=testUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"testUtils.d.ts","sourceRoot":"","sources":["../src/testUtils.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,eAAe,CAAA;AAElC;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,MAAM;IAErC,SAAS,CAAC,OAAO,EAAE,GAAG;IACtB,QAAQ,CAAC,IAAI,EAAE,GAAG;IAClB,SAAS,CAAC,WAAW,CAAC,EAAE,GAAG;gBAFjB,OAAO,EAAE,GAAG,EACb,IAAI,EAAE,GAAG,EACR,WAAW,CAAC,EAAE,GAAG,YAAA;IAK7B,IAAI,IAAI,WAEP;IAED,OAAO;IAEP,IAAI;IAEJ,KAAK;IAEL,IAAI;IAEJ,OAAO;IAEP,IAAI;IAEJ,cAAc;IAEd,WAAW;IAIX,QA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AEN,MAAM;IAEN,SAAS;IAET,eAAe;IAIf,WAAW;IAIX,QAAQ;IAIR,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;CAGtC;AAED,wBAAgB,cAAc,CAAC,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EAAE,SAAS,GAAE,GAA2B;;;;;;;;;;;;EAgB3G;AAED,wBAAgB,gBAAgB;;;EAK/B;AAED,wBAAgB,mBAAmB;;;;;;EAKlC;AAED,wBAAgB,kBAAkB,CAAC,IAAI,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;mBA2C7B,MAAM,WAAW,GAAG,EAAE;EAIxC;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,GAAE,GAA0B;;;;;EAQvE;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,GAAG,gBAQ/C"}
package/lib/testUtils.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { $, UICorePlugin } from '@clappr/core';
1
2
  import Events from 'eventemitter3';
2
3
  import { vi } from 'vitest';
3
4
  /**
@@ -61,12 +62,10 @@ export class _MockPlayback extends Events {
61
62
  }
62
63
  export function createMockCore(options = {}, container = createMockContainer()) {
63
64
  const el = document.createElement('div');
64
- return Object.assign(new Events(), {
65
+ const emitter = new Events();
66
+ return Object.assign(emitter, {
65
67
  el,
66
- $el: {
67
- [0]: el,
68
- append: vi.fn(),
69
- },
68
+ $el: $(el),
70
69
  activePlayback: container.playback,
71
70
  activeContainer: container,
72
71
  options: {
@@ -75,6 +74,7 @@ export function createMockCore(options = {}, container = createMockContainer())
75
74
  configure: vi.fn(),
76
75
  getPlugin: vi.fn(),
77
76
  load: vi.fn(),
77
+ trigger: emitter.emit,
78
78
  });
79
79
  }
80
80
  export function createMockPlugin() {
@@ -140,12 +140,18 @@ export function createMockPlayback(name = 'mock') {
140
140
  export function createMockContainer(playback = createMockPlayback()) {
141
141
  const el = document.createElement('div');
142
142
  return Object.assign(new Events(), {
143
- $el: {
144
- html: vi.fn(),
145
- [0]: el,
146
- },
143
+ $el: $(el),
147
144
  el,
148
145
  getPlugin: vi.fn(),
149
146
  playback,
150
147
  });
151
148
  }
149
+ export function createMockMediaControl(core) {
150
+ const mediaControl = new UICorePlugin(core);
151
+ const elements = {
152
+ gear: $(document.createElement('div')),
153
+ };
154
+ // @ts-ignore
155
+ mediaControl.getElement = vi.fn().mockImplementation((name) => elements[name]);
156
+ return mediaControl;
157
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gcorevideo/player",
3
- "version": "2.20.6",
3
+ "version": "2.20.7",
4
4
  "description": "Gcore JavaScript video player",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",