@gcorevideo/player 2.19.14 → 2.19.15

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 (77) hide show
  1. package/assets/level-selector/list.ejs +2 -2
  2. package/dist/core.js +1 -1
  3. package/dist/index.css +1054 -1054
  4. package/dist/index.js +1232 -1154
  5. package/dist/player.d.ts +157 -22
  6. package/dist/plugins/index.css +634 -634
  7. package/dist/plugins/index.js +1024 -944
  8. package/docs/api/player.bottomgear.getelement.md +56 -0
  9. package/docs/api/player.bottomgear.md +51 -0
  10. package/docs/api/player.bottomgear.setcontent.md +56 -0
  11. package/docs/api/{player.subtitles.levelelement.md → player.gearevents.md} +11 -13
  12. package/docs/api/{player.sourcecontroller.name.md → player.gearitemelement.md} +5 -3
  13. package/docs/api/player.levelselector.md +9 -1
  14. package/docs/api/player.md +37 -0
  15. package/docs/api/{player.sourcecontroller.supportedversion.md → player.mediacontrol.getrightpanel.md} +11 -5
  16. package/docs/api/player.mediacontrol.md +14 -0
  17. package/docs/api/player.mediacontrolelement.md +1 -1
  18. package/docs/api/player.sourcecontroller.md +0 -90
  19. package/docs/api/player.spinnerevents.md +49 -0
  20. package/docs/api/player.spinnerthreebounce._constructor_.md +3 -0
  21. package/docs/api/player.spinnerthreebounce.hide.md +5 -0
  22. package/docs/api/player.spinnerthreebounce.md +14 -95
  23. package/docs/api/player.spinnerthreebounce.show.md +6 -37
  24. package/docs/api/player.subtitles.hide.md +5 -0
  25. package/docs/api/player.subtitles.md +23 -275
  26. package/docs/api/player.subtitles.show.md +5 -0
  27. package/lib/plugins/bottom-gear/BottomGear.d.ts +20 -1
  28. package/lib/plugins/bottom-gear/BottomGear.d.ts.map +1 -1
  29. package/lib/plugins/bottom-gear/BottomGear.js +28 -7
  30. package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.js +4 -4
  31. package/lib/plugins/level-selector/LevelSelector.d.ts +10 -3
  32. package/lib/plugins/level-selector/LevelSelector.d.ts.map +1 -1
  33. package/lib/plugins/level-selector/LevelSelector.js +20 -19
  34. package/lib/plugins/media-control/MediaControl.d.ts +6 -2
  35. package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
  36. package/lib/plugins/media-control/MediaControl.js +40 -39
  37. package/lib/plugins/source-controller/SourceController.d.ts +9 -0
  38. package/lib/plugins/source-controller/SourceController.d.ts.map +1 -1
  39. package/lib/plugins/source-controller/SourceController.js +11 -1
  40. package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.d.ts +35 -1
  41. package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.d.ts.map +1 -1
  42. package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.js +46 -23
  43. package/lib/plugins/subtitles/Subtitles.d.ts +65 -16
  44. package/lib/plugins/subtitles/Subtitles.d.ts.map +1 -1
  45. package/lib/plugins/subtitles/Subtitles.js +131 -109
  46. package/package.json +1 -1
  47. package/src/plugins/bottom-gear/BottomGear.ts +26 -4
  48. package/src/plugins/clappr-nerd-stats/ClapprNerdStats.ts +4 -4
  49. package/src/plugins/level-selector/LevelSelector.ts +22 -19
  50. package/src/plugins/media-control/MediaControl.ts +43 -41
  51. package/src/plugins/source-controller/SourceController.ts +11 -1
  52. package/src/plugins/source-controller/__tests__/SourceController.test.ts +1 -1
  53. package/src/plugins/spinner-three-bounce/SpinnerThreeBounce.ts +46 -22
  54. package/src/plugins/subtitles/Subtitles.ts +146 -155
  55. package/temp/player.api.json +293 -822
  56. package/tsconfig.tsbuildinfo +1 -1
  57. package/docs/api/player.sourcecontroller.version.md +0 -14
  58. package/docs/api/player.spinnerthreebounce.attributes.md +0 -14
  59. package/docs/api/player.spinnerthreebounce.name.md +0 -11
  60. package/docs/api/player.spinnerthreebounce.render.md +0 -15
  61. package/docs/api/player.spinnerthreebounce.supportedversion.md +0 -13
  62. package/docs/api/player.subtitles.attributes.md +0 -14
  63. package/docs/api/player.subtitles.bindevents.md +0 -15
  64. package/docs/api/player.subtitles.buttonelement.md +0 -15
  65. package/docs/api/player.subtitles.events.md +0 -14
  66. package/docs/api/player.subtitles.name.md +0 -11
  67. package/docs/api/player.subtitles.preselectedlanguage.md +0 -11
  68. package/docs/api/player.subtitles.reload.md +0 -15
  69. package/docs/api/player.subtitles.render.md +0 -15
  70. package/docs/api/player.subtitles.selectsubtitles.md +0 -15
  71. package/docs/api/player.subtitles.startlevelswitch.md +0 -15
  72. package/docs/api/player.subtitles.stoplevelswitch.md +0 -15
  73. package/docs/api/player.subtitles.supportedversion.md +0 -13
  74. package/docs/api/player.subtitles.template.md +0 -11
  75. package/docs/api/player.subtitles.templatestring.md +0 -11
  76. package/docs/api/player.subtitles.unbindevents.md +0 -15
  77. package/docs/api/player.subtitles.version.md +0 -11
@@ -4,47 +4,16 @@
4
4
 
5
5
  ## SpinnerThreeBounce.show() method
6
6
 
7
+ > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
8
+ >
9
+
10
+ Shows the spinner
11
+
7
12
  **Signature:**
8
13
 
9
14
  ```typescript
10
- show(immediate?: boolean): void;
15
+ show(): void;
11
16
  ```
12
-
13
- ## Parameters
14
-
15
- <table><thead><tr><th>
16
-
17
- Parameter
18
-
19
-
20
- </th><th>
21
-
22
- Type
23
-
24
-
25
- </th><th>
26
-
27
- Description
28
-
29
-
30
- </th></tr></thead>
31
- <tbody><tr><td>
32
-
33
- immediate
34
-
35
-
36
- </td><td>
37
-
38
- boolean
39
-
40
-
41
- </td><td>
42
-
43
- _(Optional)_
44
-
45
-
46
- </td></tr>
47
- </tbody></table>
48
17
  **Returns:**
49
18
 
50
19
  void
@@ -4,6 +4,11 @@
4
4
 
5
5
  ## Subtitles.hide() method
6
6
 
7
+ > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
8
+ >
9
+
10
+ Hides the subtitles menu and the subtitles.
11
+
7
12
  **Signature:**
8
13
 
9
14
  ```typescript
@@ -4,6 +4,11 @@
4
4
 
5
5
  ## Subtitles class
6
6
 
7
+ > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
8
+ >
9
+
10
+ A [media control](./player.mediacontrol.md) plugin that provides a UI to select the subtitles when available.
11
+
7
12
  **Signature:**
8
13
 
9
14
  ```typescript
@@ -11,184 +16,31 @@ export declare class Subtitles extends UICorePlugin
11
16
  ```
12
17
  **Extends:** UICorePlugin
13
18
 
14
- ## Properties
15
-
16
- <table><thead><tr><th>
17
-
18
- Property
19
-
20
-
21
- </th><th>
22
-
23
- Modifiers
24
-
25
-
26
- </th><th>
27
-
28
- Type
19
+ ## Remarks
29
20
 
21
+ Depends on:
30
22
 
31
- </th><th>
23
+ - [MediaControl](./player.mediacontrol.md)
32
24
 
33
- Description
25
+ Configuration options:
34
26
 
27
+ - subtitles.language - The language of the subtitles to select by default.
35
28
 
36
- </th></tr></thead>
37
- <tbody><tr><td>
38
-
39
- [attributes](./player.subtitles.attributes.md)
40
-
41
-
42
- </td><td>
43
-
44
- `readonly`
45
-
46
-
47
- </td><td>
48
-
49
- { class: string; 'data-subtitles': string; }
50
-
51
-
52
- </td><td>
53
-
29
+ ## Example
54
30
 
55
- </td></tr>
56
- <tr><td>
57
-
58
- [events](./player.subtitles.events.md)
59
-
60
-
61
- </td><td>
62
-
63
- `readonly`
64
-
65
-
66
- </td><td>
67
-
68
- { 'click \[data-subtitles-select\]': string; 'click \[data-subtitles-button\]': string; }
69
-
70
-
71
- </td><td>
72
-
73
-
74
- </td></tr>
75
- <tr><td>
76
-
77
- [name](./player.subtitles.name.md)
78
-
79
-
80
- </td><td>
81
-
82
- `readonly`
83
-
84
-
85
- </td><td>
86
-
87
- string
88
-
89
-
90
- </td><td>
91
-
92
-
93
- </td></tr>
94
- <tr><td>
95
-
96
- [preselectedLanguage](./player.subtitles.preselectedlanguage.md)
97
-
98
-
99
- </td><td>
100
-
101
- `readonly`
102
-
103
-
104
- </td><td>
105
-
106
- string
107
-
108
-
109
- </td><td>
110
-
111
-
112
- </td></tr>
113
- <tr><td>
114
-
115
- [supportedVersion](./player.subtitles.supportedversion.md)
116
-
117
-
118
- </td><td>
119
-
120
- `readonly`
121
-
122
-
123
- </td><td>
124
-
125
- { min: string; }
126
-
127
-
128
- </td><td>
129
-
130
-
131
- </td></tr>
132
- <tr><td>
133
-
134
- [template](./player.subtitles.template.md)
135
-
136
-
137
- </td><td>
138
-
139
- `readonly`
140
-
141
-
142
- </td><td>
143
-
144
- any
145
-
146
-
147
- </td><td>
148
-
149
-
150
- </td></tr>
151
- <tr><td>
152
-
153
- [templateString](./player.subtitles.templatestring.md)
154
-
155
-
156
- </td><td>
157
-
158
- `readonly`
159
-
160
-
161
- </td><td>
162
31
 
163
- any
32
+ ```ts
33
+ import { Subtitles } from '@gcorevideo/player'
164
34
 
35
+ Player.registerPlugin(Subtitles)
165
36
 
166
- </td><td>
167
-
168
-
169
- </td></tr>
170
- <tr><td>
171
-
172
- [version](./player.subtitles.version.md)
173
-
174
-
175
- </td><td>
176
-
177
- `static`
178
-
179
- `readonly`
180
-
181
-
182
- </td><td>
183
-
184
- string
185
-
186
-
187
- </td><td>
188
-
189
-
190
- </td></tr>
191
- </tbody></table>
37
+ new Player({
38
+ ...
39
+ subtitles: {
40
+ language: 'en',
41
+ },
42
+ })
43
+ ```
192
44
 
193
45
  ## Methods
194
46
 
@@ -210,30 +62,6 @@ Description
210
62
  </th></tr></thead>
211
63
  <tbody><tr><td>
212
64
 
213
- [bindEvents()](./player.subtitles.bindevents.md)
214
-
215
-
216
- </td><td>
217
-
218
-
219
- </td><td>
220
-
221
-
222
- </td></tr>
223
- <tr><td>
224
-
225
- [buttonElement()](./player.subtitles.buttonelement.md)
226
-
227
-
228
- </td><td>
229
-
230
-
231
- </td><td>
232
-
233
-
234
- </td></tr>
235
- <tr><td>
236
-
237
65
  [hide()](./player.subtitles.hide.md)
238
66
 
239
67
 
@@ -242,53 +70,7 @@ Description
242
70
 
243
71
  </td><td>
244
72
 
245
-
246
- </td></tr>
247
- <tr><td>
248
-
249
- [levelElement(id)](./player.subtitles.levelelement.md)
250
-
251
-
252
- </td><td>
253
-
254
-
255
- </td><td>
256
-
257
-
258
- </td></tr>
259
- <tr><td>
260
-
261
- [reload()](./player.subtitles.reload.md)
262
-
263
-
264
- </td><td>
265
-
266
-
267
- </td><td>
268
-
269
-
270
- </td></tr>
271
- <tr><td>
272
-
273
- [render()](./player.subtitles.render.md)
274
-
275
-
276
- </td><td>
277
-
278
-
279
- </td><td>
280
-
281
-
282
- </td></tr>
283
- <tr><td>
284
-
285
- [selectSubtitles()](./player.subtitles.selectsubtitles.md)
286
-
287
-
288
- </td><td>
289
-
290
-
291
- </td><td>
73
+ **_(BETA)_** Hides the subtitles menu and the subtitles.
292
74
 
293
75
 
294
76
  </td></tr>
@@ -302,41 +84,7 @@ Description
302
84
 
303
85
  </td><td>
304
86
 
305
-
306
- </td></tr>
307
- <tr><td>
308
-
309
- [startLevelSwitch()](./player.subtitles.startlevelswitch.md)
310
-
311
-
312
- </td><td>
313
-
314
-
315
- </td><td>
316
-
317
-
318
- </td></tr>
319
- <tr><td>
320
-
321
- [stopLevelSwitch()](./player.subtitles.stoplevelswitch.md)
322
-
323
-
324
- </td><td>
325
-
326
-
327
- </td><td>
328
-
329
-
330
- </td></tr>
331
- <tr><td>
332
-
333
- [unBindEvents()](./player.subtitles.unbindevents.md)
334
-
335
-
336
- </td><td>
337
-
338
-
339
- </td><td>
87
+ **_(BETA)_** Shows the subtitles menu and the subtitles.
340
88
 
341
89
 
342
90
  </td></tr>
@@ -4,6 +4,11 @@
4
4
 
5
5
  ## Subtitles.show() method
6
6
 
7
+ > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
8
+ >
9
+
10
+ Shows the subtitles menu and the subtitles.
11
+
7
12
  **Signature:**
8
13
 
9
14
  ```typescript
@@ -2,7 +2,13 @@ import { UICorePlugin } from '@clappr/core';
2
2
  import '../../../assets/bottom-gear/gear.scss';
3
3
  import '../../../assets/bottom-gear/gear-sub-menu.scss';
4
4
  import { ZeptoResult } from '../../utils/types.js';
5
- export declare enum Events {
5
+ /**
6
+ * Custom events emitted by the plugin
7
+ */
8
+ export declare enum GearEvents {
9
+ /**
10
+ * Emitted when the gear menu is rendered
11
+ */
6
12
  MEDIACONTROL_GEAR_RENDERED = "mediacontrol:gear:rendered"
7
13
  }
8
14
  /**
@@ -15,6 +21,10 @@ export type GearItemElement = 'quality' | 'rate' | 'nerd';
15
21
  * @beta
16
22
  * @remarks
17
23
  * The plugins provides a base for attaching custom settings UI in the gear menu
24
+ *
25
+ * Depends on:
26
+ *
27
+ * - {@link MediaControl | media_control}
18
28
  */
19
29
  export declare class BottomGear extends UICorePlugin {
20
30
  private isHd;
@@ -50,7 +60,16 @@ export declare class BottomGear extends UICorePlugin {
50
60
  * @internal
51
61
  */
52
62
  bindEvents(): void;
63
+ /**
64
+ * @param name - Name of a gear menu placeholder item to attach custom UI
65
+ * @returns Zepto result of the element
66
+ */
53
67
  getElement(name: GearItemElement): ZeptoResult | null;
68
+ /**
69
+ * Replaces the content of the gear menu
70
+ * @param content - Zepto result of the element
71
+ */
72
+ setContent(content: ZeptoResult): void;
54
73
  private onActiveContainerChanged;
55
74
  private bindContainerEvents;
56
75
  private highDefinitionUpdate;
@@ -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,oBAAY,MAAM;IAChB,0BAA0B,+BAA+B;CAC1D;AAED;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAE1D;;;;;GAKG;AACH,qBAAa,UAAW,SAAQ,YAAY;IAC1C,OAAO,CAAC,IAAI,CAA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;;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"}
@@ -8,16 +8,26 @@ 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
10
  const VERSION = '2.19.12';
11
- const T = 'plugins.media_control_gear';
12
- export var Events;
13
- (function (Events) {
14
- Events["MEDIACONTROL_GEAR_RENDERED"] = "mediacontrol:gear:rendered";
15
- })(Events || (Events = {}));
11
+ const T = 'plugins.bottom_gear';
12
+ /**
13
+ * Custom events emitted by the plugin
14
+ */
15
+ export var GearEvents;
16
+ (function (GearEvents) {
17
+ /**
18
+ * Emitted when the gear menu is rendered
19
+ */
20
+ GearEvents["MEDIACONTROL_GEAR_RENDERED"] = "mediacontrol:gear:rendered";
21
+ })(GearEvents || (GearEvents = {}));
16
22
  /**
17
23
  * Adds the gear button that triggers extra options menu on the right side of the {@link MediaControl | media control} UI
18
24
  * @beta
19
25
  * @remarks
20
26
  * The plugins provides a base for attaching custom settings UI in the gear menu
27
+ *
28
+ * Depends on:
29
+ *
30
+ * - {@link MediaControl | media_control}
21
31
  */
22
32
  export class BottomGear extends UICorePlugin {
23
33
  isHd = false;
@@ -25,7 +35,7 @@ export class BottomGear extends UICorePlugin {
25
35
  * @internal
26
36
  */
27
37
  get name() {
28
- return 'media_control_gear';
38
+ return 'bottom_gear';
29
39
  }
30
40
  /**
31
41
  * @internal
@@ -68,9 +78,20 @@ export class BottomGear extends UICorePlugin {
68
78
  this.listenTo(mediaControl, ClapprEvents.MEDIACONTROL_RENDERED, this.render);
69
79
  this.listenTo(mediaControl, ClapprEvents.MEDIACONTROL_HIDE, this.hide); // TODO mediacontrol show as well
70
80
  }
81
+ /**
82
+ * @param name - Name of a gear menu placeholder item to attach custom UI
83
+ * @returns Zepto result of the element
84
+ */
71
85
  getElement(name) {
72
86
  return this.core.getPlugin('media_control')?.getElement('gear')?.find(`.gear-options-list [data-${name}]`);
73
87
  }
88
+ /**
89
+ * Replaces the content of the gear menu
90
+ * @param content - Zepto result of the element
91
+ */
92
+ setContent(content) {
93
+ this.$el.find('.gear-wrapper').html(content);
94
+ }
74
95
  onActiveContainerChanged() {
75
96
  trace(`${T} onActiveContainerChanged`);
76
97
  this.bindContainerEvents();
@@ -105,7 +126,7 @@ export class BottomGear extends UICorePlugin {
105
126
  this.$el.html(BottomGear.template({ icon, items }));
106
127
  mediaControl.getElement('gear')?.html(this.el);
107
128
  this.core.trigger('gear:rendered'); // @deprecated
108
- mediaControl.trigger(Events.MEDIACONTROL_GEAR_RENDERED);
129
+ mediaControl.trigger(GearEvents.MEDIACONTROL_GEAR_RENDERED);
109
130
  return this;
110
131
  }
111
132
  refresh() {
@@ -10,7 +10,7 @@ import '../../../assets/clappr-nerd-stats/clappr-nerd-stats.scss';
10
10
  import pluginHtml from '../../../assets/clappr-nerd-stats/clappr-nerd-stats.ejs';
11
11
  import buttonHtml from '../../../assets/clappr-nerd-stats/button.ejs';
12
12
  import statsIcon from '../../../assets/icons/new/stats.svg';
13
- import { Events as BottomGearEvents } from '../bottom-gear/BottomGear.js';
13
+ import { GearEvents } from '../bottom-gear/BottomGear.js';
14
14
  import assert from 'assert';
15
15
  const qualityClasses = [
16
16
  'speedtest-quality-value-1',
@@ -95,7 +95,7 @@ export class ClapprNerdStats extends UICorePlugin {
95
95
  shortcut;
96
96
  iconPosition;
97
97
  get name() {
98
- return 'media_control_nerd_stats';
98
+ return 'nerd_stats';
99
99
  }
100
100
  get supportedVersion() {
101
101
  return { min: CLAPPR_VERSION };
@@ -143,7 +143,7 @@ export class ClapprNerdStats extends UICorePlugin {
143
143
  const mediaControl = this.core.getPlugin('media_control');
144
144
  assert(mediaControl, 'media_control plugin is required');
145
145
  this.listenToOnce(this.core, Events.CORE_READY, this.init);
146
- this.listenTo(mediaControl, BottomGearEvents.MEDIACONTROL_GEAR_RENDERED, this.addToBottomGear);
146
+ this.listenTo(mediaControl, GearEvents.MEDIACONTROL_GEAR_RENDERED, this.addToBottomGear);
147
147
  }
148
148
  init() {
149
149
  this.container = this.core.activeContainer;
@@ -249,7 +249,7 @@ export class ClapprNerdStats extends UICorePlugin {
249
249
  return this;
250
250
  }
251
251
  addToBottomGear() {
252
- const gear = this.core.getPlugin('media_control_gear');
252
+ const gear = this.core.getPlugin('bottom_gear');
253
253
  const $el = gear.getElement('nerd');
254
254
  $el.html(buttonHtml);
255
255
  const $button = $el.find('.nerd-button');
@@ -5,7 +5,14 @@ import '../../../assets/level-selector/style.scss';
5
5
  * @beta
6
6
  *
7
7
  * @remarks
8
- * The plugin is rendered as a button in the {@link BottomGear | gear menu}.
8
+ * Depends on:
9
+ *
10
+ * - {@link MediaControl}
11
+ *
12
+ * - {@link BottomGear}
13
+ *
14
+ * The plugin is rendered as an item in the gear menu.
15
+ *
9
16
  * When clicked, it shows a list of quality levels to choose from.
10
17
  *
11
18
  * Configuration options:
@@ -30,8 +37,8 @@ export declare class LevelSelector extends UICorePlugin {
30
37
  private removeAuto;
31
38
  private isHd;
32
39
  private isOpen;
33
- private buttonTemplate;
34
- private listTemplate;
40
+ private static readonly buttonTemplate;
41
+ private static readonly listTemplate;
35
42
  /**
36
43
  * @internal
37
44
  */
@@ -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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AAC,UAAU;IAQlB,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,qBAAqB;IAe7B,OAAO,CAAC,WAAW,CAAmC;CACvD"}
@@ -8,14 +8,22 @@ import arrowRightIcon from '../../../assets/icons/new/arrow-right.svg';
8
8
  import arrowLeftIcon from '../../../assets/icons/new/arrow-left.svg';
9
9
  import checkIcon from '../../../assets/icons/new/check.svg';
10
10
  import '../../../assets/level-selector/style.scss';
11
- const T = 'plugins.media_control_level_selector';
11
+ import assert from 'assert';
12
+ const T = 'plugins.level_selector';
12
13
  const VERSION = '2.19.4';
13
14
  /**
14
15
  * A {@link MediaControl | media control} plugin that provides a UI to control the quality level of the playback.
15
16
  * @beta
16
17
  *
17
18
  * @remarks
18
- * The plugin is rendered as a button in the {@link BottomGear | gear menu}.
19
+ * Depends on:
20
+ *
21
+ * - {@link MediaControl}
22
+ *
23
+ * - {@link BottomGear}
24
+ *
25
+ * The plugin is rendered as an item in the gear menu.
26
+ *
19
27
  * When clicked, it shows a list of quality levels to choose from.
20
28
  *
21
29
  * Configuration options:
@@ -40,13 +48,13 @@ export class LevelSelector extends UICorePlugin {
40
48
  removeAuto = false;
41
49
  isHd = false;
42
50
  isOpen = false;
43
- buttonTemplate = null;
44
- listTemplate = null;
51
+ static buttonTemplate = template(buttonHtml);
52
+ static listTemplate = template(listHtml);
45
53
  /**
46
54
  * @internal
47
55
  */
48
56
  get name() {
49
- return 'media_control_level_selector';
57
+ return 'level_selector';
50
58
  }
51
59
  /**
52
60
  * @internal
@@ -133,6 +141,7 @@ export class LevelSelector extends UICorePlugin {
133
141
  * @internal
134
142
  */
135
143
  render() {
144
+ assert(this.core.getPlugin('bottom_gear'), 'bottom_gear plugin is required');
136
145
  if (!this.shouldRender()) {
137
146
  return this;
138
147
  }
@@ -140,28 +149,20 @@ export class LevelSelector extends UICorePlugin {
140
149
  return this;
141
150
  }
142
151
  renderButton() {
143
- if (!this.buttonTemplate) {
144
- this.buttonTemplate = template(buttonHtml);
145
- }
146
152
  if (!this.isOpen) {
147
- const html = this.buttonTemplate?.({
153
+ const html = LevelSelector.buttonTemplate({
148
154
  arrowRightIcon,
149
155
  currentText: this.currentText,
150
156
  isHd: this.isHd,
151
157
  hdIcon,
152
158
  });
153
159
  this.$el.html(html);
154
- const mediaControl = this.core.getPlugin('media_control');
155
- mediaControl.getElement('bottomGear')
156
- ?.find('.gear-options-list [data-quality]')
157
- ?.html(this.el);
160
+ const gear = this.core.getPlugin('bottom_gear');
161
+ gear.getElement('quality')?.html(this.el);
158
162
  }
159
163
  }
160
164
  renderDropdown() {
161
- if (!this.listTemplate) {
162
- this.listTemplate = template(listHtml);
163
- }
164
- const html = this.listTemplate({
165
+ const html = LevelSelector.listTemplate({
165
166
  arrowLeftIcon,
166
167
  checkIcon,
167
168
  labels: this.levelLabels,
@@ -170,8 +171,8 @@ export class LevelSelector extends UICorePlugin {
170
171
  removeAuto: this.removeAuto,
171
172
  });
172
173
  this.$el.html(html);
173
- const mediaControl = this.core.getPlugin('media_control');
174
- mediaControl.getElement('bottomGear')?.find('.gear-wrapper').html(this.el);
174
+ const gear = this.core.getPlugin('bottom_gear');
175
+ gear?.setContent(this.el);
175
176
  }
176
177
  get maxLevel() {
177
178
  const maxRes = this.core.options.levelSelector?.restrictResolution;