@gcorevideo/player 2.22.3 → 2.22.5

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 (39) hide show
  1. package/assets/audio-selector/style.scss +4 -2
  2. package/assets/audio-selector/track-selector.ejs +2 -2
  3. package/assets/level-selector/button.ejs +1 -1
  4. package/assets/level-selector/list.ejs +10 -4
  5. package/assets/level-selector/style.scss +8 -3
  6. package/dist/core.js +1 -1
  7. package/dist/index.css +1435 -1429
  8. package/dist/index.js +402 -419
  9. package/dist/plugins/index.css +1192 -1186
  10. package/dist/plugins/index.js +428 -438
  11. package/lib/index.plugins.d.ts +3 -1
  12. package/lib/index.plugins.d.ts.map +1 -1
  13. package/lib/index.plugins.js +3 -1
  14. package/lib/plugins/audio-selector/AudioSelector.d.ts +3 -9
  15. package/lib/plugins/audio-selector/AudioSelector.d.ts.map +1 -1
  16. package/lib/plugins/audio-selector/AudioSelector.js +34 -57
  17. package/lib/plugins/level-selector/LevelSelector.d.ts +6 -5
  18. package/lib/plugins/level-selector/LevelSelector.d.ts.map +1 -1
  19. package/lib/plugins/level-selector/LevelSelector.js +11 -8
  20. package/lib/plugins/level-selector/QualityLevels.d.ts +112 -0
  21. package/lib/plugins/level-selector/QualityLevels.d.ts.map +1 -0
  22. package/lib/plugins/level-selector/QualityLevels.js +280 -0
  23. package/lib/plugins/vast-ads/VastAds.d.ts +1 -0
  24. package/lib/plugins/vast-ads/VastAds.d.ts.map +1 -1
  25. package/lib/plugins/vast-ads/VastAds.js +6 -3
  26. package/lib/testUtils.d.ts +2 -0
  27. package/lib/testUtils.d.ts.map +1 -1
  28. package/lib/testUtils.js +2 -0
  29. package/package.json +1 -1
  30. package/src/index.plugins.ts +3 -1
  31. package/src/plugins/audio-selector/AudioSelector.ts +36 -72
  32. package/src/plugins/audio-selector/__tests__/AudioSelector.test.ts +176 -0
  33. package/src/plugins/audio-selector/__tests__/__snapshots__/AudioSelector.test.ts.snap +67 -0
  34. package/src/plugins/level-selector/{LevelSelector.ts → QualityLevels.ts} +19 -13
  35. package/src/plugins/level-selector/__tests__/{LevelSelector.test.ts → QualityLevels.test.ts} +20 -6
  36. package/src/plugins/level-selector/__tests__/__snapshots__/{LevelSelector.test.ts.snap → QualityLevels.test.ts.snap} +58 -25
  37. package/src/plugins/vast-ads/VastAds.ts +8 -4
  38. package/src/testUtils.ts +2 -0
  39. package/tsconfig.tsbuildinfo +1 -1
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$l = 'playback.dash';
12683
+ const T$k = 'playback.dash';
12684
12684
  class DashPlayback extends BasePlayback {
12685
12685
  _levels = null;
12686
12686
  _currentLevel = null;
@@ -12956,10 +12956,10 @@ class DashPlayback extends BasePlayback {
12956
12956
  }
12957
12957
  _onPlaybackError = (event) => {
12958
12958
  // TODO
12959
- trace(`${T$l} _onPlaybackError`, { event });
12959
+ trace(`${T$k} _onPlaybackError`, { event });
12960
12960
  };
12961
12961
  _onDASHJSSError = (event) => {
12962
- trace(`${T$l} _onDASHJSSError`, { event });
12962
+ trace(`${T$k} _onDASHJSSError`, { event });
12963
12963
  this._stopTimeUpdateTimer();
12964
12964
  // Note that the other error types are deprecated
12965
12965
  const e = event.error;
@@ -12994,7 +12994,7 @@ class DashPlayback extends BasePlayback {
12994
12994
  }
12995
12995
  };
12996
12996
  triggerError(error) {
12997
- trace(`${T$l} triggerError`, { error });
12997
+ trace(`${T$k} triggerError`, { error });
12998
12998
  // this triggers Events.ERROR to be handled by the UI
12999
12999
  this.trigger(Events$1.PLAYBACK_ERROR, this.createError(error, {
13000
13000
  useCodePrefix: false,
@@ -13033,7 +13033,7 @@ class DashPlayback extends BasePlayback {
13033
13033
  }
13034
13034
  get dvrEnabled() {
13035
13035
  if (!this._dash) {
13036
- trace(`${T$l} dvrEnable no dash player instance`);
13036
+ trace(`${T$k} dvrEnable no dash player instance`);
13037
13037
  return false;
13038
13038
  }
13039
13039
  return (this._dash?.getDVRWindowSize() >= this._minDvrSize &&
@@ -13055,7 +13055,7 @@ class DashPlayback extends BasePlayback {
13055
13055
  this.trigger(Events$1.PLAYBACK_PROGRESS, progress, {});
13056
13056
  }
13057
13057
  play() {
13058
- trace(`${T$l} play`, { dash: !!this._dash });
13058
+ trace(`${T$k} play`, { dash: !!this._dash });
13059
13059
  if (!this._dash) {
13060
13060
  this._setup();
13061
13061
  }
@@ -13141,7 +13141,7 @@ class DashPlayback extends BasePlayback {
13141
13141
  }
13142
13142
  // @ts-expect-error
13143
13143
  get currentAudioTrack() {
13144
- trace(`${T$l} get currentAudioTrack`);
13144
+ trace(`${T$k} get currentAudioTrack`);
13145
13145
  assert.ok(this._dash, 'DASH.js MediaPlayer is not initialized');
13146
13146
  const t = this._dash.getCurrentTrackFor('audio');
13147
13147
  if (!t) {
@@ -41842,7 +41842,7 @@ const AUTO = -1;
41842
41842
  const DEFAULT_RECOVER_ATTEMPTS = 16;
41843
41843
  Events$1.register('PLAYBACK_FRAGMENT_CHANGED');
41844
41844
  Events$1.register('PLAYBACK_FRAGMENT_PARSING_METADATA');
41845
- const T$k = 'playback.hls';
41845
+ const T$j = 'playback.hls';
41846
41846
  class HlsPlayback extends BasePlayback {
41847
41847
  _ccIsSetup = false;
41848
41848
  _ccTracksUpdated = false;
@@ -42071,7 +42071,7 @@ class HlsPlayback extends BasePlayback {
42071
42071
  maxBufferLength: 2,
42072
42072
  maxMaxBufferLength: 4,
42073
42073
  }, this.options.playback.hlsjsConfig);
42074
- trace(`${T$k} _createHLSInstance`, { config });
42074
+ trace(`${T$j} _createHLSInstance`, { config });
42075
42075
  this._hls = new Hls(config);
42076
42076
  }
42077
42077
  _attachHLSMedia() {
@@ -42162,7 +42162,7 @@ class HlsPlayback extends BasePlayback {
42162
42162
  }
42163
42163
  else {
42164
42164
  Log.error('hlsjs: failed to recover', { evt, data });
42165
- trace(`${T$k} _recover failed to recover`, {
42165
+ trace(`${T$j} _recover failed to recover`, {
42166
42166
  type: data.type,
42167
42167
  details: data.details,
42168
42168
  });
@@ -42248,7 +42248,7 @@ class HlsPlayback extends BasePlayback {
42248
42248
  this.trigger(Events$1.PLAYBACK_SETTINGSUPDATE);
42249
42249
  }
42250
42250
  _onHLSJSError(evt, data) {
42251
- trace(`${T$k} _onHLSJSError`, {
42251
+ trace(`${T$j} _onHLSJSError`, {
42252
42252
  fatal: data.fatal,
42253
42253
  type: data.type,
42254
42254
  details: data.details,
@@ -42296,7 +42296,7 @@ class HlsPlayback extends BasePlayback {
42296
42296
  evt,
42297
42297
  data,
42298
42298
  });
42299
- trace(`${T$k} _onHLSJSError trying to recover from network error`, {
42299
+ trace(`${T$j} _onHLSJSError trying to recover from network error`, {
42300
42300
  details: data.details,
42301
42301
  });
42302
42302
  error.level = PlayerError.Levels.WARN;
@@ -42309,7 +42309,7 @@ class HlsPlayback extends BasePlayback {
42309
42309
  evt,
42310
42310
  data,
42311
42311
  });
42312
- trace(`${T$k} _onHLSJSError trying to recover from media error`, {
42312
+ trace(`${T$j} _onHLSJSError trying to recover from media error`, {
42313
42313
  details: data.details,
42314
42314
  });
42315
42315
  error.level = PlayerError.Levels.WARN;
@@ -42339,7 +42339,7 @@ class HlsPlayback extends BasePlayback {
42339
42339
  return;
42340
42340
  }
42341
42341
  Log.warn('hlsjs: non-fatal error occurred', { evt, data });
42342
- trace(`${T$k} _onHLSJSError non-fatal error occurred`, {
42342
+ trace(`${T$j} _onHLSJSError non-fatal error occurred`, {
42343
42343
  type: data.type,
42344
42344
  details: data.details,
42345
42345
  });
@@ -42674,11 +42674,11 @@ class HlsPlayback extends BasePlayback {
42674
42674
  this._hls.audioTrack = Number(id); // TODO or find index by .id == id?
42675
42675
  }
42676
42676
  _onAudioTracksUpdated(_, data) {
42677
- trace(`${T$k} onAudioTracksUpdated`);
42677
+ trace(`${T$j} onAudioTracksUpdated`);
42678
42678
  this.trigger(Events$1.PLAYBACK_AUDIO_AVAILABLE, data.audioTracks.map(toClapprTrack));
42679
42679
  }
42680
42680
  _onAudioTrackSwitched(_, data) {
42681
- trace(`${T$k} onAudioTrackSwitched`);
42681
+ trace(`${T$j} onAudioTrackSwitched`);
42682
42682
  // @ts-ignore
42683
42683
  const track = this._hls.audioTracks[data.id];
42684
42684
  this.trigger(Events$1.PLAYBACK_AUDIO_CHANGED, toClapprTrack(track));
@@ -42699,7 +42699,7 @@ function toClapprTrack(t) {
42699
42699
  };
42700
42700
  }
42701
42701
 
42702
- const T$j = 'playback.html5_video';
42702
+ const T$i = 'playback.html5_video';
42703
42703
  const STALL_TIMEOUT = 15000;
42704
42704
  class HTML5Video extends BasePlayback {
42705
42705
  stallTimerId = null;
@@ -42707,7 +42707,7 @@ class HTML5Video extends BasePlayback {
42707
42707
  * @internal
42708
42708
  */
42709
42709
  createError(errorData, options) {
42710
- trace(`${T$j} createError`, {
42710
+ trace(`${T$i} createError`, {
42711
42711
  errorData: { ...errorData },
42712
42712
  });
42713
42713
  const i18n = this.i18n ||
@@ -42723,11 +42723,11 @@ class HTML5Video extends BasePlayback {
42723
42723
  return super.createError(errorData, { ...options, useCodePrefix: false });
42724
42724
  }
42725
42725
  _onWaiting() {
42726
- trace(`${T$j} _onWaiting`);
42726
+ trace(`${T$i} _onWaiting`);
42727
42727
  super._onWaiting();
42728
42728
  }
42729
42729
  _onEnded() {
42730
- trace(`${T$j} _onEnded`);
42730
+ trace(`${T$i} _onEnded`);
42731
42731
  if (this.stallTimerId) {
42732
42732
  clearTimeout(this.stallTimerId);
42733
42733
  this.stallTimerId = null;
@@ -42735,12 +42735,12 @@ class HTML5Video extends BasePlayback {
42735
42735
  super._onEnded();
42736
42736
  }
42737
42737
  _handleBufferingEvents() {
42738
- trace(`${T$j} _handleBufferingEvents`, {
42738
+ trace(`${T$i} _handleBufferingEvents`, {
42739
42739
  networkState: this.el.networkState,
42740
42740
  });
42741
42741
  if (!this.stallTimerId) {
42742
42742
  this.stallTimerId = setTimeout(() => {
42743
- trace(`${T$j} _handleBufferingEvents stall timeout`, {
42743
+ trace(`${T$i} _handleBufferingEvents stall timeout`, {
42744
42744
  buffering: this.buffering,
42745
42745
  ended: this.ended,
42746
42746
  });
@@ -42758,7 +42758,7 @@ class HTML5Video extends BasePlayback {
42758
42758
  super._handleBufferingEvents();
42759
42759
  }
42760
42760
  _onPlaying() {
42761
- trace(`${T$j} _onPlaying`);
42761
+ trace(`${T$i} _onPlaying`);
42762
42762
  if (this.stallTimerId) {
42763
42763
  clearTimeout(this.stallTimerId);
42764
42764
  this.stallTimerId = null;
@@ -42766,7 +42766,7 @@ class HTML5Video extends BasePlayback {
42766
42766
  super._onPlaying();
42767
42767
  }
42768
42768
  _onPause() {
42769
- trace(`${T$j} _onPause`);
42769
+ trace(`${T$i} _onPause`);
42770
42770
  super._onPause();
42771
42771
  if (this.stallTimerId) {
42772
42772
  clearTimeout(this.stallTimerId);
@@ -42776,7 +42776,7 @@ class HTML5Video extends BasePlayback {
42776
42776
  get audioTracks() {
42777
42777
  const tracks = this.el.audioTracks;
42778
42778
  const supported = !!tracks;
42779
- trace(`${T$j} get audioTracks`, { supported });
42779
+ trace(`${T$i} get audioTracks`, { supported });
42780
42780
  const retval = [];
42781
42781
  if (supported) {
42782
42782
  for (let i = 0; i < tracks.length; i++) {
@@ -42795,7 +42795,7 @@ class HTML5Video extends BasePlayback {
42795
42795
  get currentAudioTrack() {
42796
42796
  const tracks = this.el.audioTracks;
42797
42797
  const supported = !!tracks;
42798
- trace(`${T$j} get currentAudioTrack`, {
42798
+ trace(`${T$i} get currentAudioTrack`, {
42799
42799
  supported,
42800
42800
  });
42801
42801
  if (supported) {
@@ -42816,7 +42816,7 @@ class HTML5Video extends BasePlayback {
42816
42816
  switchAudioTrack(id) {
42817
42817
  const tracks = this.el.audioTracks;
42818
42818
  const supported = !!tracks;
42819
- trace(`${T$j} switchAudioTrack`, {
42819
+ trace(`${T$i} switchAudioTrack`, {
42820
42820
  supported,
42821
42821
  });
42822
42822
  if (supported) {
@@ -42835,7 +42835,7 @@ function registerPlaybacks() {
42835
42835
  Loader.registerPlayback(DashPlayback);
42836
42836
  }
42837
42837
 
42838
- const T$i = 'GPlayer';
42838
+ const T$h = 'GPlayer';
42839
42839
  const DEFAULT_OPTIONS = {
42840
42840
  autoPlay: false,
42841
42841
  debug: 'none',
@@ -42930,7 +42930,7 @@ class Player {
42930
42930
  }
42931
42931
  const coreOpts = this.buildCoreOptions(playerElement);
42932
42932
  const { core, container } = Player.getRegisteredPlugins();
42933
- trace(`${T$i} init`, {
42933
+ trace(`${T$h} init`, {
42934
42934
  registeredPlaybacks: Loader.registeredPlaybacks.map((p) => p.prototype.name),
42935
42935
  });
42936
42936
  coreOpts.plugins = {
@@ -42944,7 +42944,7 @@ class Player {
42944
42944
  * Destroys the player, releasing all resources and unmounting its UI from the DOM.
42945
42945
  */
42946
42946
  destroy() {
42947
- trace(`${T$i} destroy`, {
42947
+ trace(`${T$h} destroy`, {
42948
42948
  player: !!this.player,
42949
42949
  });
42950
42950
  if (this.player) {
@@ -43131,7 +43131,7 @@ class Player {
43131
43131
  this.config = $.extend(true, this.config, config);
43132
43132
  }
43133
43133
  initPlayer(coreOptions) {
43134
- trace(`${T$i} initPlayer`, {
43134
+ trace(`${T$h} initPlayer`, {
43135
43135
  autoPlay: coreOptions.autoPlay,
43136
43136
  sources: coreOptions.sources,
43137
43137
  // TODO selected options
@@ -43156,7 +43156,7 @@ class Player {
43156
43156
  }
43157
43157
  }
43158
43158
  triggerAutoPlay() {
43159
- trace(`${T$i} triggerAutoPlay`);
43159
+ trace(`${T$h} triggerAutoPlay`);
43160
43160
  setTimeout(() => {
43161
43161
  this.player?.play({
43162
43162
  autoPlay: true,
@@ -43174,7 +43174,7 @@ class Player {
43174
43174
  // TODO test
43175
43175
  events = {
43176
43176
  onReady: () => {
43177
- trace(`${T$i} onReady`, {
43177
+ trace(`${T$h} onReady`, {
43178
43178
  ready: this.ready,
43179
43179
  });
43180
43180
  if (this.ready) {
@@ -43208,7 +43208,7 @@ class Player {
43208
43208
  buildCoreOptions(rootNode) {
43209
43209
  const sources = this.buildMediaSourcesList();
43210
43210
  const source = sources[0];
43211
- trace(`${T$i} buildCoreOptions`, {
43211
+ trace(`${T$h} buildCoreOptions`, {
43212
43212
  source,
43213
43213
  sources,
43214
43214
  });
@@ -43269,7 +43269,7 @@ class Player {
43269
43269
  assert.ok(this.player, 'Player is not initialized');
43270
43270
  const core = this.player.core;
43271
43271
  core.on(Events$1.CORE_SCREEN_ORIENTATION_CHANGED, ({ orientation }) => {
43272
- trace(`${T$i} on CORE_SCREEN_ORIENTATION_CHANGED`, {
43272
+ trace(`${T$h} on CORE_SCREEN_ORIENTATION_CHANGED`, {
43273
43273
  orientation,
43274
43274
  rootNode: {
43275
43275
  width: this.rootNode?.clientWidth,
@@ -43284,14 +43284,14 @@ class Player {
43284
43284
  }
43285
43285
  }, null);
43286
43286
  core.on(Events$1.CORE_RESIZE, ({ width, height }) => {
43287
- trace(`${T$i} on CORE_RESIZE`, {
43287
+ trace(`${T$h} on CORE_RESIZE`, {
43288
43288
  width,
43289
43289
  height,
43290
43290
  });
43291
43291
  this.safeTriggerEvent(PlayerEvent.Resize, { width, height });
43292
43292
  }, null);
43293
43293
  core.on(Events$1.CORE_FULLSCREEN, (isFullscreen) => {
43294
- trace(`${T$i} CORE_FULLSCREEN`, {
43294
+ trace(`${T$h} CORE_FULLSCREEN`, {
43295
43295
  isFullscreen,
43296
43296
  });
43297
43297
  this.safeTriggerEvent(PlayerEvent.Fullscreen, isFullscreen);
@@ -43299,7 +43299,7 @@ class Player {
43299
43299
  }
43300
43300
  }
43301
43301
 
43302
- var version$1 = "2.22.3";
43302
+ var version$1 = "2.22.5";
43303
43303
 
43304
43304
  var packages = {
43305
43305
  "node_modules/@clappr/core": {
@@ -43323,12 +43323,12 @@ function version() {
43323
43323
  };
43324
43324
  }
43325
43325
 
43326
- const pluginHtml$7 = "<button data-audiotracks-button class='gcore-skin-button-color' id=\"audiotracks-button\">\n <span class='audio-text'><%= title %></span> <span class=\"audio-arrow\"></span>\n</button>\n<ul class='gcore-skin-bg-color' id=\"audiotracks-select\">\n <% for (const track of tracks) { %>\n <li>\n <a href=\"#\" class='gcore-skin-text-color' data-audiotracks-select=\"<%= track.id %>\">\n <%= track.label %>\n </a>\n </li>\n <% }; %>\n</ul>\n";
43326
+ const pluginHtml$7 = "<button data-audiotracks-button class='gcore-skin-button-color' id=\"audiotracks-button\">\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\">\n <% for (const track of tracks) { %>\n <li>\n <a href=\"#\" class='gcore-skin-text-color' data-audiotracks-select=\"<%= track.id %>\">\n <%= track.label %>\n </a>\n </li>\n <% }; %>\n</ul>\n";
43327
43327
 
43328
43328
  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";
43329
43329
 
43330
- const VERSION$6 = '0.0.1';
43331
- const T$h = 'plugins.audio_selector';
43330
+ const VERSION$6 = '2.22.4';
43331
+ // const T = 'plugins.audiotracks'
43332
43332
  /**
43333
43333
  * `PLUGIN` that makes possible to switch audio tracks via the media control UI.
43334
43334
  * @beta
@@ -43339,14 +43339,14 @@ const T$h = 'plugins.audio_selector';
43339
43339
  *
43340
43340
  * - {@link MediaControl}
43341
43341
  */
43342
- class AudioSelector extends UICorePlugin {
43342
+ class AudioTracks extends UICorePlugin {
43343
43343
  currentTrack = null;
43344
43344
  tracks = [];
43345
43345
  /**
43346
43346
  * @internal
43347
43347
  */
43348
43348
  get name() {
43349
- return 'audio_selector';
43349
+ return 'audio_selector'; // TODO rename to audiotracks
43350
43350
  }
43351
43351
  /**
43352
43352
  * @internal
@@ -43375,58 +43375,43 @@ class AudioSelector extends UICorePlugin {
43375
43375
  get events() {
43376
43376
  return {
43377
43377
  'click [data-audiotracks-select]': 'onTrackSelect',
43378
- 'click [data-audiotracks-button]': 'onShowLevelSelectMenu',
43378
+ 'click #audiotracks-button': 'toggleContextMenu',
43379
43379
  };
43380
43380
  }
43381
43381
  /**
43382
43382
  * @internal
43383
43383
  */
43384
43384
  bindEvents() {
43385
- this.listenTo(this.core, Events$1.CORE_READY, this.onCoreReady);
43385
+ this.listenToOnce(this.core, Events$1.CORE_READY, this.onCoreReady);
43386
43386
  this.listenTo(this.core, Events$1.CORE_ACTIVE_CONTAINER_CHANGED, this.onActiveContainerChanged);
43387
43387
  }
43388
43388
  onCoreReady() {
43389
- trace(`${T$h} onCoreReady`);
43390
43389
  const mediaControl = this.core.getPlugin('media_control');
43391
43390
  assert(mediaControl, 'media_control plugin is required');
43392
- this.listenTo(mediaControl, Events$1.MEDIACONTROL_RENDERED, this.render);
43393
- this.listenTo(mediaControl, Events$1.MEDIACONTROL_HIDE, this.hideSelectTrackMenu);
43391
+ this.listenTo(mediaControl, Events$1.MEDIACONTROL_RENDERED, () => {
43392
+ mediaControl.putElement('audiotracks', this.$el);
43393
+ });
43394
+ this.listenTo(mediaControl, Events$1.MEDIACONTROL_HIDE, this.hideMenu);
43394
43395
  }
43395
- bindPlaybackEvents() {
43396
- trace(`${T$h} bindPlaybackEvents`);
43396
+ onActiveContainerChanged() {
43397
43397
  this.currentTrack = null;
43398
- this.listenTo(this.core.activePlayback, Events$1.PLAYBACK_STOP, this.onStop);
43399
- this.setupAudioTrackListeners();
43400
- }
43401
- setupAudioTrackListeners() {
43402
- this.listenTo(this.core.activePlayback, Events$1.PLAYBACK_AUDIO_AVAILABLE, (tracks) => {
43403
- trace(`${T$h} on PLAYBACK_AUDIO_AVAILABLE`, { audioTracks: tracks });
43398
+ this.listenTo(this.core.activeContainer, Events$1.CONTAINER_AUDIO_AVAILABLE, (tracks) => {
43404
43399
  this.currentTrack =
43405
- tracks.find((track) => track.kind === 'main') ?? null;
43406
- this.fillTracks(tracks);
43400
+ tracks.find((track) => track.kind === 'main') ?? null; // TODO test
43401
+ this.tracks = tracks;
43402
+ this.render();
43407
43403
  });
43408
- this.listenTo(this.core.activePlayback, Events$1.PLAYBACK_AUDIO_CHANGED, (track) => {
43409
- trace(`${T$h} PLAYBACK_AUDIO_CHANGED`, { audioTrack: track });
43404
+ this.listenTo(this.core.activeContainer, Events$1.CONTAINER_AUDIO_CHANGED, (track) => {
43410
43405
  this.currentTrack = track;
43411
43406
  this.highlightCurrentTrack();
43412
43407
  this.buttonElement().removeClass('changing');
43413
43408
  this.updateText();
43414
43409
  });
43415
43410
  }
43416
- onStop() {
43417
- trace(`${T$h} onStop`);
43418
- }
43419
- onActiveContainerChanged() {
43420
- trace(`${T$h} onActiveContainerChanged`);
43421
- this.bindPlaybackEvents();
43422
- }
43423
43411
  shouldRender() {
43424
- if (!this.core.activePlayback) {
43425
- return false;
43426
- }
43427
- this.tracks = this.core.activePlayback.audioTracks;
43412
+ // Render is called from the parent class constructor so tracks aren't available
43428
43413
  // Only care if we have at least 2 to choose from
43429
- return this.tracks && this.tracks.length > 1;
43414
+ return this.tracks?.length > 1;
43430
43415
  }
43431
43416
  /**
43432
43417
  * @internal
@@ -43435,43 +43420,35 @@ class AudioSelector extends UICorePlugin {
43435
43420
  if (!this.shouldRender()) {
43436
43421
  return this;
43437
43422
  }
43438
- const mediaControl = this.core.getPlugin('media_control');
43439
- this.$el.html(AudioSelector.template({ tracks: this.tracks, title: this.getTitle() }));
43440
- this.$('.audio-arrow').append(audioArrow);
43441
- mediaControl.putElement('audiotracks', this.el);
43423
+ this.core.getPlugin('media_control');
43424
+ this.$el.html(AudioTracks.template({
43425
+ tracks: this.tracks,
43426
+ title: this.getTitle(),
43427
+ icon: audioArrow,
43428
+ }));
43442
43429
  this.updateText();
43443
43430
  this.highlightCurrentTrack();
43444
43431
  return this;
43445
43432
  }
43446
- fillTracks(tracks) {
43447
- this.tracks = tracks;
43448
- this.render();
43449
- }
43450
- findTrackBy(id) {
43451
- return this.tracks.find((track) => track.id === id);
43452
- }
43453
43433
  onTrackSelect(event) {
43454
43434
  const id = event.target?.dataset?.audiotracksSelect;
43455
43435
  if (id) {
43456
43436
  this.selectAudioTrack(id);
43457
43437
  }
43458
- this.toggleContextMenu();
43438
+ this.hideMenu();
43459
43439
  event.stopPropagation();
43460
43440
  return false;
43461
43441
  }
43462
43442
  selectAudioTrack(id) {
43463
43443
  this.startTrackSwitch();
43464
- this.core.activePlayback.switchAudioTrack(id);
43444
+ this.core.activeContainer.switchAudioTrack(id);
43465
43445
  this.updateText();
43466
43446
  }
43467
- onShowLevelSelectMenu() {
43468
- this.toggleContextMenu();
43469
- }
43470
- hideSelectTrackMenu() {
43471
- this.$('ul').hide();
43447
+ hideMenu() {
43448
+ this.$el.find('#audiotracks-select').addClass('hidden');
43472
43449
  }
43473
43450
  toggleContextMenu() {
43474
- this.$('ul').toggle();
43451
+ this.$el.find('#audiotracks-select').toggleClass('hidden');
43475
43452
  }
43476
43453
  buttonElement() {
43477
43454
  return this.$('button');
@@ -43480,11 +43457,14 @@ class AudioSelector extends UICorePlugin {
43480
43457
  return this.$('button .audio-text');
43481
43458
  }
43482
43459
  trackElement(id) {
43483
- return this.$('ul a' +
43484
- (id !== undefined ? '[data-audiotracks-select="' + id + '"]' : '')).parent();
43460
+ return this.$('#audiotracks-select a' +
43461
+ (id !== undefined ? `[data-audiotracks-select="${id}"]` : '')).parent();
43485
43462
  }
43486
43463
  getTitle() {
43487
- return this.currentTrack?.label || '';
43464
+ if (!this.currentTrack) {
43465
+ return '';
43466
+ }
43467
+ return this.currentTrack.label || this.currentTrack.language;
43488
43468
  }
43489
43469
  startTrackSwitch() {
43490
43470
  this.buttonElement().addClass('changing');
@@ -47514,283 +47494,6 @@ class GoogleAnalytics extends ContainerPlugin {
47514
47494
  }
47515
47495
  }
47516
47496
 
47517
- const buttonHtml$2 = "<button class='gplayer-lite-btn gcore-skin-text-color gear-option'>\n <span class=\"gear-option_hd-icon<%= isHd ? '' : ' hidden' %>\"><%= hdIcon %></span>\n <span><%= i18n.t('quality') %></span>\n <span class=\"gear-option_arrow-right-icon\"><%= arrowRightIcon %></span>\n <span class='gear-option_value'><%= currentText %></span>\n</button>\n";
47518
-
47519
- const listHtml$1 = "<button class=\"gplayer-lite-btn go-back gcore-skin-text-color\" id=\"level-selector-back-button\">\n <span class=\"arrow-left-icon\"><%= arrowLeftIcon %></span>\n <%= i18n.t('quality') %>\n</button>\n<ul class=\"gear-sub-menu\" id=\"level-selector-menu\">\n <% if (!removeAuto) { %>\n <li>\n <a href=\"#\" class='gear-sub-menu_btn gcore-skin-text-color' data-id=\"-1\" id=\"level_selector_auto\">\n <span class=\"check-icon\"><%= checkIcon %></span>\n <%= i18n.t('auto') %>\n </a>\n </li>\n <% } %>\n <% for (const item of levels.slice().reverse()) { %>\n <li class=\"<%= maxLevel >= 0 && item.level > maxLevel ? 'disabled ' : ''%><%=item.level === current ? 'current ' : ''%>\">\n <a href=\"#\"\n class=\"gear-sub-menu_btn gcore-skin-text-color<%= item.level === current ? ' gcore-skin-active' : '' %>\"\n data-id=\"<%= item.level %>\"\n id=\"level_selector_<%= item.width > item.height ? item.height : item.width %>\"\n >\n <span class=\"check-icon\"><%= checkIcon %></span>\n <%= labels[item.level] %>\n </a>\n </li>\n <% } %>\n</ul>\n";
47520
-
47521
- const hdIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M14.9562 8.22232H13.9961V15.1873H14.9562C15.8914 15.1873 16.766 14.8253 17.4195 14.1676C18.0786 13.5037 18.4415 12.6281 18.4415 11.7026C18.4415 9.7837 16.8781 8.22253 14.9561 8.22253L14.9562 8.22232Z\"\n fill=\"#C9C9C9\"/>\n <path\n d=\"M22.0801 4H1.91994C0.859222 4 0 4.86406 0 5.91994V17.4878C0 18.5437 0.859222 19.4078 1.91994 19.4078H22.0801C23.1408 19.4078 24 18.5437 24 17.4878V5.91994C24 4.86406 23.1408 4 22.0801 4ZM10.3975 15.3473C10.3975 15.6124 10.1827 15.8272 9.91754 15.8272C9.65216 15.8272 9.43761 15.6122 9.43761 15.3473V12.0239H5.55956V15.3473C5.55956 15.6124 5.34481 15.8272 5.07963 15.8272C4.81425 15.8272 4.5997 15.6122 4.5997 15.3473L4.59949 7.74042C4.59949 7.47524 4.81425 7.26049 5.07943 7.26049C5.34481 7.26049 5.55936 7.47544 5.55936 7.74042V11.0636H9.43741V7.74042C9.43741 7.47524 9.65216 7.26049 9.91734 7.26049C10.1827 7.26049 10.3973 7.47544 10.3973 7.74042L10.3975 15.3473ZM18.1005 14.8438C17.2652 15.6844 16.1486 16.1472 14.9561 16.1472H13.5161C13.2507 16.1472 13.0361 15.9323 13.0361 15.6673V7.74263C13.0361 7.47745 13.2509 7.26269 13.5161 7.26269H14.9561C17.4072 7.26269 19.4013 9.25438 19.4013 11.7027C19.4013 12.8835 18.9392 13.9991 18.1005 14.844V14.8438Z\"\n fill=\"#C9C9C9\"/>\n</svg>\n";
47522
-
47523
- const arrowRightIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M8.70725 20.7073C8.51225 20.9023 8.25625 21.0002 8.00025 21.0002C7.74425 21.0002 7.48825 20.9023 7.29325 20.7073C6.90225 20.3162 6.90225 19.6842 7.29325 19.2932L14.5863 12.0002L7.29325 4.70725C6.90225 4.31625 6.90225 3.68425 7.29325 3.29325C7.68425 2.90225 8.31625 2.90225 8.70725 3.29325L16.7073 11.2933C17.0983 11.6842 17.0983 12.3162 16.7073 12.7072L8.70725 20.7073Z\"\n fill=\"#C9C9C9\"/>\n</svg>\n";
47524
-
47525
- const arrowLeftIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n d=\"M16.7073 19.2932C17.0983 19.6842 17.0983 20.3162 16.7073 20.7073C16.5123 20.9023 16.2563 21.0002 16.0003 21.0002C15.7443 21.0002 15.4882 20.9023 15.2933 20.7073L7.29325 12.7072C6.90225 12.3162 6.90225 11.6842 7.29325 11.2933L15.2933 3.29325C15.6842 2.90225 16.3163 2.90225 16.7073 3.29325C17.0983 3.68425 17.0983 4.31625 16.7073 4.70725L9.41425 12.0002L16.7073 19.2932Z\"\n fill=\"#C9C9C9\"/>\n</svg>\n";
47526
-
47527
- const checkIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n d=\"M20.5793 4.19296C20.1216 3.86696 19.4777 3.96396 19.1424 4.40896L9.37295 17.3809L4.81634 12.107C4.45222 11.683 3.80218 11.6289 3.36709 11.9839C2.932 12.3389 2.87543 12.97 3.2416 13.393L8.64165 19.643C8.83708 19.869 9.12506 20 9.42849 20C9.4398 20 9.45114 20 9.46246 19.999C9.77926 19.989 10.0724 19.838 10.2586 19.59L20.8015 5.58996C21.1368 5.14496 21.0371 4.51896 20.5793 4.19296Z\"\n fill=\"#C9C9C9\"/>\n</svg>\n";
47528
-
47529
- const T$a = 'plugins.level_selector';
47530
- const VERSION$4 = '2.19.4';
47531
- /**
47532
- * `PLUGIN` that provides a UI to select the desired quality level of the playback.
47533
- * @beta
47534
- *
47535
- * @remarks
47536
- * Depends on:
47537
- *
47538
- * - {@link MediaControl}
47539
- *
47540
- * - {@link BottomGear}
47541
- *
47542
- * The plugin is rendered as an item in the gear menu, which, when clicked, shows a list of quality levels to choose from.
47543
- *
47544
- * Configuration options - {@link LevelSelectorPluginSettings}
47545
- *
47546
- * @example
47547
- * ```ts
47548
- * new Player({
47549
- * levelSelector: {
47550
- * restrictResolution: 360,
47551
- * labels: { 360: 'SD', 720: 'HD' },
47552
- * },
47553
- * })
47554
- * ```
47555
- */
47556
- class LevelSelector extends UICorePlugin {
47557
- levels = [];
47558
- levelLabels = [];
47559
- removeAuto = false;
47560
- isHd = false;
47561
- currentText = '';
47562
- selectedLevelId = -1;
47563
- static buttonTemplate = tmpl(buttonHtml$2);
47564
- static listTemplate = tmpl(listHtml$1);
47565
- /**
47566
- * @internal
47567
- */
47568
- get name() {
47569
- return 'level_selector';
47570
- }
47571
- /**
47572
- * @internal
47573
- */
47574
- get supportedVersion() {
47575
- return { min: CLAPPR_VERSION };
47576
- }
47577
- /**
47578
- * @internal
47579
- */
47580
- static get version() {
47581
- return VERSION$4;
47582
- }
47583
- /**
47584
- * @internal
47585
- */
47586
- get attributes() {
47587
- return {
47588
- class: 'level-selector',
47589
- 'data-level-selector': '',
47590
- };
47591
- }
47592
- get events() {
47593
- return {
47594
- 'click .gear-sub-menu_btn': 'onSelect',
47595
- 'click .go-back': 'goBack',
47596
- };
47597
- }
47598
- /**
47599
- * @internal
47600
- */
47601
- bindEvents() {
47602
- this.listenToOnce(this.core, Events$1.CORE_READY, this.onCoreReady);
47603
- this.listenTo(this.core, Events$1.CORE_ACTIVE_CONTAINER_CHANGED, this.onActiveContainerChange);
47604
- }
47605
- onCoreReady() {
47606
- trace(`${T$a} onCoreReady`);
47607
- const gear = this.core.getPlugin('bottom_gear');
47608
- assert(gear, 'bottom_gear plugin is required');
47609
- this.currentText = this.core.i18n.t('auto');
47610
- this.listenTo(gear, GearEvents.RENDERED, this.onGearRendered);
47611
- }
47612
- onGearRendered() {
47613
- trace(`${T$a} onGearRendered`);
47614
- this.render();
47615
- }
47616
- onActiveContainerChange() {
47617
- this.removeAuto = false;
47618
- this.isHd = false;
47619
- const activePlayback = this.core.activePlayback;
47620
- this.listenTo(activePlayback, Events$1.PLAYBACK_LEVELS_AVAILABLE, this.onLevelsAvailable);
47621
- this.listenTo(activePlayback, Events$1.PLAYBACK_LEVEL_SWITCH_START, this.onLevelSwitchStart);
47622
- this.listenTo(activePlayback, Events$1.PLAYBACK_LEVEL_SWITCH_END, this.onLevelSwitchEnd);
47623
- this.listenTo(activePlayback, Events$1.PLAYBACK_BITRATE, this.onBitrate);
47624
- this.listenTo(activePlayback, Events$1.PLAYBACK_STOP, this.onStop);
47625
- this.listenTo(activePlayback, Events$1.PLAYBACK_HIGHDEFINITIONUPDATE, (isHd) => {
47626
- this.isHd = isHd;
47627
- this.updateHd();
47628
- });
47629
- if (activePlayback.levels?.length > 0) {
47630
- this.onLevelsAvailable(activePlayback.levels);
47631
- }
47632
- }
47633
- updateHd() {
47634
- if (this.isHd) {
47635
- this.$el.find('.gear-option_hd-icon').removeClass('hidden');
47636
- }
47637
- else {
47638
- this.$el.find('.gear-option_hd-icon').addClass('hidden');
47639
- }
47640
- }
47641
- onStop() {
47642
- trace(`${T$a} onStop`);
47643
- this.listenToOnce(this.core.activePlayback, Events$1.PLAYBACK_PLAY, () => {
47644
- if (this.core.activePlayback.getPlaybackType() === 'live') {
47645
- if (this.selectedLevelId !== -1) {
47646
- this.core.activePlayback.currentLevel = this.selectedLevelId;
47647
- }
47648
- }
47649
- });
47650
- }
47651
- shouldRender() {
47652
- const activePlayback = this.core.activePlayback;
47653
- if (!activePlayback) {
47654
- return false;
47655
- }
47656
- const supportsCurrentLevel = 'currentLevel' in activePlayback;
47657
- if (!supportsCurrentLevel) {
47658
- return false;
47659
- }
47660
- // Only care if we have at least 2 to choose from
47661
- return !!(this.levels && this.levels.length > 1);
47662
- }
47663
- /**
47664
- * @internal
47665
- */
47666
- render() {
47667
- if (!this.shouldRender()) {
47668
- return this;
47669
- }
47670
- this.renderDropdown();
47671
- this.updateButton();
47672
- return this;
47673
- }
47674
- renderDropdown() {
47675
- this.$el.html(LevelSelector.listTemplate({
47676
- arrowLeftIcon,
47677
- checkIcon,
47678
- current: this.selectedLevelId,
47679
- labels: this.levelLabels,
47680
- levels: this.levels,
47681
- maxLevel: this.maxLevel,
47682
- removeAuto: this.removeAuto,
47683
- i18n: this.core.i18n,
47684
- }));
47685
- }
47686
- updateButton() {
47687
- this.core.getPlugin('bottom_gear')
47688
- ?.addItem('quality', this.$el)
47689
- .html(LevelSelector.buttonTemplate({
47690
- arrowRightIcon,
47691
- currentText: this.currentText,
47692
- isHd: this.isHd,
47693
- hdIcon,
47694
- i18n: this.core.i18n,
47695
- }));
47696
- }
47697
- get maxLevel() {
47698
- const maxRes = this.core.options.levelSelector?.restrictResolution;
47699
- return maxRes
47700
- ? this.levels.find((level) => (level.height > level.width ? level.width : level.height) ===
47701
- maxRes)?.level ?? -1
47702
- : -1;
47703
- }
47704
- onLevelsAvailable(levels) {
47705
- const maxResolution = this.core.options.levelSelector?.restrictResolution;
47706
- this.levels = levels;
47707
- this.makeLevelsLabels();
47708
- if (maxResolution) {
47709
- this.removeAuto = true;
47710
- const initialLevel = levels
47711
- .filter((level) => (level.width > level.height ? level.height : level.width) <=
47712
- maxResolution)
47713
- .pop();
47714
- this.setLevel(initialLevel?.level ?? 0);
47715
- }
47716
- this.render();
47717
- }
47718
- makeLevelsLabels() {
47719
- const labels = this.core.options.levelSelector?.labels ?? {};
47720
- this.levelLabels = [];
47721
- for (const level of this.levels) {
47722
- const ll = level.width > level.height ? level.height : level.width;
47723
- const label = labels[ll] || `${ll}p`;
47724
- this.levelLabels.push(label);
47725
- }
47726
- }
47727
- onSelect(event) {
47728
- const selectedLevel = parseInt(event.currentTarget?.dataset?.id ?? '-1', 10);
47729
- this.setLevel(selectedLevel);
47730
- event.stopPropagation();
47731
- event.preventDefault();
47732
- return false;
47733
- }
47734
- goBack() {
47735
- trace(`${T$a} goBack`);
47736
- this.core.getPlugin('bottom_gear').refresh();
47737
- }
47738
- setLevel(index) {
47739
- this.selectedLevelId = index;
47740
- this.core.activePlayback.currentLevel = this.selectedLevelId;
47741
- this.highlightCurrentLevel();
47742
- }
47743
- allLevelElements() {
47744
- return this.$('#level-selector-menu li');
47745
- }
47746
- levelElement(id = -1) {
47747
- return this.$(`#level-selector-menu a[data-id="${id}"]`).parent();
47748
- }
47749
- onLevelSwitchStart() {
47750
- this.levelElement(this.selectedLevelId).addClass('changing');
47751
- }
47752
- onLevelSwitchEnd() {
47753
- this.levelElement(this.selectedLevelId).removeClass('changing');
47754
- }
47755
- updateText(level) {
47756
- this.currentText = this.getLevelLabel(level);
47757
- this.updateButton();
47758
- }
47759
- getLevelLabel(id) {
47760
- if (id < 0) {
47761
- return this.core.i18n.t('auto');
47762
- }
47763
- const index = this.levels.findIndex((l) => l.level === id);
47764
- if (index < 0) {
47765
- return this.core.i18n.t('auto');
47766
- }
47767
- return this.levelLabels[index] ?? formatLevelLabel(this.levels[index]);
47768
- }
47769
- onBitrate(info) {
47770
- trace(`${T$a} updateCurrentLevel`, { info });
47771
- this.highlightCurrentLevel();
47772
- }
47773
- highlightCurrentLevel() {
47774
- trace(`${T$a} highlightCurrentLevel`, {
47775
- selectedLevelId: this.selectedLevelId,
47776
- });
47777
- this.allLevelElements()
47778
- .removeClass('current')
47779
- .find('a')
47780
- .removeClass('gcore-skin-active');
47781
- const currentLevelElement = this.levelElement(this.selectedLevelId);
47782
- currentLevelElement
47783
- .addClass('current')
47784
- .find('a')
47785
- .addClass('gcore-skin-active');
47786
- this.updateText(this.selectedLevelId);
47787
- }
47788
- }
47789
- function formatLevelLabel(level) {
47790
- const h = level.width > level.height ? level.height : level.width;
47791
- return `${h}p`;
47792
- }
47793
-
47794
47497
  function calculateSize(original) {
47795
47498
  const transformed = {
47796
47499
  media: {
@@ -48226,7 +47929,7 @@ const DEFAULT_SETTINGS = {
48226
47929
  default: [],
48227
47930
  seekEnabled: true,
48228
47931
  };
48229
- const T$9 = 'plugins.media_control';
47932
+ const T$a = 'plugins.media_control';
48230
47933
  const LEFT_ORDER = [
48231
47934
  'playpause',
48232
47935
  'playstop',
@@ -48464,7 +48167,7 @@ class MediaControl extends UICorePlugin {
48464
48167
  * Hides the media control UI
48465
48168
  */
48466
48169
  disable() {
48467
- trace(`${T$9} disable`);
48170
+ trace(`${T$a} disable`);
48468
48171
  this.userDisabled = true; // TODO distinguish between user and system (e.g., unplayable) disabled?
48469
48172
  this.hide();
48470
48173
  this.unbindKeyEvents();
@@ -48474,7 +48177,7 @@ class MediaControl extends UICorePlugin {
48474
48177
  * Reenables the plugin disabled earlier with the {@link MediaControl.disable} method
48475
48178
  */
48476
48179
  enable() {
48477
- trace(`${T$9} enable`);
48180
+ trace(`${T$a} enable`);
48478
48181
  if (this.options.chromeless) {
48479
48182
  return;
48480
48183
  }
@@ -49009,7 +48712,7 @@ class MediaControl extends UICorePlugin {
49009
48712
  }
49010
48713
  putElement(name, element) {
49011
48714
  const panel = this.getElementLocation(name);
49012
- trace(`${T$9} putElement`, { name, panel: !!panel });
48715
+ trace(`${T$a} putElement`, { name, panel: !!panel });
49013
48716
  if (panel) {
49014
48717
  const current = panel.find(`[data-${name}]`);
49015
48718
  element.attr(`data-${name}`, '');
@@ -49197,7 +48900,7 @@ class MediaControl extends UICorePlugin {
49197
48900
  * @internal
49198
48901
  */
49199
48902
  render() {
49200
- trace(`${T$9} render`);
48903
+ trace(`${T$a} render`);
49201
48904
  const timeout = this.options.hideMediaControlDelay || 2000;
49202
48905
  const html = MediaControl.template({ settings: this.settings ?? {} });
49203
48906
  this.$el.html(html);
@@ -49319,7 +49022,7 @@ class MediaControl extends UICorePlugin {
49319
49022
  return isFinite(this.core.activePlayback.getDuration());
49320
49023
  }
49321
49024
  getElementLocation(name) {
49322
- trace(`${T$9} getElementLocation`, {
49025
+ trace(`${T$a} getElementLocation`, {
49323
49026
  name,
49324
49027
  right: this.settings.right,
49325
49028
  left: this.settings.left,
@@ -49366,8 +49069,8 @@ const streamsMomentoIcon = "<svg id=\"Слой_1\" data-name=\"Слой 1\" xmln
49366
49069
 
49367
49070
  const streamsWhiteNightsIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"50\" height=\"50\" viewBox=\"0 0 50 50\">\n <defs>\n <clipPath id=\"clip-Icon\">\n <rect width=\"50\" height=\"50\"/>\n </clipPath>\n </defs>\n <g id=\"Icon\" clip-path=\"url(#clip-Icon)\">\n <g id=\"icon2\" transform=\"translate(-0.041 0)\">\n <path id=\"Контур_77\" data-name=\"Контур 77\" d=\"M6.493,13v8.266h6.275V19.74H8.31V17.714h4.006V16.3H8.31V14.53h4.365V13Zm7.5,0v8.266h1.7V15.732h.023l3.438,5.534h1.818V13h-1.7v5.545h-.023L15.8,13Z\" fill=\"#fff\"/>\n <path id=\"Контур_76\" data-name=\"Контур 76\" d=\"M29.949,29.1V26.774H31.94a1.4,1.4,0,0,1,.938.272,1.1,1.1,0,0,1,.313.874,1.155,1.155,0,0,1-.313.9,1.375,1.375,0,0,1-.938.278ZM28.132,25.36v8.266h1.817V30.4h1.818a1.353,1.353,0,0,1,.984.3,1.637,1.637,0,0,1,.394.949c.046.333.079.681.1,1.042a3.2,3.2,0,0,0,.185.938h1.819a1.218,1.218,0,0,1-.191-.423,3.611,3.611,0,0,1-.093-.527c-.019-.185-.033-.367-.041-.544s-.016-.332-.023-.463a5.052,5.052,0,0,0-.087-.625,2.109,2.109,0,0,0-.2-.573,1.586,1.586,0,0,0-.359-.451,1.414,1.414,0,0,0-.556-.284v-.023a1.926,1.926,0,0,0,1-.81,2.494,2.494,0,0,0,.307-1.262,2.308,2.308,0,0,0-.165-.88,2.128,2.128,0,0,0-.486-.724,2.3,2.3,0,0,0-.764-.492,2.67,2.67,0,0,0-1-.179ZM43.506,30.5V25.36H41.689V30.5a2.065,2.065,0,0,1-.37,1.36,1.7,1.7,0,0,1-1.343.434,2.086,2.086,0,0,1-.886-.156,1.283,1.283,0,0,1-.758-.978,3.748,3.748,0,0,1-.058-.66V25.36H36.456V30.5a3.16,3.16,0,0,0,.92,2.5,3.807,3.807,0,0,0,2.6.81,3.82,3.82,0,0,0,2.593-.816,3.132,3.132,0,0,0,.937-2.492Z\" fill=\"#fff\"/>\n <path id=\"Контур_80\" data-name=\"Контур 80\" d=\"M22.646,31.2H4.689a4.505,4.505,0,0,1-4.5-4.5V8.5A4.505,4.505,0,0,1,4.689,4h18.2a4.505,4.505,0,0,1,4.5,4.5v8.445l-.893.1a3.184,3.184,0,0,0-2.846,3.177V30.5l-.465.7ZM4.689,6a2.5,2.5,0,0,0-2.5,2.5V26.7a2.5,2.5,0,0,0,2.5,2.5H21.65V20.22a5.18,5.18,0,0,1,3.739-4.992V8.5a2.5,2.5,0,0,0-2.5-2.5Z\" fill=\"#fff\"/>\n <path id=\"Контур_81\" data-name=\"Контур 81\" d=\"M30.127,47.884a1,1,0,0,1-1-1V43.267H26.846a5.206,5.206,0,0,1-5.2-5.2V20.222a5.206,5.206,0,0,1,5.2-5.2H44.692a5.206,5.206,0,0,1,5.2,5.2V38.068a5.206,5.206,0,0,1-5.2,5.2H35.058l-4.216,4.316A1,1,0,0,1,30.127,47.884ZM26.846,17.022a3.2,3.2,0,0,0-3.2,3.2V38.067a3.2,3.2,0,0,0,3.2,3.2h3.281a1,1,0,0,1,1,1v2.162l2.8-2.86a1,1,0,0,1,.715-.3H44.692a3.2,3.2,0,0,0,3.2-3.2V20.222a3.2,3.2,0,0,0-3.2-3.2Z\" fill=\"#fff\"/>\n </g>\n </g>\n</svg>\n";
49368
49071
 
49369
- const VERSION$3 = '0.0.1';
49370
- const T$8 = 'plugins.multicamera';
49072
+ const VERSION$4 = '0.0.1';
49073
+ const T$9 = 'plugins.multicamera';
49371
49074
  /**
49372
49075
  * `PLUGIN` that adds support for loading multiple streams and switching between them using the media control UI.
49373
49076
  * @beta
@@ -49385,7 +49088,7 @@ class MultiCamera extends UICorePlugin {
49385
49088
  return { min: CLAPPR_VERSION };
49386
49089
  }
49387
49090
  static get version() {
49388
- return VERSION$3;
49091
+ return VERSION$4;
49389
49092
  }
49390
49093
  get template() {
49391
49094
  return tmpl(pluginHtml$3);
@@ -49513,7 +49216,7 @@ class MultiCamera extends UICorePlugin {
49513
49216
  }
49514
49217
  onCameraSelect(event) {
49515
49218
  const value = event.currentTarget.dataset.multicameraSelectorSelect;
49516
- trace(`${T$8} onCameraSelect`, { value });
49219
+ trace(`${T$9} onCameraSelect`, { value });
49517
49220
  if (value !== undefined) {
49518
49221
  this.changeById(parseInt(value, 10));
49519
49222
  }
@@ -49639,13 +49342,13 @@ class MultiCamera extends UICorePlugin {
49639
49342
  }
49640
49343
  }
49641
49344
  changeById(id) {
49642
- trace(`${T$8} changeById`, { id });
49345
+ trace(`${T$9} changeById`, { id });
49643
49346
  queueMicrotask(() => {
49644
49347
  const playbackOptions = this.core.options.playback || {};
49645
49348
  // TODO figure out what this does
49646
49349
  playbackOptions.recycleVideo = Browser.isMobile;
49647
49350
  this.currentCamera = this.findElementById(id) ?? null;
49648
- trace(`${T$8} changeById`, { id, currentCamera: this.currentCamera, multicamera: this.multicamera });
49351
+ trace(`${T$9} changeById`, { id, currentCamera: this.currentCamera, multicamera: this.multicamera });
49649
49352
  if (!this.currentCamera) {
49650
49353
  return;
49651
49354
  }
@@ -49662,7 +49365,7 @@ class MultiCamera extends UICorePlugin {
49662
49365
  // TODO remove?
49663
49366
  // for html5 playback:
49664
49367
  this.options.dvrEnabled = this.currentCamera.dvr;
49665
- trace(`${T$8} changeById`, { currentCamera: this.currentCamera });
49368
+ trace(`${T$9} changeById`, { currentCamera: this.currentCamera });
49666
49369
  // TODO
49667
49370
  this.core.configure({
49668
49371
  playback: playbackOptions,
@@ -49717,10 +49420,10 @@ class MultiCamera extends UICorePlugin {
49717
49420
 
49718
49421
  const pipIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M21.05 3.00001C21.302 3.00001 21.5435 3.10003 21.7217 3.27833C21.9 3.45646 22 3.69802 22 3.95003V10.6H20.1V4.90003H4.90001V18.2H10.6V20.1H3.95001C3.69802 20.1 3.45647 20 3.27832 19.8217C3.10002 19.6436 3 19.402 3 19.15V3.95001C3 3.69802 3.10002 3.45647 3.27832 3.27832C3.45644 3.10002 3.69801 3 3.95001 3L21.05 3.00001ZM21.05 12.5C21.302 12.5 21.5435 12.6 21.7217 12.7783C21.9 12.9565 22 13.198 22 13.45V19.15C22 19.402 21.9 19.6436 21.7217 19.8217C21.5436 20 21.302 20.1 21.05 20.1H13.45C13.198 20.1 12.9564 20 12.7783 19.8217C12.6 19.6436 12.5 19.402 12.5 19.15V13.45C12.5 13.198 12.6 12.9565 12.7783 12.7783C12.9564 12.6 13.198 12.5 13.45 12.5H21.05ZM7.47178 6.12823L9.60928 8.26572L11.5501 6.32492V11.5499H6.32509L8.26589 9.60911L6.12839 7.47161L7.47178 6.12823Z\"\n fill=\"#C9C9C9\"/>\n</svg>\n";
49719
49422
 
49720
- const buttonHtml$1 = "<button class=\"gplayer-lite-btn gcore-skin-button-color\">\n <%= pipIcon %>\n</button>\n";
49423
+ const buttonHtml$2 = "<button class=\"gplayer-lite-btn gcore-skin-button-color\">\n <%= pipIcon %>\n</button>\n";
49721
49424
 
49722
- const VERSION$2 = '0.0.1';
49723
- const T$7 = `plugins.pip`;
49425
+ const VERSION$3 = '0.0.1';
49426
+ const T$8 = `plugins.pip`;
49724
49427
  /**
49725
49428
  * `PLUGIN` that enables picture in picture mode.
49726
49429
  * @beta
@@ -49748,9 +49451,9 @@ class PictureInPicture extends UICorePlugin {
49748
49451
  * @internal
49749
49452
  */
49750
49453
  static get version() {
49751
- return VERSION$2;
49454
+ return VERSION$3;
49752
49455
  }
49753
- static buttonTemplate = tmpl(buttonHtml$1);
49456
+ static buttonTemplate = tmpl(buttonHtml$2);
49754
49457
  /**
49755
49458
  * @internal
49756
49459
  */
@@ -49778,7 +49481,7 @@ class PictureInPicture extends UICorePlugin {
49778
49481
  });
49779
49482
  }
49780
49483
  isPiPSupported() {
49781
- trace(`${T$7} isPiPSupported`, {
49484
+ trace(`${T$8} isPiPSupported`, {
49782
49485
  pictureInPictureEnabled: !!document.pictureInPictureEnabled,
49783
49486
  requestPictureInPicture: !!HTMLVideoElement.prototype.requestPictureInPicture,
49784
49487
  });
@@ -49799,7 +49502,7 @@ class PictureInPicture extends UICorePlugin {
49799
49502
  return this;
49800
49503
  }
49801
49504
  togglePictureInPicture() {
49802
- trace(`${T$7} togglePictureInPicture`);
49505
+ trace(`${T$8} togglePictureInPicture`);
49803
49506
  if (this.videoElement !== document.pictureInPictureElement) {
49804
49507
  this.requestPictureInPicture();
49805
49508
  }
@@ -49808,23 +49511,29 @@ class PictureInPicture extends UICorePlugin {
49808
49511
  }
49809
49512
  }
49810
49513
  requestPictureInPicture() {
49811
- trace(`${T$7} requestPictureInPicture`, {
49514
+ trace(`${T$8} requestPictureInPicture`, {
49812
49515
  videoElement: !!this.videoElement,
49813
49516
  });
49814
49517
  this.videoElement.requestPictureInPicture();
49815
49518
  }
49816
49519
  exitPictureInPicture() {
49817
- trace(`${T$7} exitPictureInPicture`);
49520
+ trace(`${T$8} exitPictureInPicture`);
49818
49521
  document.exitPictureInPicture();
49819
49522
  }
49820
49523
  }
49821
49524
 
49822
- const buttonHtml = "<button class='gplayer-lite-btn gcore-skin-text-color gear-option' id=\"playback-rate-button\">\n <span class=\"gear-option_speed-icon\"><%= speedIcon %></span>\n <span class=\"gear-option_label\"><%= i18n.t('playback_rate') %></span>\n <span class=\"gear-option_arrow-right-icon\"><%= arrowRightIcon %></span>\n <span class='gear-option_value'><%= title %></span>\n</button>\n";
49525
+ const buttonHtml$1 = "<button class='gplayer-lite-btn gcore-skin-text-color gear-option' id=\"playback-rate-button\">\n <span class=\"gear-option_speed-icon\"><%= speedIcon %></span>\n <span class=\"gear-option_label\"><%= i18n.t('playback_rate') %></span>\n <span class=\"gear-option_arrow-right-icon\"><%= arrowRightIcon %></span>\n <span class='gear-option_value'><%= title %></span>\n</button>\n";
49823
49526
 
49824
- const listHtml = "<button class=\"gplayer-lite-btn go-back gcore-skin-text-color\" id=\"playback-rate-back-button\">\n <span class=\"arrow-left-icon\"><%= arrowLeftIcon %></span>\n <%= i18n.t('playback_rate') %>\n</button>\n<ul class=\"gear-sub-menu\" id=\"playback-rate-menu\">\n <% for (const item of playbackRates) { %>\n <li<%= item.value === current ? ' class=\"current\"' : '' %>>\n <a href=\"#\" class=\"gear-sub-menu_btn gcore-skin-text-color<%= item.value === current ? ' gcore-skin-active' : '' %>\" data-rate=\"<%= item.value %>\">\n <span class=\"check-icon\"><%= checkIcon %></span>\n <%= item.label %>\n </a>\n </li>\n <% } %>\n</ul>";
49527
+ const listHtml$1 = "<button class=\"gplayer-lite-btn go-back gcore-skin-text-color\" id=\"playback-rate-back-button\">\n <span class=\"arrow-left-icon\"><%= arrowLeftIcon %></span>\n <%= i18n.t('playback_rate') %>\n</button>\n<ul class=\"gear-sub-menu\" id=\"playback-rate-menu\">\n <% for (const item of playbackRates) { %>\n <li<%= item.value === current ? ' class=\"current\"' : '' %>>\n <a href=\"#\" class=\"gear-sub-menu_btn gcore-skin-text-color<%= item.value === current ? ' gcore-skin-active' : '' %>\" data-rate=\"<%= item.value %>\">\n <span class=\"check-icon\"><%= checkIcon %></span>\n <%= item.label %>\n </a>\n </li>\n <% } %>\n</ul>";
49825
49528
 
49826
49529
  const speedIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M11.9854 23.9999C11.4272 23.9999 10.9571 23.5293 10.9571 22.9704C10.9571 22.4115 11.4272 21.9409 11.9854 21.9409C17.4492 21.9409 21.9143 17.4704 21.9143 11.9999C21.9143 6.52948 17.4492 2.05899 11.9854 2.05899C11.4272 2.05899 10.9571 1.58836 10.9571 1.02949C10.9571 0.470625 11.4272 0 11.9854 0C18.5949 0 24 5.38224 24 12.0291C24 18.6766 18.5949 24 11.9854 24V23.9999ZM10.2227 17.853L17.4785 13.4413C18.0072 13.1178 18.301 12.5885 18.301 11.9707C18.301 11.353 17.9779 10.8237 17.4785 10.5002L10.2227 6.08852C9.69405 5.76499 9.01826 5.76499 8.4896 6.05919C7.96094 6.35338 7.60828 6.94157 7.60828 7.5591V16.3824C7.60828 17.0002 7.93142 17.5883 8.4896 17.8824C8.75393 18.0294 9.04779 18.1177 9.34139 18.1177C9.63523 18.1177 9.95838 18.0294 10.2227 17.853V17.853ZM15.9216 11.9707L9.66457 15.7647V8.17661L15.9216 11.9707ZM8.22516 22.3529C8.4602 21.8236 8.25447 21.2058 7.7258 20.9705C7.19714 20.7353 6.69755 20.4413 6.2277 20.0882C5.75764 19.7646 5.11137 19.8822 4.78824 20.3235C4.46509 20.7941 4.58251 21.4412 5.02327 21.7647C5.58146 22.1764 6.19819 22.5293 6.81519 22.8235C6.96211 22.8824 7.10903 22.9117 7.25574 22.9117C7.66699 22.941 8.04893 22.7057 8.22513 22.3528L8.22516 22.3529ZM3.58381 19.0882C4.05387 18.7647 4.17127 18.1177 3.84814 17.647C3.52502 17.1764 3.23115 16.6765 2.99635 16.1471C2.76132 15.6178 2.14456 15.4118 1.6157 15.6472C1.08704 15.8825 0.881306 16.5 1.11634 17.0295C1.41018 17.6472 1.7626 18.2648 2.14459 18.8236C2.35032 19.1178 2.67325 19.2646 2.99638 19.2646C3.20191 19.2942 3.40763 19.2353 3.58384 19.0882L3.58381 19.0882ZM1.14563 13.9707C1.70382 13.9118 2.14435 13.4118 2.08576 12.853C2.05645 12.5588 2.05645 12.2648 2.05645 11.9706C2.05645 11.6764 2.05645 11.4117 2.08576 11.1178C2.14456 10.5589 1.70381 10.059 1.14563 10.0001C0.587439 9.94122 0.0881057 10.3825 0.0293019 10.9414C1.96979e-07 11.2942 0 11.6178 0 11.9709C0 12.3237 0.0293018 12.6768 0.0588091 13.0297C0.117618 13.5589 0.558169 13.9709 1.08706 13.9709C1.08686 13.9707 1.11636 13.9707 1.14567 13.9707L1.14563 13.9707ZM2.96687 7.79432C3.2019 7.26502 3.49553 6.76482 3.81866 6.2944C4.1418 5.82377 4.02439 5.17672 3.55432 4.8532C3.08427 4.52967 2.438 4.64722 2.11486 5.11786C1.73292 5.67672 1.38047 6.2942 1.08661 6.91193C0.851579 7.44123 1.08661 8.05897 1.58597 8.29426C1.73289 8.35314 1.87981 8.38247 2.02652 8.38247C2.40888 8.41181 2.7906 8.1767 2.96686 7.7943L2.96687 7.79432ZM6.22757 3.85328C6.69762 3.52974 7.19696 3.23554 7.69635 2.97089C8.22501 2.73558 8.43074 2.11807 8.19571 1.58857C7.96068 1.05927 7.34392 0.85329 6.81505 1.08861C6.19806 1.3828 5.58128 1.73565 5.02314 2.14741C4.55308 2.47094 4.43568 3.11797 4.78811 3.5886C4.99384 3.8828 5.31676 4.02969 5.6399 4.02969C5.84583 4.05902 6.05135 4.00014 6.22757 3.85325V3.85328Z\"\n fill=\"#C9C9C9\"/>\n</svg>\n";
49827
49530
 
49531
+ const arrowRightIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M8.70725 20.7073C8.51225 20.9023 8.25625 21.0002 8.00025 21.0002C7.74425 21.0002 7.48825 20.9023 7.29325 20.7073C6.90225 20.3162 6.90225 19.6842 7.29325 19.2932L14.5863 12.0002L7.29325 4.70725C6.90225 4.31625 6.90225 3.68425 7.29325 3.29325C7.68425 2.90225 8.31625 2.90225 8.70725 3.29325L16.7073 11.2933C17.0983 11.6842 17.0983 12.3162 16.7073 12.7072L8.70725 20.7073Z\"\n fill=\"#C9C9C9\"/>\n</svg>\n";
49532
+
49533
+ const arrowLeftIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n d=\"M16.7073 19.2932C17.0983 19.6842 17.0983 20.3162 16.7073 20.7073C16.5123 20.9023 16.2563 21.0002 16.0003 21.0002C15.7443 21.0002 15.4882 20.9023 15.2933 20.7073L7.29325 12.7072C6.90225 12.3162 6.90225 11.6842 7.29325 11.2933L15.2933 3.29325C15.6842 2.90225 16.3163 2.90225 16.7073 3.29325C17.0983 3.68425 17.0983 4.31625 16.7073 4.70725L9.41425 12.0002L16.7073 19.2932Z\"\n fill=\"#C9C9C9\"/>\n</svg>\n";
49534
+
49535
+ const checkIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n d=\"M20.5793 4.19296C20.1216 3.86696 19.4777 3.96396 19.1424 4.40896L9.37295 17.3809L4.81634 12.107C4.45222 11.683 3.80218 11.6289 3.36709 11.9839C2.932 12.3389 2.87543 12.97 3.2416 13.393L8.64165 19.643C8.83708 19.869 9.12506 20 9.42849 20C9.4398 20 9.45114 20 9.46246 19.999C9.77926 19.989 10.0724 19.838 10.2586 19.59L20.8015 5.58996C21.1368 5.14496 21.0371 4.51896 20.5793 4.19296Z\"\n fill=\"#C9C9C9\"/>\n</svg>\n";
49536
+
49828
49537
  const DEFAULT_PLAYBACK_RATES = [
49829
49538
  { value: 0.5, label: '0.5x' },
49830
49539
  { value: 0.75, label: '0.75x' },
@@ -49835,7 +49544,7 @@ const DEFAULT_PLAYBACK_RATES = [
49835
49544
  { value: 2.0, label: '2x' },
49836
49545
  ];
49837
49546
  const DEFAULT_PLAYBACK_RATE = 1;
49838
- const T$6 = 'plugins.playback_rate';
49547
+ const T$7 = 'plugins.playback_rate';
49839
49548
  /**
49840
49549
  * `PLUGIN` that allows changing the playback speed of the video.
49841
49550
  * @beta
@@ -49884,8 +49593,8 @@ class PlaybackRate extends UICorePlugin {
49884
49593
  get supportedVersion() {
49885
49594
  return { min: CLAPPR_VERSION };
49886
49595
  }
49887
- static buttonTemplate = tmpl(buttonHtml);
49888
- static listTemplate = tmpl(listHtml);
49596
+ static buttonTemplate = tmpl(buttonHtml$1);
49597
+ static listTemplate = tmpl(listHtml$1);
49889
49598
  constructor(core) {
49890
49599
  super(core);
49891
49600
  this.playbackRates =
@@ -49918,7 +49627,7 @@ class PlaybackRate extends UICorePlugin {
49918
49627
  this.listenTo(this.core, Events$1.CORE_ACTIVE_CONTAINER_CHANGED, this.onActiveContainerChange);
49919
49628
  }
49920
49629
  onCoreReady() {
49921
- trace(`${T$6} onCoreReady`);
49630
+ trace(`${T$7} onCoreReady`);
49922
49631
  const mediaControl = this.core.getPlugin('media_control');
49923
49632
  assert(mediaControl, 'media_control plugin is required');
49924
49633
  const gear = this.core.getPlugin('bottom_gear');
@@ -49927,22 +49636,22 @@ class PlaybackRate extends UICorePlugin {
49927
49636
  this.listenTo(gear, GearEvents.RENDERED, this.onGearRendered);
49928
49637
  }
49929
49638
  onActiveContainerChange() {
49930
- trace(`${T$6} onActiveContainerChange`);
49639
+ trace(`${T$7} onActiveContainerChange`);
49931
49640
  this.listenTo(this.core.activePlayback, Events$1.PLAYBACK_STOP, this.onStop);
49932
49641
  this.listenTo(this.core.activePlayback, Events$1.PLAYBACK_PLAY, this.onPlay);
49933
49642
  this.listenTo(this.core.activePlayback, PlaybackEvents.PLAYBACK_RATE_CHANGED, this.onPlaybackRateChange);
49934
49643
  this.listenTo(this.core.activeContainer, Events$1.CONTAINER_LOADEDMETADATA, this.onMetaDataLoaded);
49935
49644
  }
49936
49645
  onMediaControlRendered() {
49937
- trace(`${T$6} onMediaControlRendered`);
49646
+ trace(`${T$7} onMediaControlRendered`);
49938
49647
  this.render();
49939
49648
  }
49940
49649
  onGearRendered() {
49941
- trace(`${T$6} onGearRendered`);
49650
+ trace(`${T$7} onGearRendered`);
49942
49651
  this.addGearItem();
49943
49652
  }
49944
49653
  addGearItem() {
49945
- trace(`${T$6} addGearItem`);
49654
+ trace(`${T$7} addGearItem`);
49946
49655
  this.core
49947
49656
  .getPlugin('bottom_gear')
49948
49657
  ?.addItem('rate', this.$el)
@@ -49954,7 +49663,7 @@ class PlaybackRate extends UICorePlugin {
49954
49663
  })));
49955
49664
  }
49956
49665
  onMetaDataLoaded() {
49957
- trace(`${T$6} onMetaDataLoaded`);
49666
+ trace(`${T$7} onMetaDataLoaded`);
49958
49667
  this.render();
49959
49668
  }
49960
49669
  allRateElements() {
@@ -49969,7 +49678,7 @@ class PlaybackRate extends UICorePlugin {
49969
49678
  this.core.activePlayback?.setPlaybackRate(this.selectedRate);
49970
49679
  }
49971
49680
  else {
49972
- trace(`${T$6} onPlaybackRateChange not steering to the selected rate, it is seemingly a catchup algorithm working`, {
49681
+ trace(`${T$7} onPlaybackRateChange not steering to the selected rate, it is seemingly a catchup algorithm working`, {
49973
49682
  playbackRate,
49974
49683
  selectedRate: this.selectedRate,
49975
49684
  });
@@ -49989,7 +49698,7 @@ class PlaybackRate extends UICorePlugin {
49989
49698
  * @internal
49990
49699
  */
49991
49700
  render() {
49992
- trace(`${T$6} render`, {
49701
+ trace(`${T$7} render`, {
49993
49702
  shouldRender: this.shouldRender(),
49994
49703
  });
49995
49704
  if (!this.shouldRender()) {
@@ -50064,7 +49773,7 @@ class PlaybackRate extends UICorePlugin {
50064
49773
  .addClass('gcore-skin-active');
50065
49774
  }
50066
49775
  updateGearOptionLabel() {
50067
- trace(`${T$6} updateGearOptionLabel`);
49776
+ trace(`${T$7} updateGearOptionLabel`);
50068
49777
  this.addGearItem();
50069
49778
  }
50070
49779
  }
@@ -50074,7 +49783,7 @@ const posterHTML = "<div class=\"play-wrapper\" data-poster></div>\n";
50074
49783
  //Copyright 2014 Globo.com Player authors. All rights reserved.
50075
49784
  // Use of this source code is governed by a BSD-style
50076
49785
  // license that can be found in the LICENSE file.
50077
- const T$5 = 'plugins.poster';
49786
+ const T$6 = 'plugins.poster';
50078
49787
  /**
50079
49788
  * `PLUGIN` that displays a poster image in the background and a big play button on top when playback is stopped
50080
49789
  * @beta
@@ -50180,13 +49889,13 @@ class Poster extends UIContainerPlugin {
50180
49889
  * Disables the plugin, unmounting it from the DOM
50181
49890
  */
50182
49891
  disable() {
50183
- trace(`${T$5} disable`);
49892
+ trace(`${T$6} disable`);
50184
49893
  this.hasStartedPlaying = false;
50185
49894
  this.playRequested = false;
50186
49895
  super.disable();
50187
49896
  }
50188
49897
  onError(error) {
50189
- trace(`${T$5} onError`, {
49898
+ trace(`${T$6} onError`, {
50190
49899
  error,
50191
49900
  enabled: this.enabled,
50192
49901
  });
@@ -50199,18 +49908,18 @@ class Poster extends UIContainerPlugin {
50199
49908
  }
50200
49909
  }
50201
49910
  onPlay() {
50202
- trace(`${T$5} onPlay`);
49911
+ trace(`${T$6} onPlay`);
50203
49912
  this.hasStartedPlaying = true;
50204
49913
  this.playRequested = false;
50205
49914
  this.update();
50206
49915
  }
50207
49916
  onPlayIntent() {
50208
- trace(`${T$5} onPlayIntent`);
49917
+ trace(`${T$6} onPlayIntent`);
50209
49918
  this.playRequested = true;
50210
49919
  this.update();
50211
49920
  }
50212
49921
  onStop() {
50213
- trace(`${T$5} onStop`, {
49922
+ trace(`${T$6} onStop`, {
50214
49923
  enabled: this.enabled,
50215
49924
  });
50216
49925
  this.hasStartedPlaying = false;
@@ -50218,7 +49927,7 @@ class Poster extends UIContainerPlugin {
50218
49927
  this.update();
50219
49928
  }
50220
49929
  updatePlayButton(show) {
50221
- trace(`${T$5} updatePlayButton`, {
49930
+ trace(`${T$6} updatePlayButton`, {
50222
49931
  show,
50223
49932
  chromeless: this.options.chromeless,
50224
49933
  allowUserInteraction: this.options.allowUserInteraction,
@@ -50247,7 +49956,7 @@ class Poster extends UIContainerPlugin {
50247
49956
  this.$el.removeClass('clickable');
50248
49957
  }
50249
49958
  clicked() {
50250
- trace(`${T$5} clicked`, {
49959
+ trace(`${T$6} clicked`, {
50251
49960
  hasStartedPlaying: this.hasStartedPlaying,
50252
49961
  chromeless: this.options.chromeless,
50253
49962
  allowUserInteraction: this.options.allowUserInteraction,
@@ -50268,7 +49977,7 @@ class Poster extends UIContainerPlugin {
50268
49977
  return !this.container.playback.isAudioOnly;
50269
49978
  }
50270
49979
  update() {
50271
- trace(`${T$5} update`, {
49980
+ trace(`${T$6} update`, {
50272
49981
  shouldRender: this.shouldRender,
50273
49982
  });
50274
49983
  if (!this.shouldRender) {
@@ -50281,7 +49990,7 @@ class Poster extends UIContainerPlugin {
50281
49990
  this.updatePoster();
50282
49991
  }
50283
49992
  updatePoster() {
50284
- trace(`${T$5} updatePoster`, {
49993
+ trace(`${T$6} updatePoster`, {
50285
49994
  hasStartedPlaying: this.hasStartedPlaying,
50286
49995
  });
50287
49996
  if (!this.hasStartedPlaying) {
@@ -50296,7 +50005,7 @@ class Poster extends UIContainerPlugin {
50296
50005
  this.$el.show();
50297
50006
  }
50298
50007
  hidePoster() {
50299
- trace(`${T$5} hidePoster`, {
50008
+ trace(`${T$6} hidePoster`, {
50300
50009
  shouldHideOnPlay: this.shouldHideOnPlay(),
50301
50010
  });
50302
50011
  if (!this.options.disableMediaControl) {
@@ -50346,6 +50055,280 @@ class Poster extends UIContainerPlugin {
50346
50055
  }
50347
50056
  }
50348
50057
 
50058
+ const buttonHtml = "<button class='gplayer-lite-btn gcore-skin-text-color gear-option' aria-haspopup=\"menu\">\n <span class=\"gear-option_hd-icon<%= isHd ? '' : ' hidden' %>\"><%= hdIcon %></span>\n <span><%= i18n.t('quality') %></span>\n <span class=\"gear-option_arrow-right-icon\"><%= arrowRightIcon %></span>\n <span class='gear-option_value'><%= currentText %></span>\n</button>\n";
50059
+
50060
+ const listHtml = "<button class=\"gplayer-lite-btn go-back gcore-skin-text-color\" id=\"level-selector-back-button\">\n <span class=\"arrow-left-icon\"><%= arrowLeftIcon %></span>\n <%= i18n.t('quality') %>\n</button>\n<ul class=\"gear-sub-menu quality-levels\" id=\"level-selector-menu\" role=\"menu\">\n <% if (!removeAuto) { %>\n <li>\n <a href=\"#\" class='gear-sub-menu_btn gcore-skin-text-color' data-id=\"-1\" id=\"level_selector_auto\">\n <span class=\"check-icon\"><%= checkIcon %></span>\n <%= i18n.t('auto') %>\n </a>\n </li>\n <% } %>\n <% for (const item of levels.slice().reverse()) {\n var disabled = maxLevel >= 0 && item.level > maxLevel\n var checked = item.level === current\n %>\n <li class=\"<%= disabled ? ' disabled' : ''%><%=checked ? ' current' : ''%>\">\n <a href=\"#\"\n class=\"gear-sub-menu_btn gcore-skin-text-color<%= checked ? ' gcore-skin-active' : '' %>\"\n data-id=\"<%= item.level %>\"\n data-disabled=\"<%= disabled %>\"\n data-checked=\"<%= checked %>\"\n role=\"menuitemradio\"\n id=\"level_selector_<%= item.width > item.height ? item.height : item.width %>\"\n >\n <span class=\"check-icon\"><%= checkIcon %></span>\n <%= labels[item.level] %>\n </a>\n </li>\n <% } %>\n</ul>\n";
50061
+
50062
+ const hdIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M14.9562 8.22232H13.9961V15.1873H14.9562C15.8914 15.1873 16.766 14.8253 17.4195 14.1676C18.0786 13.5037 18.4415 12.6281 18.4415 11.7026C18.4415 9.7837 16.8781 8.22253 14.9561 8.22253L14.9562 8.22232Z\"\n fill=\"#C9C9C9\"/>\n <path\n d=\"M22.0801 4H1.91994C0.859222 4 0 4.86406 0 5.91994V17.4878C0 18.5437 0.859222 19.4078 1.91994 19.4078H22.0801C23.1408 19.4078 24 18.5437 24 17.4878V5.91994C24 4.86406 23.1408 4 22.0801 4ZM10.3975 15.3473C10.3975 15.6124 10.1827 15.8272 9.91754 15.8272C9.65216 15.8272 9.43761 15.6122 9.43761 15.3473V12.0239H5.55956V15.3473C5.55956 15.6124 5.34481 15.8272 5.07963 15.8272C4.81425 15.8272 4.5997 15.6122 4.5997 15.3473L4.59949 7.74042C4.59949 7.47524 4.81425 7.26049 5.07943 7.26049C5.34481 7.26049 5.55936 7.47544 5.55936 7.74042V11.0636H9.43741V7.74042C9.43741 7.47524 9.65216 7.26049 9.91734 7.26049C10.1827 7.26049 10.3973 7.47544 10.3973 7.74042L10.3975 15.3473ZM18.1005 14.8438C17.2652 15.6844 16.1486 16.1472 14.9561 16.1472H13.5161C13.2507 16.1472 13.0361 15.9323 13.0361 15.6673V7.74263C13.0361 7.47745 13.2509 7.26269 13.5161 7.26269H14.9561C17.4072 7.26269 19.4013 9.25438 19.4013 11.7027C19.4013 12.8835 18.9392 13.9991 18.1005 14.844V14.8438Z\"\n fill=\"#C9C9C9\"/>\n</svg>\n";
50063
+
50064
+ const T$5 = 'plugins.quality_levels';
50065
+ const VERSION$2 = 'v2.22.5';
50066
+ /**
50067
+ * `PLUGIN` that provides a UI to select the desired quality level of the playback.
50068
+ * @beta
50069
+ *
50070
+ * @remarks
50071
+ * Depends on:
50072
+ *
50073
+ * - {@link MediaControl}
50074
+ *
50075
+ * - {@link BottomGear}
50076
+ *
50077
+ * The plugin is rendered as an item in the gear menu, which, when clicked, shows a list of quality levels to choose from.
50078
+ *
50079
+ * Configuration options - {@link QualityLevelsPluginSettings}
50080
+ *
50081
+ * @example
50082
+ * ```ts
50083
+ * new Player({
50084
+ * qualityLevels: {
50085
+ * restrictResolution: 360,
50086
+ * labels: { 360: 'SD', 720: 'HD' },
50087
+ * },
50088
+ * })
50089
+ * ```
50090
+ */
50091
+ class QualityLevels extends UICorePlugin {
50092
+ levels = [];
50093
+ levelLabels = [];
50094
+ removeAuto = false;
50095
+ isHd = false;
50096
+ currentText = '';
50097
+ selectedLevelId = -1;
50098
+ static buttonTemplate = tmpl(buttonHtml);
50099
+ static listTemplate = tmpl(listHtml);
50100
+ /**
50101
+ * @internal
50102
+ */
50103
+ get name() {
50104
+ return 'level_selector';
50105
+ }
50106
+ /**
50107
+ * @internal
50108
+ */
50109
+ get supportedVersion() {
50110
+ return { min: CLAPPR_VERSION };
50111
+ }
50112
+ /**
50113
+ * @internal
50114
+ */
50115
+ static get version() {
50116
+ return VERSION$2;
50117
+ }
50118
+ /**
50119
+ * @internal
50120
+ */
50121
+ get attributes() {
50122
+ return {
50123
+ class: 'level-selector',
50124
+ 'data-level-selector': '',
50125
+ };
50126
+ }
50127
+ get events() {
50128
+ return {
50129
+ 'click .gear-sub-menu_btn': 'onSelect',
50130
+ 'click .go-back': 'goBack',
50131
+ };
50132
+ }
50133
+ /**
50134
+ * @internal
50135
+ */
50136
+ bindEvents() {
50137
+ this.listenToOnce(this.core, Events$1.CORE_READY, this.onCoreReady);
50138
+ this.listenTo(this.core, Events$1.CORE_ACTIVE_CONTAINER_CHANGED, this.onActiveContainerChange);
50139
+ }
50140
+ onCoreReady() {
50141
+ trace(`${T$5} onCoreReady`);
50142
+ const gear = this.core.getPlugin('bottom_gear');
50143
+ assert(gear, 'bottom_gear plugin is required');
50144
+ this.currentText = this.core.i18n.t('auto');
50145
+ this.listenTo(gear, GearEvents.RENDERED, this.onGearRendered);
50146
+ }
50147
+ onGearRendered() {
50148
+ trace(`${T$5} onGearRendered`);
50149
+ this.render();
50150
+ }
50151
+ onActiveContainerChange() {
50152
+ this.removeAuto = false;
50153
+ this.isHd = false;
50154
+ const activePlayback = this.core.activePlayback;
50155
+ this.listenTo(activePlayback, Events$1.PLAYBACK_LEVELS_AVAILABLE, this.onLevelsAvailable);
50156
+ this.listenTo(activePlayback, Events$1.PLAYBACK_LEVEL_SWITCH_START, this.onLevelSwitchStart);
50157
+ this.listenTo(activePlayback, Events$1.PLAYBACK_LEVEL_SWITCH_END, this.onLevelSwitchEnd);
50158
+ this.listenTo(activePlayback, Events$1.PLAYBACK_BITRATE, this.onBitrate);
50159
+ this.listenTo(activePlayback, Events$1.PLAYBACK_STOP, this.onStop);
50160
+ this.listenTo(activePlayback, Events$1.PLAYBACK_HIGHDEFINITIONUPDATE, (isHd) => {
50161
+ this.isHd = isHd;
50162
+ this.updateHd();
50163
+ });
50164
+ if (activePlayback.levels?.length > 0) {
50165
+ this.onLevelsAvailable(activePlayback.levels);
50166
+ }
50167
+ }
50168
+ updateHd() {
50169
+ if (this.isHd) {
50170
+ this.$el.find('.gear-option_hd-icon').removeClass('hidden');
50171
+ }
50172
+ else {
50173
+ this.$el.find('.gear-option_hd-icon').addClass('hidden');
50174
+ }
50175
+ }
50176
+ onStop() {
50177
+ trace(`${T$5} onStop`);
50178
+ this.listenToOnce(this.core.activePlayback, Events$1.PLAYBACK_PLAY, () => {
50179
+ if (this.core.activePlayback.getPlaybackType() === 'live') {
50180
+ if (this.selectedLevelId !== -1) {
50181
+ this.core.activePlayback.currentLevel = this.selectedLevelId;
50182
+ }
50183
+ }
50184
+ });
50185
+ }
50186
+ shouldRender() {
50187
+ const activePlayback = this.core.activePlayback;
50188
+ if (!activePlayback) {
50189
+ return false;
50190
+ }
50191
+ const supportsCurrentLevel = 'currentLevel' in activePlayback;
50192
+ if (!supportsCurrentLevel) {
50193
+ return false;
50194
+ }
50195
+ // Only care if we have at least 2 to choose from
50196
+ return !!(this.levels && this.levels.length > 1);
50197
+ }
50198
+ /**
50199
+ * @internal
50200
+ */
50201
+ render() {
50202
+ if (!this.shouldRender()) {
50203
+ return this;
50204
+ }
50205
+ this.renderDropdown();
50206
+ this.updateButton();
50207
+ return this;
50208
+ }
50209
+ renderDropdown() {
50210
+ this.$el.html(QualityLevels.listTemplate({
50211
+ arrowLeftIcon,
50212
+ checkIcon,
50213
+ current: this.selectedLevelId,
50214
+ labels: this.levelLabels,
50215
+ levels: this.levels,
50216
+ maxLevel: this.maxLevel,
50217
+ removeAuto: this.removeAuto,
50218
+ i18n: this.core.i18n,
50219
+ }));
50220
+ }
50221
+ updateButton() {
50222
+ this.core.getPlugin('bottom_gear')
50223
+ ?.addItem('quality', this.$el)
50224
+ .html(QualityLevels.buttonTemplate({
50225
+ arrowRightIcon,
50226
+ currentText: this.currentText,
50227
+ isHd: this.isHd,
50228
+ hdIcon,
50229
+ i18n: this.core.i18n,
50230
+ }));
50231
+ }
50232
+ get pluginOptions() {
50233
+ return (this.core.options.qualityLevels || this.core.options.levelSelector || {});
50234
+ }
50235
+ get maxLevel() {
50236
+ const maxRes = this.pluginOptions.restrictResolution;
50237
+ return maxRes
50238
+ ? this.levels.find((level) => (level.height > level.width ? level.width : level.height) ===
50239
+ maxRes)?.level ?? -1
50240
+ : -1;
50241
+ }
50242
+ onLevelsAvailable(levels) {
50243
+ const maxResolution = this.pluginOptions.restrictResolution;
50244
+ this.levels = levels;
50245
+ this.makeLevelsLabels();
50246
+ if (maxResolution) {
50247
+ this.removeAuto = true;
50248
+ const initialLevel = levels
50249
+ .filter((level) => (level.width > level.height ? level.height : level.width) <=
50250
+ maxResolution)
50251
+ .pop();
50252
+ this.setLevel(initialLevel?.level ?? 0);
50253
+ }
50254
+ this.render();
50255
+ }
50256
+ makeLevelsLabels() {
50257
+ const labels = this.pluginOptions.labels ?? {};
50258
+ this.levelLabels = [];
50259
+ for (const level of this.levels) {
50260
+ const ll = level.width > level.height ? level.height : level.width;
50261
+ const label = labels[ll] || `${ll}p`;
50262
+ this.levelLabels.push(label);
50263
+ }
50264
+ }
50265
+ onSelect(event) {
50266
+ const selectedLevel = parseInt(event.currentTarget?.dataset?.id ?? '-1', 10);
50267
+ this.setLevel(selectedLevel);
50268
+ event.stopPropagation();
50269
+ event.preventDefault();
50270
+ return false;
50271
+ }
50272
+ goBack() {
50273
+ trace(`${T$5} goBack`);
50274
+ this.core.getPlugin('bottom_gear').refresh();
50275
+ }
50276
+ setLevel(index) {
50277
+ this.selectedLevelId = index;
50278
+ this.core.activePlayback.currentLevel = this.selectedLevelId;
50279
+ this.highlightCurrentLevel();
50280
+ }
50281
+ allLevelElements() {
50282
+ return this.$('#level-selector-menu li');
50283
+ }
50284
+ levelElement(id = -1) {
50285
+ return this.$(`#level-selector-menu a[data-id="${id}"]`).parent();
50286
+ }
50287
+ onLevelSwitchStart() {
50288
+ this.levelElement(this.selectedLevelId).addClass('changing');
50289
+ }
50290
+ onLevelSwitchEnd() {
50291
+ this.levelElement(this.selectedLevelId).removeClass('changing');
50292
+ }
50293
+ updateText(level) {
50294
+ this.currentText = this.getLevelLabel(level);
50295
+ this.updateButton();
50296
+ }
50297
+ getLevelLabel(id) {
50298
+ if (id < 0) {
50299
+ return this.core.i18n.t('auto');
50300
+ }
50301
+ const index = this.levels.findIndex((l) => l.level === id);
50302
+ if (index < 0) {
50303
+ return this.core.i18n.t('auto');
50304
+ }
50305
+ return this.levelLabels[index] ?? formatLevelLabel(this.levels[index]);
50306
+ }
50307
+ onBitrate(info) {
50308
+ trace(`${T$5} updateCurrentLevel`, { info });
50309
+ this.highlightCurrentLevel();
50310
+ }
50311
+ highlightCurrentLevel() {
50312
+ trace(`${T$5} highlightCurrentLevel`, {
50313
+ selectedLevelId: this.selectedLevelId,
50314
+ });
50315
+ this.allLevelElements()
50316
+ .removeClass('current')
50317
+ .find('a')
50318
+ .removeClass('gcore-skin-active');
50319
+ const currentLevelElement = this.levelElement(this.selectedLevelId);
50320
+ currentLevelElement
50321
+ .addClass('current')
50322
+ .find('a')
50323
+ .addClass('gcore-skin-active');
50324
+ this.updateText(this.selectedLevelId);
50325
+ }
50326
+ }
50327
+ function formatLevelLabel(level) {
50328
+ const h = level.width > level.height ? level.height : level.width;
50329
+ return `${h}p`;
50330
+ }
50331
+
50349
50332
  const seekTimeHTML = "<span data-seek-time></span>\n<span data-duration></span>\n";
50350
50333
 
50351
50334
  // Copyright 2014 Globo.com Player authors. All rights reserved.
@@ -52312,4 +52295,4 @@ class VolumeFade extends UICorePlugin {
52312
52295
  }
52313
52296
  }
52314
52297
 
52315
- export { AudioSelector, BigMuteButton, BottomGear, ClapprNerdStats, ClapprStats, ClickToPause, ClipsPlugin, ClosedCaptions, ContextMenu, DvrControls, ErrorScreen, Favicon, GearEvents, GoogleAnalytics, LevelSelector, LogTracer, Logger, Logo, MediaControl, MultiCamera, PictureInPicture, PlaybackErrorCode, PlaybackRate, Player, PlayerEvent, Poster, SeekTime, SentryTracer, Share, SkipTime, SourceController, SpinnerThreeBounce as Spinner, SpinnerEvents, SpinnerThreeBounce, ClosedCaptions as Subtitles, Telemetry, TelemetryEvent, Thumbnails, VolumeFade, VolumeFadeEvents, reportError, setTracer, trace, version };
52298
+ export { AudioTracks as AudioSelector, AudioTracks, BigMuteButton, BottomGear, ClapprNerdStats, ClapprStats, ClickToPause, ClipsPlugin, ClosedCaptions, ContextMenu, DvrControls, ErrorScreen, Favicon, GearEvents, GoogleAnalytics, QualityLevels as LevelSelector, LogTracer, Logger, Logo, MediaControl, MultiCamera, PictureInPicture, PlaybackErrorCode, PlaybackRate, Player, PlayerEvent, Poster, QualityLevels, SeekTime, SentryTracer, Share, SkipTime, SourceController, SpinnerThreeBounce as Spinner, SpinnerEvents, SpinnerThreeBounce, ClosedCaptions as Subtitles, Telemetry, TelemetryEvent, Thumbnails, VolumeFade, VolumeFadeEvents, reportError, setTracer, trace, version };