@gcorevideo/player 2.25.6 → 2.25.8

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 (45) hide show
  1. package/assets/audio-tracks/template.ejs +5 -4
  2. package/assets/bottom-gear/gear-sub-menu.scss +4 -9
  3. package/assets/bottom-gear/gear.scss +1 -2
  4. package/assets/media-control/container.scss +0 -13
  5. package/assets/media-control/media-control.scss +110 -8
  6. package/assets/media-control/width270.scss +3 -9
  7. package/assets/media-control/width370.scss +6 -40
  8. package/assets/multi-camera/style.scss +0 -5
  9. package/assets/picture-in-picture/style.scss +1 -2
  10. package/assets/subtitles/combobox.ejs +27 -6
  11. package/assets/subtitles/string.ejs +1 -1
  12. package/assets/subtitles/style.scss +16 -69
  13. package/dist/core.js +1 -1
  14. package/dist/index.css +1019 -1117
  15. package/dist/index.embed.js +180 -123
  16. package/dist/index.js +161 -107
  17. package/lib/plugins/audio-selector/AudioTracks.d.ts +4 -3
  18. package/lib/plugins/audio-selector/AudioTracks.d.ts.map +1 -1
  19. package/lib/plugins/audio-selector/AudioTracks.js +41 -23
  20. package/lib/plugins/bottom-gear/BottomGear.d.ts +1 -1
  21. package/lib/plugins/bottom-gear/BottomGear.d.ts.map +1 -1
  22. package/lib/plugins/bottom-gear/BottomGear.js +3 -4
  23. package/lib/plugins/media-control/MediaControl.d.ts +4 -0
  24. package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
  25. package/lib/plugins/media-control/MediaControl.js +8 -1
  26. package/lib/plugins/subtitles/ClosedCaptions.d.ts +7 -4
  27. package/lib/plugins/subtitles/ClosedCaptions.d.ts.map +1 -1
  28. package/lib/plugins/subtitles/ClosedCaptions.js +64 -34
  29. package/lib/testUtils.d.ts.map +1 -1
  30. package/lib/testUtils.js +2 -0
  31. package/package.json +1 -1
  32. package/src/plugins/audio-selector/AudioTracks.ts +53 -29
  33. package/src/plugins/audio-selector/__tests__/AudioTracks.test.ts +60 -45
  34. package/src/plugins/audio-selector/__tests__/__snapshots__/AudioSelector.test.ts.snap +24 -24
  35. package/src/plugins/audio-selector/__tests__/__snapshots__/AudioTracks.test.ts.snap +21 -18
  36. package/src/plugins/bottom-gear/BottomGear.ts +3 -4
  37. package/src/plugins/bottom-gear/__tests__/BottomGear.test.ts +1 -1
  38. package/src/plugins/media-control/MediaControl.ts +11 -1
  39. package/src/plugins/media-control/__tests__/__snapshots__/MediaControl.test.ts.snap +6 -6
  40. package/src/plugins/subtitles/ClosedCaptions.ts +66 -35
  41. package/src/plugins/subtitles/__tests__/ClosedCaptions.test.ts +220 -35
  42. package/src/plugins/subtitles/__tests__/__snapshots__/ClosedCaptions.test.ts.snap +8 -19
  43. package/src/testUtils.ts +2 -0
  44. package/tsconfig.tsbuildinfo +1 -1
  45. package/assets/audio-tracks/style.scss +0 -111
package/dist/index.js CHANGED
@@ -12680,7 +12680,7 @@ var PlaybackEvents;
12680
12680
  // https://github.com/clappr/clappr/blob/8752995ea439321ac7ca3cd35e8c64de7a3c3d17/LICENSE
12681
12681
  const AUTO$1 = -1;
12682
12682
  const { now: now$2 } = Utils;
12683
- const T$p = 'playback.dash';
12683
+ const T$o = 'playback.dash';
12684
12684
  class DashPlayback extends BasePlayback {
12685
12685
  _levels = null;
12686
12686
  _currentLevel = null;
@@ -12954,10 +12954,10 @@ class DashPlayback extends BasePlayback {
12954
12954
  }
12955
12955
  _onPlaybackError = (event) => {
12956
12956
  // TODO
12957
- trace(`${T$p} _onPlaybackError`, { event });
12957
+ trace(`${T$o} _onPlaybackError`, { event });
12958
12958
  };
12959
12959
  _onDASHJSSError = (event) => {
12960
- trace(`${T$p} _onDASHJSSError`, { event });
12960
+ trace(`${T$o} _onDASHJSSError`, { event });
12961
12961
  this._stopTimeUpdateTimer();
12962
12962
  // Note that the other error types are deprecated
12963
12963
  const e = event.error;
@@ -12992,7 +12992,7 @@ class DashPlayback extends BasePlayback {
12992
12992
  }
12993
12993
  };
12994
12994
  triggerError(error) {
12995
- trace(`${T$p} triggerError`, { error });
12995
+ trace(`${T$o} triggerError`, { error });
12996
12996
  // this triggers Events.ERROR to be handled by the UI
12997
12997
  this.trigger(Events$1.PLAYBACK_ERROR, this.createError(error, {
12998
12998
  useCodePrefix: false,
@@ -13031,10 +13031,10 @@ class DashPlayback extends BasePlayback {
13031
13031
  }
13032
13032
  get dvrEnabled() {
13033
13033
  if (!this._dash) {
13034
- trace(`${T$p} dvrEnable no dash player instance`);
13034
+ trace(`${T$o} dvrEnable no dash player instance`);
13035
13035
  return false;
13036
13036
  }
13037
- trace(`${T$p} get.dvrEnabled`, {
13037
+ trace(`${T$o} get.dvrEnabled`, {
13038
13038
  dvrWindowSize: this._dash?.getDVRWindowSize(),
13039
13039
  minDvrSize: this._minDvrSize,
13040
13040
  playbackType: this.getPlaybackType(),
@@ -13056,7 +13056,7 @@ class DashPlayback extends BasePlayback {
13056
13056
  this.trigger(Events$1.PLAYBACK_PROGRESS, progress, {});
13057
13057
  }
13058
13058
  play() {
13059
- trace(`${T$p} play`, { dash: !!this._dash });
13059
+ trace(`${T$o} play`, { dash: !!this._dash });
13060
13060
  !this._dash && this._setup();
13061
13061
  super.play();
13062
13062
  this._startTimeUpdateTimer();
@@ -13142,7 +13142,7 @@ class DashPlayback extends BasePlayback {
13142
13142
  }
13143
13143
  // @ts-expect-error
13144
13144
  get currentAudioTrack() {
13145
- trace(`${T$p} get currentAudioTrack`);
13145
+ trace(`${T$o} get currentAudioTrack`);
13146
13146
  assert.ok(this._dash, 'DASH.js MediaPlayer is not initialized');
13147
13147
  const t = this._dash.getCurrentTrackFor('audio');
13148
13148
  if (!t) {
@@ -41850,7 +41850,7 @@ const AUTO = -1;
41850
41850
  const DEFAULT_RECOVER_ATTEMPTS = 16;
41851
41851
  Events$1.register('PLAYBACK_FRAGMENT_CHANGED');
41852
41852
  Events$1.register('PLAYBACK_FRAGMENT_PARSING_METADATA');
41853
- const T$o = 'playback.hls';
41853
+ const T$n = 'playback.hls';
41854
41854
  class HlsPlayback extends BasePlayback {
41855
41855
  _ccIsSetup = false;
41856
41856
  _ccTracksUpdated = false;
@@ -42082,7 +42082,7 @@ class HlsPlayback extends BasePlayback {
42082
42082
  maxMaxBufferLength: 4,
42083
42083
  autoStartLoad: false,
42084
42084
  }, this.options.playback.hlsjsConfig);
42085
- trace(`${T$o} _createHLSInstance`, { config });
42085
+ trace(`${T$n} _createHLSInstance`, { config });
42086
42086
  this._hls = new Hls(config);
42087
42087
  }
42088
42088
  _attachHLSMedia() {
@@ -42175,7 +42175,7 @@ class HlsPlayback extends BasePlayback {
42175
42175
  }
42176
42176
  else {
42177
42177
  Log.error('hlsjs: failed to recover', { evt, data });
42178
- trace(`${T$o} _recover failed to recover`, {
42178
+ trace(`${T$n} _recover failed to recover`, {
42179
42179
  type: data.type,
42180
42180
  details: data.details,
42181
42181
  });
@@ -42261,7 +42261,7 @@ class HlsPlayback extends BasePlayback {
42261
42261
  this.trigger(Events$1.PLAYBACK_SETTINGSUPDATE);
42262
42262
  }
42263
42263
  _onHLSJSError(evt, data) {
42264
- trace(`${T$o} _onHLSJSError`, {
42264
+ trace(`${T$n} _onHLSJSError`, {
42265
42265
  fatal: data.fatal,
42266
42266
  type: data.type,
42267
42267
  details: data.details,
@@ -42309,7 +42309,7 @@ class HlsPlayback extends BasePlayback {
42309
42309
  evt,
42310
42310
  data,
42311
42311
  });
42312
- trace(`${T$o} _onHLSJSError trying to recover from network error`, {
42312
+ trace(`${T$n} _onHLSJSError trying to recover from network error`, {
42313
42313
  details: data.details,
42314
42314
  });
42315
42315
  error.level = PlayerError.Levels.WARN;
@@ -42322,7 +42322,7 @@ class HlsPlayback extends BasePlayback {
42322
42322
  evt,
42323
42323
  data,
42324
42324
  });
42325
- trace(`${T$o} _onHLSJSError trying to recover from media error`, {
42325
+ trace(`${T$n} _onHLSJSError trying to recover from media error`, {
42326
42326
  details: data.details,
42327
42327
  });
42328
42328
  error.level = PlayerError.Levels.WARN;
@@ -42352,7 +42352,7 @@ class HlsPlayback extends BasePlayback {
42352
42352
  return;
42353
42353
  }
42354
42354
  Log.warn('hlsjs: non-fatal error occurred', { evt, data });
42355
- trace(`${T$o} _onHLSJSError non-fatal error occurred`, {
42355
+ trace(`${T$n} _onHLSJSError non-fatal error occurred`, {
42356
42356
  type: data.type,
42357
42357
  details: data.details,
42358
42358
  });
@@ -42686,11 +42686,11 @@ class HlsPlayback extends BasePlayback {
42686
42686
  this._hls.audioTrack = Number(id); // TODO or find index by .id == id?
42687
42687
  }
42688
42688
  _onAudioTracksUpdated(_, data) {
42689
- trace(`${T$o} onAudioTracksUpdated`);
42689
+ trace(`${T$n} onAudioTracksUpdated`);
42690
42690
  this.trigger(Events$1.PLAYBACK_AUDIO_AVAILABLE, data.audioTracks.map(toClapprTrack));
42691
42691
  }
42692
42692
  _onAudioTrackSwitched(_, data) {
42693
- trace(`${T$o} onAudioTrackSwitched`);
42693
+ trace(`${T$n} onAudioTrackSwitched`);
42694
42694
  // @ts-ignore
42695
42695
  const track = this._hls.audioTracks[data.id];
42696
42696
  this.trigger(Events$1.PLAYBACK_AUDIO_CHANGED, toClapprTrack(track));
@@ -42711,7 +42711,7 @@ function toClapprTrack(t) {
42711
42711
  };
42712
42712
  }
42713
42713
 
42714
- const T$n = 'playback.html5_video';
42714
+ const T$m = 'playback.html5_video';
42715
42715
  const STALL_TIMEOUT = 15000;
42716
42716
  class HTML5Video extends BasePlayback {
42717
42717
  stallTimerId = null;
@@ -42719,7 +42719,7 @@ class HTML5Video extends BasePlayback {
42719
42719
  * @internal
42720
42720
  */
42721
42721
  createError(errorData, options) {
42722
- trace(`${T$n} createError`, {
42722
+ trace(`${T$m} createError`, {
42723
42723
  errorData: { ...errorData },
42724
42724
  });
42725
42725
  const i18n = this.i18n ||
@@ -42735,11 +42735,11 @@ class HTML5Video extends BasePlayback {
42735
42735
  return super.createError(errorData, { ...options, useCodePrefix: false });
42736
42736
  }
42737
42737
  _onWaiting() {
42738
- trace(`${T$n} _onWaiting`);
42738
+ trace(`${T$m} _onWaiting`);
42739
42739
  super._onWaiting();
42740
42740
  }
42741
42741
  _onEnded() {
42742
- trace(`${T$n} _onEnded`);
42742
+ trace(`${T$m} _onEnded`);
42743
42743
  if (this.stallTimerId) {
42744
42744
  clearTimeout(this.stallTimerId);
42745
42745
  this.stallTimerId = null;
@@ -42747,12 +42747,12 @@ class HTML5Video extends BasePlayback {
42747
42747
  super._onEnded();
42748
42748
  }
42749
42749
  _handleBufferingEvents() {
42750
- trace(`${T$n} _handleBufferingEvents`, {
42750
+ trace(`${T$m} _handleBufferingEvents`, {
42751
42751
  networkState: this.el.networkState,
42752
42752
  });
42753
42753
  if (!this.stallTimerId) {
42754
42754
  this.stallTimerId = setTimeout(() => {
42755
- trace(`${T$n} _handleBufferingEvents stall timeout`, {
42755
+ trace(`${T$m} _handleBufferingEvents stall timeout`, {
42756
42756
  buffering: this.buffering,
42757
42757
  ended: this.ended,
42758
42758
  });
@@ -42770,7 +42770,7 @@ class HTML5Video extends BasePlayback {
42770
42770
  super._handleBufferingEvents();
42771
42771
  }
42772
42772
  _onPlaying() {
42773
- trace(`${T$n} _onPlaying`);
42773
+ trace(`${T$m} _onPlaying`);
42774
42774
  if (this.stallTimerId) {
42775
42775
  clearTimeout(this.stallTimerId);
42776
42776
  this.stallTimerId = null;
@@ -42778,7 +42778,7 @@ class HTML5Video extends BasePlayback {
42778
42778
  super._onPlaying();
42779
42779
  }
42780
42780
  _onPause() {
42781
- trace(`${T$n} _onPause`);
42781
+ trace(`${T$m} _onPause`);
42782
42782
  super._onPause();
42783
42783
  if (this.stallTimerId) {
42784
42784
  clearTimeout(this.stallTimerId);
@@ -42788,7 +42788,7 @@ class HTML5Video extends BasePlayback {
42788
42788
  get audioTracks() {
42789
42789
  const tracks = this.el.audioTracks;
42790
42790
  const supported = !!tracks;
42791
- trace(`${T$n} get audioTracks`, { supported });
42791
+ trace(`${T$m} get audioTracks`, { supported });
42792
42792
  const retval = [];
42793
42793
  if (supported) {
42794
42794
  for (let i = 0; i < tracks.length; i++) {
@@ -42807,7 +42807,7 @@ class HTML5Video extends BasePlayback {
42807
42807
  get currentAudioTrack() {
42808
42808
  const tracks = this.el.audioTracks;
42809
42809
  const supported = !!tracks;
42810
- trace(`${T$n} get currentAudioTrack`, {
42810
+ trace(`${T$m} get currentAudioTrack`, {
42811
42811
  supported,
42812
42812
  });
42813
42813
  if (supported) {
@@ -42828,7 +42828,7 @@ class HTML5Video extends BasePlayback {
42828
42828
  switchAudioTrack(id) {
42829
42829
  const tracks = this.el.audioTracks;
42830
42830
  const supported = !!tracks;
42831
- trace(`${T$n} switchAudioTrack`, {
42831
+ trace(`${T$m} switchAudioTrack`, {
42832
42832
  supported,
42833
42833
  });
42834
42834
  if (supported) {
@@ -42847,7 +42847,7 @@ function registerPlaybacks() {
42847
42847
  Loader.registerPlayback(DashPlayback);
42848
42848
  }
42849
42849
 
42850
- const T$m = 'gplayer';
42850
+ const T$l = 'gplayer';
42851
42851
  const DEFAULT_OPTIONS = {
42852
42852
  autoPlay: false,
42853
42853
  debug: 'none',
@@ -42935,7 +42935,7 @@ class Player {
42935
42935
  * ```
42936
42936
  */
42937
42937
  attachTo(playerElement) {
42938
- trace(`${T$m} attachTo`, {
42938
+ trace(`${T$l} attachTo`, {
42939
42939
  player: !!this.player,
42940
42940
  });
42941
42941
  assert.ok(!this.player, 'Player already initialized');
@@ -42945,7 +42945,7 @@ class Player {
42945
42945
  }
42946
42946
  const coreOpts = this.buildCoreOptions(playerElement);
42947
42947
  const { core, container } = Player.getRegisteredPlugins();
42948
- trace(`${T$m} init`, {
42948
+ trace(`${T$l} init`, {
42949
42949
  registeredPlaybacks: Loader.registeredPlaybacks.map((p) => p.prototype.name),
42950
42950
  });
42951
42951
  coreOpts.plugins = {
@@ -42959,7 +42959,7 @@ class Player {
42959
42959
  * Destroys the player, releasing all resources and unmounting its UI from the DOM.
42960
42960
  */
42961
42961
  destroy() {
42962
- trace(`${T$m} destroy`, {
42962
+ trace(`${T$l} destroy`, {
42963
42963
  player: !!this.player,
42964
42964
  });
42965
42965
  if (this.player) {
@@ -43146,7 +43146,7 @@ class Player {
43146
43146
  this.config = $.extend(true, this.config, config);
43147
43147
  }
43148
43148
  initPlayer(coreOptions) {
43149
- trace(`${T$m} initPlayer`, {
43149
+ trace(`${T$l} initPlayer`, {
43150
43150
  autoPlay: coreOptions.autoPlay,
43151
43151
  sources: coreOptions.sources,
43152
43152
  player: !!this.player,
@@ -43171,7 +43171,7 @@ class Player {
43171
43171
  }
43172
43172
  }
43173
43173
  triggerAutoPlay() {
43174
- trace(`${T$m} triggerAutoPlay`);
43174
+ trace(`${T$l} triggerAutoPlay`);
43175
43175
  setTimeout(() => {
43176
43176
  this.player?.play({
43177
43177
  autoPlay: true,
@@ -43189,7 +43189,7 @@ class Player {
43189
43189
  // TODO test
43190
43190
  events = {
43191
43191
  onReady: () => {
43192
- trace(`${T$m} onReady`, {
43192
+ trace(`${T$l} onReady`, {
43193
43193
  ready: this.ready,
43194
43194
  });
43195
43195
  if (this.ready) {
@@ -43223,7 +43223,7 @@ class Player {
43223
43223
  buildCoreOptions(rootNode) {
43224
43224
  const sources = this.buildMediaSourcesList();
43225
43225
  const source = sources[0];
43226
- trace(`${T$m} buildCoreOptions`, {
43226
+ trace(`${T$l} buildCoreOptions`, {
43227
43227
  source,
43228
43228
  sources,
43229
43229
  });
@@ -43284,7 +43284,7 @@ class Player {
43284
43284
  assert.ok(this.player, 'Player is not initialized');
43285
43285
  const core = this.player.core;
43286
43286
  core.on(Events$1.CORE_SCREEN_ORIENTATION_CHANGED, ({ orientation }) => {
43287
- trace(`${T$m} on CORE_SCREEN_ORIENTATION_CHANGED`, {
43287
+ trace(`${T$l} on CORE_SCREEN_ORIENTATION_CHANGED`, {
43288
43288
  orientation,
43289
43289
  rootNode: {
43290
43290
  width: this.rootNode?.clientWidth,
@@ -43299,14 +43299,14 @@ class Player {
43299
43299
  }
43300
43300
  }, null);
43301
43301
  core.on(Events$1.CORE_RESIZE, ({ width, height }) => {
43302
- trace(`${T$m} on CORE_RESIZE`, {
43302
+ trace(`${T$l} on CORE_RESIZE`, {
43303
43303
  width,
43304
43304
  height,
43305
43305
  });
43306
43306
  this.safeTriggerEvent(PlayerEvent.Resize, { width, height });
43307
43307
  }, null);
43308
43308
  core.on(Events$1.CORE_FULLSCREEN, (isFullscreen) => {
43309
- trace(`${T$m} CORE_FULLSCREEN`, {
43309
+ trace(`${T$l} CORE_FULLSCREEN`, {
43310
43310
  isFullscreen,
43311
43311
  });
43312
43312
  this.safeTriggerEvent(PlayerEvent.Fullscreen, isFullscreen);
@@ -43314,7 +43314,7 @@ class Player {
43314
43314
  }
43315
43315
  }
43316
43316
 
43317
- var version$1 = "2.25.6";
43317
+ var version$1 = "2.25.8";
43318
43318
 
43319
43319
  var packages = {
43320
43320
  "node_modules/@clappr/core": {
@@ -43338,7 +43338,7 @@ function version() {
43338
43338
  };
43339
43339
  }
43340
43340
 
43341
- const pluginHtml$6 = "<button data-audiotracks-button class='gcore-skin-button-color' id=\"audiotracks-button\" aria-haspopup=\"menu\" aria-expanded=\"false\">\n <span class='audio-text'><%= title %></span> <span class=\"audio-arrow\"><%= icon %></span>\n</button>\n<ul class='gcore-skin-bg-color menu hidden' id=\"audiotracks-select\" role=\"menu\">\n <% for (const track of tracks) { %>\n <li>\n <a href=\"#\" class='gcore-skin-text-color' data-audiotracks-select=\"<%= track.id %>\" role=\"menuitemradio\" aria-checked=\"<%= track.id === current %>\">\n <%= track.label %>\n </a>\n </li>\n <% }; %>\n</ul>\n";
43341
+ const pluginHtml$6 = "<button class='gcore-skin-button-color media-control-dd' id=\"gplayer-audiotracks-button\" aria-haspopup=\"menu\" aria-expanded=\"false\">\n <span class=\"media-control-dd__text\" id=\"gplayer-audiotracks-button-text\"><%= title %></span>\n <span class=\"media-control-dd__arrow\"><%= icon %></span>\n</button>\n<ul class=\"gcore-skin-bg-color menu media-control-dd__popup\" id=\"gplayer-audiotracks-menu\" role=\"menu\">\n <% for (const track of tracks) { %>\n <li>\n <a href=\"#\" class=\"gcore-skin-text-color\" data-item=\"<%= track.id %>\" role=\"menuitemradio\" aria-checked=\"<%= track.id === current %>\">\n <%= track.label %>\n </a>\n </li>\n <% }; %>\n</ul>\n";
43342
43342
 
43343
43343
  const audioArrow = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"9px\" height=\"6px\" viewBox=\"0 0 9 6\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <!-- Generator: Sketch 49 (51002) - http://www.bohemiancoding.com/sketch -->\n <title>quality-arrow</title>\n <desc>Created with Sketch.</desc>\n <defs></defs>\n <g id=\"quality-arrow\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <path\n d=\"M5.07079194,5.78553848 C4.91457318,5.94277844 4.70551573,6.00941824 4.50028717,5.99893557 C4.2950586,6.00941824 4.08676693,5.94277844 3.92978239,5.78553848 L0.221118462,1.2997069 C-0.0737061539,1.00469478 -0.0737061539,0.526236029 0.221118462,0.231972666 C0.515177299,-0.0630394586 1.23500883,0.00734414472 1.64852907,0.00734414472 L7.77475484,0.00734414472 C8.21201421,0.00734414472 8.48539703,-0.0630394586 8.77945587,0.231972666 C9.07351471,0.526236029 9.07351471,1.00469478 8.77945587,1.2997069 L5.07079194,5.78553848 Z\"\n fill=\"#FFFFFE\"></path>\n </g>\n</svg>\n";
43344
43344
 
@@ -43632,6 +43632,7 @@ const STANDARD_MEDIA_CONTROL_ELEMENTS = [
43632
43632
  'seekbar',
43633
43633
  'volume',
43634
43634
  ];
43635
+ const MENU_VMARGIN = 12;
43635
43636
  // TODO export
43636
43637
  const DEFAULT_SETTINGS = {
43637
43638
  default: ['seekbar'],
@@ -43649,7 +43650,7 @@ const INITIAL_SETTINGS = {
43649
43650
  default: [],
43650
43651
  seekEnabled: false,
43651
43652
  };
43652
- const T$l = 'plugins.media_control';
43653
+ const T$k = 'plugins.media_control';
43653
43654
  /**
43654
43655
  * Extended events for the {@link MediaControl} plugin
43655
43656
  * @beta
@@ -43931,7 +43932,7 @@ class MediaControl extends UICorePlugin {
43931
43932
  * Hides the media control UI
43932
43933
  */
43933
43934
  disable() {
43934
- trace(`${T$l} disable`);
43935
+ trace(`${T$k} disable`);
43935
43936
  this.userDisabled = true; // TODO distinguish between user and system (e.g., unplayable) disabled?
43936
43937
  this.hide();
43937
43938
  this.unbindKeyEvents();
@@ -43941,7 +43942,7 @@ class MediaControl extends UICorePlugin {
43941
43942
  * Reenables the plugin disabled earlier with the {@link MediaControl.disable} method
43942
43943
  */
43943
43944
  enable() {
43944
- trace(`${T$l} enable`);
43945
+ trace(`${T$k} enable`);
43945
43946
  if (this.options.chromeless) {
43946
43947
  return;
43947
43948
  }
@@ -43958,6 +43959,12 @@ class MediaControl extends UICorePlugin {
43958
43959
  getAvailableHeight() {
43959
43960
  return (this.core.$el.height() - this.$el.find('.media-control-layer').height());
43960
43961
  }
43962
+ /**
43963
+ * @returns Vertical space available to render a popup menu
43964
+ */
43965
+ getAvailablePopupHeight() {
43966
+ return this.getAvailableHeight() - MENU_VMARGIN * 2;
43967
+ }
43961
43968
  /**
43962
43969
  * Set the initial volume, which is preserved when playback is interrupted by an advertisement
43963
43970
  */
@@ -44490,7 +44497,7 @@ class MediaControl extends UICorePlugin {
44490
44497
  const panel = this.getElementLocation(name);
44491
44498
  if (panel) {
44492
44499
  element.attr(`data-${name}`, '');
44493
- element.addClass('gplayer-mc-panel-item');
44500
+ element.addClass('media-control-item');
44494
44501
  mountTo(panel, element);
44495
44502
  }
44496
44503
  }
@@ -44871,7 +44878,7 @@ function mergeElements(a, b) {
44871
44878
  }
44872
44879
 
44873
44880
  const VERSION$7 = '2.22.4';
44874
- const T$k = 'plugins.audiotracks';
44881
+ // const T = 'plugins.audiotracks'
44875
44882
  /**
44876
44883
  * `PLUGIN` that makes possible to switch audio tracks via the media control UI.
44877
44884
  * @beta
@@ -44884,6 +44891,7 @@ const T$k = 'plugins.audiotracks';
44884
44891
  */
44885
44892
  class AudioTracks extends UICorePlugin {
44886
44893
  currentTrack = null;
44894
+ open = false;
44887
44895
  tracks = [];
44888
44896
  /**
44889
44897
  * @internal
@@ -44909,7 +44917,7 @@ class AudioTracks extends UICorePlugin {
44909
44917
  */
44910
44918
  get attributes() {
44911
44919
  return {
44912
- class: 'media-control-audiotracks',
44920
+ class: 'media-control-audiotracks media-control-dd__wrap',
44913
44921
  };
44914
44922
  }
44915
44923
  /**
@@ -44917,8 +44925,8 @@ class AudioTracks extends UICorePlugin {
44917
44925
  */
44918
44926
  get events() {
44919
44927
  return {
44920
- 'click [data-audiotracks-select]': 'onTrackSelect',
44921
- 'click #audiotracks-button': 'toggleMenu',
44928
+ 'click #gplayer-audiotracks-menu [data-item]': 'onTrackSelect',
44929
+ 'click #gplayer-audiotracks-button': 'toggleMenu',
44922
44930
  };
44923
44931
  }
44924
44932
  /**
@@ -44932,8 +44940,9 @@ class AudioTracks extends UICorePlugin {
44932
44940
  const mediaControl = this.core.getPlugin('media_control');
44933
44941
  assert(mediaControl, 'media_control plugin is required');
44934
44942
  this.listenTo(mediaControl, Events$1.MEDIACONTROL_RENDERED, () => {
44935
- mediaControl.slot('audiotracks', this.$el);
44943
+ this.mount();
44936
44944
  });
44945
+ // TODO when tracks change, re-render and re-attach
44937
44946
  this.listenTo(mediaControl, Events$1.MEDIACONTROL_HIDE, this.hideMenu);
44938
44947
  this.listenTo(mediaControl, ExtendedEvents.MEDIACONTROL_MENU_COLLAPSE, (from) => {
44939
44948
  if (from !== this.name) {
@@ -44948,6 +44957,7 @@ class AudioTracks extends UICorePlugin {
44948
44957
  tracks.find((track) => track.kind === 'main') ?? null; // TODO test
44949
44958
  this.tracks = tracks;
44950
44959
  this.render();
44960
+ this.mount();
44951
44961
  });
44952
44962
  this.listenTo(this.core.activeContainer, Events$1.CONTAINER_AUDIO_CHANGED, (track) => {
44953
44963
  this.currentTrack = track;
@@ -44955,6 +44965,10 @@ class AudioTracks extends UICorePlugin {
44955
44965
  this.buttonElement().removeClass('changing');
44956
44966
  this.updateText();
44957
44967
  });
44968
+ // TODO test
44969
+ this.listenTo(this.core.activeContainer, Events$1.CONTAINER_CLICK, () => {
44970
+ this.hideMenu();
44971
+ });
44958
44972
  }
44959
44973
  shouldRender() {
44960
44974
  // Render is called from the parent class constructor so tracks aren't available
@@ -44965,21 +44979,19 @@ class AudioTracks extends UICorePlugin {
44965
44979
  * @internal
44966
44980
  */
44967
44981
  render() {
44968
- if (!this.shouldRender()) {
44969
- return this;
44970
- }
44971
44982
  this.$el.html(AudioTracks.template({
44972
- tracks: this.tracks,
44983
+ tracks: this.tracks ?? [],
44973
44984
  title: this.getTitle(),
44974
44985
  icon: audioArrow,
44975
44986
  current: this.currentTrack?.id,
44976
44987
  }));
44988
+ this.$el.find('#gplayer-audiotracks-menu').hide();
44977
44989
  this.updateText();
44978
44990
  this.highlightCurrentTrack();
44979
44991
  return this;
44980
44992
  }
44981
44993
  onTrackSelect(event) {
44982
- const id = event.currentTarget?.dataset?.audiotracksSelect;
44994
+ const id = event.currentTarget?.dataset?.item;
44983
44995
  if (id) {
44984
44996
  this.selectAudioTrack(id);
44985
44997
  }
@@ -44993,25 +45005,34 @@ class AudioTracks extends UICorePlugin {
44993
45005
  this.updateText();
44994
45006
  }
44995
45007
  hideMenu() {
44996
- trace(`${T$k} hideMenu`);
44997
- this.$el.find('#audiotracks-select').addClass('hidden');
44998
- this.$el.find('#audiotracks-button').attr('aria-expanded', 'false');
45008
+ this.open = false;
45009
+ this.$el.find('#gplayer-audiotracks-menu').hide();
45010
+ this.$el.find('#gplayer-audiotracks-button').attr('aria-expanded', 'false');
44999
45011
  }
45000
45012
  toggleMenu() {
45001
- this.core.getPlugin('media_control').trigger(ExtendedEvents.MEDIACONTROL_MENU_COLLAPSE, this.name);
45002
- this.$el.find('#audiotracks-select').toggleClass('hidden'); // TODO use plain CSS display: none
45003
- const open = !this.$el.find('#audiotracks-select').hasClass('hidden'); // TODO hold state
45004
- this.$el.find('#audiotracks-button').attr('aria-expanded', open);
45013
+ this.open = !this.open;
45014
+ this.core
45015
+ .getPlugin('media_control')
45016
+ .trigger(ExtendedEvents.MEDIACONTROL_MENU_COLLAPSE, this.name);
45017
+ if (this.open) {
45018
+ this.$el.find('#gplayer-audiotracks-menu').show();
45019
+ }
45020
+ else {
45021
+ this.$el.find('#gplayer-audiotracks-menu').hide();
45022
+ }
45023
+ this.$el
45024
+ .find('#gplayer-audiotracks-button')
45025
+ .attr('aria-expanded', this.open);
45005
45026
  }
45006
45027
  buttonElement() {
45007
- return this.$('button');
45028
+ return this.$('#gplayer-audiotracks-button');
45008
45029
  }
45009
45030
  buttonElementText() {
45010
- return this.$('button .audio-text');
45031
+ return this.$el.find('#gplayer-audiotracks-button-text');
45011
45032
  }
45012
45033
  trackElement(id) {
45013
- return this.$('#audiotracks-select a' +
45014
- (id !== undefined ? `[data-audiotracks-select="${id}"]` : '')).parent();
45034
+ return this.$('#gplayer-audiotracks-menu a' +
45035
+ (id !== undefined ? `[data-item="${id}"]` : '')).parent();
45015
45036
  }
45016
45037
  getTitle() {
45017
45038
  if (!this.currentTrack) {
@@ -45042,6 +45063,11 @@ class AudioTracks extends UICorePlugin {
45042
45063
  .attr('aria-checked', 'true');
45043
45064
  }
45044
45065
  }
45066
+ mount() {
45067
+ if (this.shouldRender()) {
45068
+ this.core.getPlugin('media_control')?.slot('audiotracks', this.$el);
45069
+ }
45070
+ }
45045
45071
  }
45046
45072
 
45047
45073
  const templateHtml$2 = "<div class=\"big-mute-icon-wrapper\" data-big-mute id=\"gplayer-big-mute-button\">\n <div class=\"big-mute-icon gcore-skin-border-color\" data-big-mute-icon id=\"gplayer-big-mute-icon\"></div>\n</div>\n";
@@ -45195,7 +45221,6 @@ const gearHdIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\
45195
45221
 
45196
45222
  const VERSION$6 = '2.19.12';
45197
45223
  const T$i = 'plugins.bottom_gear';
45198
- const MENU_VMARGIN = 12;
45199
45224
  const MENU_BACKLINK_HEIGHT = 44;
45200
45225
  /**
45201
45226
  * Events triggered by the plugin
@@ -45360,7 +45385,7 @@ class BottomGear extends UICorePlugin {
45360
45385
  .appendTo(this.$el.find('#gear-options-wrapper'));
45361
45386
  $item.on('click', (e) => {
45362
45387
  e.stopPropagation();
45363
- this.alignSubmenu($subMenu);
45388
+ this.clampPopup($subMenu);
45364
45389
  $subMenu.show();
45365
45390
  this.$el.find('#gear-options').hide();
45366
45391
  });
@@ -45457,9 +45482,8 @@ class BottomGear extends UICorePlugin {
45457
45482
  const mediaControl = this.core.getPlugin('media_control');
45458
45483
  mediaControl.slot('gear', this.$el);
45459
45484
  }
45460
- alignSubmenu($subMenu) {
45461
- const availableHeight = this.core.getPlugin('media_control').getAvailableHeight() -
45462
- MENU_VMARGIN * 2;
45485
+ clampPopup($subMenu) {
45486
+ const availableHeight = this.core.getPlugin('media_control').getAvailablePopupHeight();
45463
45487
  $subMenu.css('max-height', `${availableHeight}px`);
45464
45488
  $subMenu
45465
45489
  .find('.gear-sub-menu')
@@ -51608,9 +51632,9 @@ const subtitlesOffIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"
51608
51632
 
51609
51633
  const subtitlesOnIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M16.238 16.1C13.979 16.1 12.578 14.538 12.578 11.997C12.578 9.462 13.973 7.9 16.238 7.9C18.087 7.9 19.5029 9.127 19.6219 10.824H18.032C17.876 9.927 17.168 9.338 16.238 9.338C15.011 9.338 14.249 10.354 14.249 11.997C14.249 13.641 15.011 14.662 16.243 14.662C17.178 14.662 17.881 14.111 18.038 13.251H19.627C19.492 14.938 18.119 16.1 16.238 16.1ZM8.03198 16.1C5.77298 16.1 4.37299 14.538 4.37299 11.997C4.37299 9.462 5.76798 7.9 8.03198 7.9C9.88098 7.9 11.298 9.127 11.416 10.824H9.82697C9.67097 9.927 8.96198 9.338 8.03198 9.338C6.80598 9.338 6.04297 10.354 6.04297 11.997C6.04297 13.641 6.80596 14.662 8.03796 14.662C8.97296 14.662 9.67601 14.111 9.83301 13.251H11.422C11.287 14.938 9.91398 16.1 8.03198 16.1ZM22.5 3H1.5C0.672 3 0 3.671 0 4.5V19.5C0 20.329 0.672 21 1.5 21H22.5C23.329 21 24 20.329 24 19.5V4.5C24 3.671 23.329 3 22.5 3Z\"\n fill=\"#C9C9C9\"/>\n <rect y=\"22\" width=\"24\" height=\"2\" rx=\"1\" fill=\"#F6413B\"/>\n</svg>\n";
51610
51634
 
51611
- const comboboxHTML = "<button data-cc-button class='media-control-button media-control-icon gcore-skin-button-color' id=\"cc-button\">\n <span class='cc-text'></span>\n</button>\n\n<ul class='gcore-skin-bg-color' id=\"cc-select\">\n <% for (const t of tracks) { %>\n <li>\n <a href=\"#\" class='gcore-skin-text-color' data-cc-select=\"<%= t.id %>\">\n <%= t.name %>\n </a>\n </li>\n <% } %>\n <li><a href=\"#\" class='gcore-skin-text-color' data-cc-select=\"-1\"><%= i18n.t('off') %></a></li>\n</ul>\n";
51635
+ const comboboxHTML = "<button\n class='media-control-button media-control-icon gcore-skin-button-color media-control-dd'\n id=\"gplayer-cc-button\"\n aria-haspopup=\"menu\"\n aria-expanded=\"false\"\n aria-controls=\"gplayer-cc-menu\"\n>\n</button>\n\n<ul class='gcore-skin-bg-color media-control-dd__popup' id=\"gplayer-cc-menu\" role=\"menu\">\n <% for (const t of tracks) { %>\n <li>\n <a\n href=\"#\"\n class=\"gcore-skin-text-color\"\n data-item=\"<%= t.id %>\"\n role=\"menuitemradio\"\n aria-checked=\"<%= t.id === current %>\"\n >\n <%= t.name %>\n </a>\n </li>\n <% } %>\n <li class=\"current\">\n <a\n href=\"#\"\n class='gcore-skin-text-color gcore-skin-active'\n data-item=\"-1\"\n role=\"menuitemradio\"\n aria-checked=\"<%= current === -1 %>\"\n >\n <%= i18n.t('off') %>\n </a>\n </li>\n</ul>";
51612
51636
 
51613
- const stringHTML = "<div class=\"cc-line\" id=\"cc-line\">\n <p></p>\n</div>\n";
51637
+ const stringHTML = "<div class=\"gplayer-cc-line\" id=\"gplayer-cc-line\">\n <p></p>\n</div>\n";
51614
51638
 
51615
51639
  const VERSION = '2.19.14';
51616
51640
  const LOCAL_STORAGE_CC_ID = 'gplayer.plugins.cc.selected';
@@ -51645,6 +51669,7 @@ const T$3 = 'plugins.cc';
51645
51669
  class ClosedCaptions extends UICorePlugin {
51646
51670
  isPreselectedApplied = false;
51647
51671
  active = false;
51672
+ open = false;
51648
51673
  track = null;
51649
51674
  tracks = [];
51650
51675
  $line = null;
@@ -51666,14 +51691,14 @@ class ClosedCaptions extends UICorePlugin {
51666
51691
  static get version() {
51667
51692
  return VERSION;
51668
51693
  }
51669
- static template = tmpl(comboboxHTML);
51670
- static templateString = tmpl(stringHTML);
51694
+ static templateControl = tmpl(comboboxHTML);
51695
+ static templateLine = tmpl(stringHTML);
51671
51696
  /**
51672
51697
  * @internal
51673
51698
  */
51674
51699
  get attributes() {
51675
51700
  return {
51676
- class: 'media-control-cc',
51701
+ class: 'media-control-cc media-control-dd__wrap',
51677
51702
  };
51678
51703
  }
51679
51704
  /**
@@ -51681,8 +51706,8 @@ class ClosedCaptions extends UICorePlugin {
51681
51706
  */
51682
51707
  get events() {
51683
51708
  return {
51684
- 'click #cc-select li a': 'onItemSelect',
51685
- 'click #cc-button': 'toggleMenu',
51709
+ 'click #gplayer-cc-menu [data-item]': 'onItemSelect',
51710
+ 'click #gplayer-cc-button': 'toggleMenu',
51686
51711
  };
51687
51712
  }
51688
51713
  get preselectedLanguage() {
@@ -51699,10 +51724,9 @@ class ClosedCaptions extends UICorePlugin {
51699
51724
  this.listenTo(this.core, Events$1.CORE_ACTIVE_CONTAINER_CHANGED, this.onContainerChanged);
51700
51725
  }
51701
51726
  onCoreReady() {
51702
- trace(`${T$3} onCoreReady`);
51703
51727
  const mediaControl = this.core.getPlugin('media_control');
51704
51728
  assert(mediaControl, 'media_control plugin is required');
51705
- this.listenTo(mediaControl, Events$1.MEDIACONTROL_RENDERED, this.render); // TODO mount to media control
51729
+ this.listenTo(mediaControl, Events$1.MEDIACONTROL_RENDERED, this.mount);
51706
51730
  this.listenTo(mediaControl, Events$1.MEDIACONTROL_HIDE, () => {
51707
51731
  this.hideMenu();
51708
51732
  });
@@ -51713,11 +51737,14 @@ class ClosedCaptions extends UICorePlugin {
51713
51737
  });
51714
51738
  }
51715
51739
  onContainerChanged() {
51716
- trace(`${T$3} onContainerChanged`);
51717
51740
  this.listenTo(this.core.activeContainer, Events$1.CONTAINER_FULLSCREEN, this.playerResize);
51718
51741
  this.listenTo(this.core.activeContainer, 'container:advertisement:start', this.onStartAd);
51719
51742
  this.listenTo(this.core.activePlayback, Events$1.PLAYBACK_SUBTITLE_AVAILABLE, this.onSubtitleAvailable);
51720
51743
  this.listenTo(this.core.activePlayback, Events$1.PLAYBACK_SUBTITLE_CHANGED, this.onSubtitleChanged);
51744
+ this.listenTo(this.core.activeContainer, Events$1.CONTAINER_CLICK, () => {
51745
+ // TODO test
51746
+ this.hideMenu();
51747
+ });
51721
51748
  // fix for iOS
51722
51749
  const video = this.core.activePlayback.el;
51723
51750
  assert(video, 'video element is required');
@@ -51735,6 +51762,7 @@ class ClosedCaptions extends UICorePlugin {
51735
51762
  onSubtitleAvailable() {
51736
51763
  trace(`${T$3} onSubtitleAvailable`);
51737
51764
  this.applyTracks();
51765
+ this.mount();
51738
51766
  }
51739
51767
  onSubtitleChanged({ id }) {
51740
51768
  trace(`${T$3} onSubtitleChanged`, { id });
@@ -51799,6 +51827,7 @@ class ClosedCaptions extends UICorePlugin {
51799
51827
  }
51800
51828
  try {
51801
51829
  this.resizeFont();
51830
+ this.clampPopup();
51802
51831
  }
51803
51832
  catch (error) {
51804
51833
  reportError(error);
@@ -51809,7 +51838,10 @@ class ClosedCaptions extends UICorePlugin {
51809
51838
  */
51810
51839
  hide() {
51811
51840
  this.active = false;
51841
+ this.open = false;
51812
51842
  this.renderIcon();
51843
+ this.$el.find('#gplayer-cc-menu').hide();
51844
+ this.$el.find('#gplayer-cc-button').attr('aria-expanded', 'false');
51813
51845
  this.$line.hide();
51814
51846
  if (this.tracks) {
51815
51847
  for (const t of this.tracks) {
@@ -51852,17 +51884,18 @@ class ClosedCaptions extends UICorePlugin {
51852
51884
  if (!this.core.activeContainer) {
51853
51885
  return this;
51854
51886
  }
51855
- if (!this.shouldRender()) {
51856
- return this;
51857
- }
51858
- const mediaControl = this.core.getPlugin('media_control');
51859
- this.$el.html(ClosedCaptions.template({ tracks: this.tracks, i18n: this.core.i18n }));
51860
- this.$el.find('#cc-select').hide();
51861
- this.core.activeContainer.$el.find('#cc-line').remove();
51862
- this.$line = $(ClosedCaptions.templateString());
51887
+ this.$el.html(ClosedCaptions.templateControl({
51888
+ tracks: this.tracks ?? [],
51889
+ i18n: this.core.i18n,
51890
+ current: this.track?.id ?? -1,
51891
+ }));
51892
+ this.$el.find('#gplayer-cc-menu').hide();
51893
+ this.open = false;
51894
+ this.core.activeContainer.$el.find('#gplayer-cc-line').remove();
51895
+ this.$line = $(ClosedCaptions.templateLine());
51863
51896
  this.resizeFont();
51897
+ this.clampPopup();
51864
51898
  this.core.activeContainer.$el.append(this.$line);
51865
- mediaControl.slot('cc', this.$el);
51866
51899
  this.updateSelection();
51867
51900
  this.renderIcon();
51868
51901
  return this;
@@ -51876,9 +51909,10 @@ class ClosedCaptions extends UICorePlugin {
51876
51909
  this.updateSelection();
51877
51910
  }
51878
51911
  onItemSelect(event) {
51879
- const id = event.target.dataset.ccSelect ?? '-1';
51880
- trace(`${T$3} onItemSelect`, { id });
51881
- localStorage.setItem(LOCAL_STORAGE_CC_ID, id);
51912
+ // event.target does not exist for some reason in tests
51913
+ const id = (event.target ?? event.currentTarget).dataset?.item ??
51914
+ '-1';
51915
+ localStorage.setItem(LOCAL_STORAGE_CC_ID, id); // TODO store language instead
51882
51916
  this.selectItem(this.findById(Number(id)));
51883
51917
  this.hideMenu();
51884
51918
  return false;
@@ -51895,26 +51929,33 @@ class ClosedCaptions extends UICorePlugin {
51895
51929
  }
51896
51930
  }
51897
51931
  hideMenu() {
51898
- trace(`${T$3} hideMenu`);
51899
- this.$el.find('#cc-select').hide();
51932
+ this.open = false;
51933
+ this.$el.find('#gplayer-cc-menu').hide();
51934
+ this.$el.find('#gplayer-cc-button').attr('aria-expanded', 'false');
51900
51935
  }
51901
51936
  toggleMenu() {
51902
- trace(`${T$3} toggleMenu`, { display: this.$el.find('#cc-select').css('display') });
51903
51937
  this.core
51904
51938
  .getPlugin('media_control')
51905
51939
  .trigger(ExtendedEvents.MEDIACONTROL_MENU_COLLAPSE, this.name);
51906
- this.$el.find('#cc-select').toggle();
51907
- // TODO hold state, add aria-expanded to the button, add active state to the button
51940
+ this.open = !this.open;
51941
+ if (this.open) {
51942
+ this.$el.find('#gplayer-cc-menu').show();
51943
+ }
51944
+ else {
51945
+ this.$el.find('#gplayer-cc-menu').hide();
51946
+ }
51947
+ this.$el.find('#gplayer-cc-button').attr('aria-expanded', this.open);
51908
51948
  }
51909
51949
  itemElement(id) {
51910
- return this.$el.find(`#cc-select li a[data-cc-select="${id}"]`).parent();
51950
+ // TODO fix semantically
51951
+ return this.$el.find(`#gplayer-cc-menu [data-item="${id}"]`).parent();
51911
51952
  }
51912
51953
  allItemElements() {
51913
- return this.$('#cc-select li');
51954
+ return this.$el.find('#gplayer-cc-menu li'); // TODO fix semantically
51914
51955
  }
51915
51956
  selectSubtitles() {
51916
51957
  const trackId = this.track ? this.track.id : -1;
51917
- this.core.activePlayback.closedCaptionsTrackId = trackId;
51958
+ this.core.activePlayback.closedCaptionsTrackId = trackId; // TODO test
51918
51959
  }
51919
51960
  getSubtitleText(track) {
51920
51961
  const currentTime = this.core.activePlayback?.getCurrentTime() ?? 0;
@@ -51924,6 +51965,7 @@ class ClosedCaptions extends UICorePlugin {
51924
51965
  for (const cue of cues) {
51925
51966
  if (currentTime >= cue.startTime && currentTime <= cue.endTime) {
51926
51967
  lines.push(cue.getCueAsHTML().textContent);
51968
+ // TODO break?
51927
51969
  }
51928
51970
  }
51929
51971
  }
@@ -51949,19 +51991,31 @@ class ClosedCaptions extends UICorePlugin {
51949
51991
  this.allItemElements()
51950
51992
  .removeClass('current')
51951
51993
  .find('a')
51952
- .removeClass('gcore-skin-active');
51953
- trace(`${T$3} highlightCurrentSubtitles`, {
51954
- track: this.track?.id,
51955
- });
51994
+ .removeClass('gcore-skin-active')
51995
+ .attr('aria-checked', 'false');
51956
51996
  const currentLevelElement = this.itemElement(this.track ? this.track.id : -1);
51957
51997
  currentLevelElement
51958
51998
  .addClass('current')
51959
51999
  .find('a')
51960
- .addClass('gcore-skin-active');
52000
+ .addClass('gcore-skin-active')
52001
+ .attr('aria-checked', 'true');
51961
52002
  }
51962
52003
  renderIcon() {
52004
+ // render both icons at once
51963
52005
  const icon = this.active ? subtitlesOnIcon : subtitlesOffIcon;
51964
- this.$el.find('span.cc-text').html(icon);
52006
+ this.$el.find('#gplayer-cc-button').html(icon);
52007
+ }
52008
+ clampPopup() {
52009
+ const availableHeight = this.core
52010
+ .getPlugin('media_control')
52011
+ .getAvailablePopupHeight();
52012
+ this.$el.find('#gplayer-cc-menu').css('max-height', `${availableHeight}px`);
52013
+ }
52014
+ mount() {
52015
+ if (this.shouldRender()) {
52016
+ const mediaControl = this.core.getPlugin('media_control');
52017
+ mediaControl.slot('cc', this.$el);
52018
+ }
51965
52019
  }
51966
52020
  }
51967
52021