@gcorevideo/player 2.22.4 → 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.
@@ -13345,7 +13345,7 @@ class ClipsPlugin extends UICorePlugin {
13345
13345
 
13346
13346
  const templateHtml$1 = "<ul class=\"context-menu-list\">\n <% if(options) { %>\n <% for (var i = 0; i < options.length; i++) { %>\n <li class=\"context-menu-list-item <%= options[i].class %>\"\n data-<%= options[i].name %>><%= options[i].label %></li>\n <% } %>\n <% } %>\n</ul>\n";
13347
13347
 
13348
- var version$1 = "2.22.4";
13348
+ var version$1 = "2.22.5";
13349
13349
 
13350
13350
  var packages = {
13351
13351
  "node_modules/@clappr/core": {
@@ -13927,278 +13927,6 @@ class GoogleAnalytics extends ContainerPlugin {
13927
13927
  }
13928
13928
  }
13929
13929
 
13930
- 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";
13931
-
13932
- 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";
13933
-
13934
- 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";
13935
-
13936
- 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";
13937
-
13938
- 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";
13939
-
13940
- 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";
13941
-
13942
- const T$a = 'plugins.level_selector';
13943
- const VERSION$4 = '2.19.4';
13944
- /**
13945
- * `PLUGIN` that provides a UI to select the desired quality level of the playback.
13946
- * @beta
13947
- *
13948
- * @remarks
13949
- * Depends on:
13950
- *
13951
- * - {@link MediaControl}
13952
- *
13953
- * - {@link BottomGear}
13954
- *
13955
- * The plugin is rendered as an item in the gear menu, which, when clicked, shows a list of quality levels to choose from.
13956
- *
13957
- * Configuration options - {@link LevelSelectorPluginSettings}
13958
- *
13959
- * @example
13960
- * ```ts
13961
- * new Player({
13962
- * levelSelector: {
13963
- * restrictResolution: 360,
13964
- * labels: { 360: 'SD', 720: 'HD' },
13965
- * },
13966
- * })
13967
- * ```
13968
- */
13969
- class LevelSelector extends UICorePlugin {
13970
- levels = [];
13971
- levelLabels = [];
13972
- removeAuto = false;
13973
- isHd = false;
13974
- currentText = '';
13975
- selectedLevelId = -1;
13976
- static buttonTemplate = tmpl(buttonHtml$2);
13977
- static listTemplate = tmpl(listHtml$1);
13978
- /**
13979
- * @internal
13980
- */
13981
- get name() {
13982
- return 'level_selector';
13983
- }
13984
- /**
13985
- * @internal
13986
- */
13987
- get supportedVersion() {
13988
- return { min: CLAPPR_VERSION };
13989
- }
13990
- /**
13991
- * @internal
13992
- */
13993
- static get version() {
13994
- return VERSION$4;
13995
- }
13996
- /**
13997
- * @internal
13998
- */
13999
- get attributes() {
14000
- return {
14001
- class: 'level-selector',
14002
- 'data-level-selector': '',
14003
- };
14004
- }
14005
- get events() {
14006
- return {
14007
- 'click .gear-sub-menu_btn': 'onSelect',
14008
- 'click .go-back': 'goBack',
14009
- };
14010
- }
14011
- /**
14012
- * @internal
14013
- */
14014
- bindEvents() {
14015
- this.listenToOnce(this.core, Events.CORE_READY, this.onCoreReady);
14016
- this.listenTo(this.core, Events.CORE_ACTIVE_CONTAINER_CHANGED, this.onActiveContainerChange);
14017
- }
14018
- onCoreReady() {
14019
- const gear = this.core.getPlugin('bottom_gear');
14020
- assert(gear, 'bottom_gear plugin is required');
14021
- this.currentText = this.core.i18n.t('auto');
14022
- this.listenTo(gear, GearEvents.RENDERED, this.onGearRendered);
14023
- }
14024
- onGearRendered() {
14025
- this.render();
14026
- }
14027
- onActiveContainerChange() {
14028
- this.removeAuto = false;
14029
- this.isHd = false;
14030
- const activePlayback = this.core.activePlayback;
14031
- this.listenTo(activePlayback, Events.PLAYBACK_LEVELS_AVAILABLE, this.onLevelsAvailable);
14032
- this.listenTo(activePlayback, Events.PLAYBACK_LEVEL_SWITCH_START, this.onLevelSwitchStart);
14033
- this.listenTo(activePlayback, Events.PLAYBACK_LEVEL_SWITCH_END, this.onLevelSwitchEnd);
14034
- this.listenTo(activePlayback, Events.PLAYBACK_BITRATE, this.onBitrate);
14035
- this.listenTo(activePlayback, Events.PLAYBACK_STOP, this.onStop);
14036
- this.listenTo(activePlayback, Events.PLAYBACK_HIGHDEFINITIONUPDATE, (isHd) => {
14037
- this.isHd = isHd;
14038
- this.updateHd();
14039
- });
14040
- if (activePlayback.levels?.length > 0) {
14041
- this.onLevelsAvailable(activePlayback.levels);
14042
- }
14043
- }
14044
- updateHd() {
14045
- if (this.isHd) {
14046
- this.$el.find('.gear-option_hd-icon').removeClass('hidden');
14047
- }
14048
- else {
14049
- this.$el.find('.gear-option_hd-icon').addClass('hidden');
14050
- }
14051
- }
14052
- onStop() {
14053
- this.listenToOnce(this.core.activePlayback, Events.PLAYBACK_PLAY, () => {
14054
- if (this.core.activePlayback.getPlaybackType() === 'live') {
14055
- if (this.selectedLevelId !== -1) {
14056
- this.core.activePlayback.currentLevel = this.selectedLevelId;
14057
- }
14058
- }
14059
- });
14060
- }
14061
- shouldRender() {
14062
- const activePlayback = this.core.activePlayback;
14063
- if (!activePlayback) {
14064
- return false;
14065
- }
14066
- const supportsCurrentLevel = 'currentLevel' in activePlayback;
14067
- if (!supportsCurrentLevel) {
14068
- return false;
14069
- }
14070
- // Only care if we have at least 2 to choose from
14071
- return !!(this.levels && this.levels.length > 1);
14072
- }
14073
- /**
14074
- * @internal
14075
- */
14076
- render() {
14077
- if (!this.shouldRender()) {
14078
- return this;
14079
- }
14080
- this.renderDropdown();
14081
- this.updateButton();
14082
- return this;
14083
- }
14084
- renderDropdown() {
14085
- this.$el.html(LevelSelector.listTemplate({
14086
- arrowLeftIcon,
14087
- checkIcon,
14088
- current: this.selectedLevelId,
14089
- labels: this.levelLabels,
14090
- levels: this.levels,
14091
- maxLevel: this.maxLevel,
14092
- removeAuto: this.removeAuto,
14093
- i18n: this.core.i18n,
14094
- }));
14095
- }
14096
- updateButton() {
14097
- this.core.getPlugin('bottom_gear')
14098
- ?.addItem('quality', this.$el)
14099
- .html(LevelSelector.buttonTemplate({
14100
- arrowRightIcon,
14101
- currentText: this.currentText,
14102
- isHd: this.isHd,
14103
- hdIcon,
14104
- i18n: this.core.i18n,
14105
- }));
14106
- }
14107
- get maxLevel() {
14108
- const maxRes = this.core.options.levelSelector?.restrictResolution;
14109
- return maxRes
14110
- ? this.levels.find((level) => (level.height > level.width ? level.width : level.height) ===
14111
- maxRes)?.level ?? -1
14112
- : -1;
14113
- }
14114
- onLevelsAvailable(levels) {
14115
- const maxResolution = this.core.options.levelSelector?.restrictResolution;
14116
- this.levels = levels;
14117
- this.makeLevelsLabels();
14118
- if (maxResolution) {
14119
- this.removeAuto = true;
14120
- const initialLevel = levels
14121
- .filter((level) => (level.width > level.height ? level.height : level.width) <=
14122
- maxResolution)
14123
- .pop();
14124
- this.setLevel(initialLevel?.level ?? 0);
14125
- }
14126
- this.render();
14127
- }
14128
- makeLevelsLabels() {
14129
- const labels = this.core.options.levelSelector?.labels ?? {};
14130
- this.levelLabels = [];
14131
- for (const level of this.levels) {
14132
- const ll = level.width > level.height ? level.height : level.width;
14133
- const label = labels[ll] || `${ll}p`;
14134
- this.levelLabels.push(label);
14135
- }
14136
- }
14137
- onSelect(event) {
14138
- const selectedLevel = parseInt(event.currentTarget?.dataset?.id ?? '-1', 10);
14139
- this.setLevel(selectedLevel);
14140
- event.stopPropagation();
14141
- event.preventDefault();
14142
- return false;
14143
- }
14144
- goBack() {
14145
- this.core.getPlugin('bottom_gear').refresh();
14146
- }
14147
- setLevel(index) {
14148
- this.selectedLevelId = index;
14149
- this.core.activePlayback.currentLevel = this.selectedLevelId;
14150
- this.highlightCurrentLevel();
14151
- }
14152
- allLevelElements() {
14153
- return this.$('#level-selector-menu li');
14154
- }
14155
- levelElement(id = -1) {
14156
- return this.$(`#level-selector-menu a[data-id="${id}"]`).parent();
14157
- }
14158
- onLevelSwitchStart() {
14159
- this.levelElement(this.selectedLevelId).addClass('changing');
14160
- }
14161
- onLevelSwitchEnd() {
14162
- this.levelElement(this.selectedLevelId).removeClass('changing');
14163
- }
14164
- updateText(level) {
14165
- this.currentText = this.getLevelLabel(level);
14166
- this.updateButton();
14167
- }
14168
- getLevelLabel(id) {
14169
- if (id < 0) {
14170
- return this.core.i18n.t('auto');
14171
- }
14172
- const index = this.levels.findIndex((l) => l.level === id);
14173
- if (index < 0) {
14174
- return this.core.i18n.t('auto');
14175
- }
14176
- return this.levelLabels[index] ?? formatLevelLabel(this.levels[index]);
14177
- }
14178
- onBitrate(info) {
14179
- this.highlightCurrentLevel();
14180
- }
14181
- highlightCurrentLevel() {
14182
- trace(`${T$a} highlightCurrentLevel`, {
14183
- selectedLevelId: this.selectedLevelId,
14184
- });
14185
- this.allLevelElements()
14186
- .removeClass('current')
14187
- .find('a')
14188
- .removeClass('gcore-skin-active');
14189
- const currentLevelElement = this.levelElement(this.selectedLevelId);
14190
- currentLevelElement
14191
- .addClass('current')
14192
- .find('a')
14193
- .addClass('gcore-skin-active');
14194
- this.updateText(this.selectedLevelId);
14195
- }
14196
- }
14197
- function formatLevelLabel(level) {
14198
- const h = level.width > level.height ? level.height : level.width;
14199
- return `${h}p`;
14200
- }
14201
-
14202
13930
  function calculateSize(original) {
14203
13931
  const transformed = {
14204
13932
  media: {
@@ -14634,7 +14362,7 @@ const DEFAULT_SETTINGS = {
14634
14362
  default: [],
14635
14363
  seekEnabled: true,
14636
14364
  };
14637
- const T$9 = 'plugins.media_control';
14365
+ const T$a = 'plugins.media_control';
14638
14366
  const LEFT_ORDER = [
14639
14367
  'playpause',
14640
14368
  'playstop',
@@ -15722,7 +15450,7 @@ class MediaControl extends UICorePlugin {
15722
15450
  return isFinite(this.core.activePlayback.getDuration());
15723
15451
  }
15724
15452
  getElementLocation(name) {
15725
- trace(`${T$9} getElementLocation`, {
15453
+ trace(`${T$a} getElementLocation`, {
15726
15454
  right: this.settings.right,
15727
15455
  left: this.settings.left,
15728
15456
  default: this.settings.default,
@@ -15768,8 +15496,8 @@ const streamsMomentoIcon = "<svg id=\"Слой_1\" data-name=\"Слой 1\" xmln
15768
15496
 
15769
15497
  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";
15770
15498
 
15771
- const VERSION$3 = '0.0.1';
15772
- const T$8 = 'plugins.multicamera';
15499
+ const VERSION$4 = '0.0.1';
15500
+ const T$9 = 'plugins.multicamera';
15773
15501
  /**
15774
15502
  * `PLUGIN` that adds support for loading multiple streams and switching between them using the media control UI.
15775
15503
  * @beta
@@ -15787,7 +15515,7 @@ class MultiCamera extends UICorePlugin {
15787
15515
  return { min: CLAPPR_VERSION };
15788
15516
  }
15789
15517
  static get version() {
15790
- return VERSION$3;
15518
+ return VERSION$4;
15791
15519
  }
15792
15520
  get template() {
15793
15521
  return tmpl(pluginHtml$3);
@@ -16041,7 +15769,7 @@ class MultiCamera extends UICorePlugin {
16041
15769
  // TODO figure out what this does
16042
15770
  playbackOptions.recycleVideo = Browser.isMobile;
16043
15771
  this.currentCamera = this.findElementById(id) ?? null;
16044
- trace(`${T$8} changeById`, { currentCamera: this.currentCamera, multicamera: this.multicamera });
15772
+ trace(`${T$9} changeById`, { currentCamera: this.currentCamera, multicamera: this.multicamera });
16045
15773
  if (!this.currentCamera) {
16046
15774
  return;
16047
15775
  }
@@ -16057,7 +15785,7 @@ class MultiCamera extends UICorePlugin {
16057
15785
  // TODO remove?
16058
15786
  // for html5 playback:
16059
15787
  this.options.dvrEnabled = this.currentCamera.dvr;
16060
- trace(`${T$8} changeById`, { currentCamera: this.currentCamera });
15788
+ trace(`${T$9} changeById`, { currentCamera: this.currentCamera });
16061
15789
  // TODO
16062
15790
  this.core.configure({
16063
15791
  playback: playbackOptions,
@@ -16112,10 +15840,10 @@ class MultiCamera extends UICorePlugin {
16112
15840
 
16113
15841
  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";
16114
15842
 
16115
- const buttonHtml$1 = "<button class=\"gplayer-lite-btn gcore-skin-button-color\">\n <%= pipIcon %>\n</button>\n";
15843
+ const buttonHtml$2 = "<button class=\"gplayer-lite-btn gcore-skin-button-color\">\n <%= pipIcon %>\n</button>\n";
16116
15844
 
16117
- const VERSION$2 = '0.0.1';
16118
- const T$7 = `plugins.pip`;
15845
+ const VERSION$3 = '0.0.1';
15846
+ const T$8 = `plugins.pip`;
16119
15847
  /**
16120
15848
  * `PLUGIN` that enables picture in picture mode.
16121
15849
  * @beta
@@ -16143,9 +15871,9 @@ class PictureInPicture extends UICorePlugin {
16143
15871
  * @internal
16144
15872
  */
16145
15873
  static get version() {
16146
- return VERSION$2;
15874
+ return VERSION$3;
16147
15875
  }
16148
- static buttonTemplate = tmpl(buttonHtml$1);
15876
+ static buttonTemplate = tmpl(buttonHtml$2);
16149
15877
  /**
16150
15878
  * @internal
16151
15879
  */
@@ -16198,7 +15926,7 @@ class PictureInPicture extends UICorePlugin {
16198
15926
  }
16199
15927
  }
16200
15928
  requestPictureInPicture() {
16201
- trace(`${T$7} requestPictureInPicture`, {
15929
+ trace(`${T$8} requestPictureInPicture`, {
16202
15930
  videoElement: !!this.videoElement,
16203
15931
  });
16204
15932
  this.videoElement.requestPictureInPicture();
@@ -16208,12 +15936,18 @@ class PictureInPicture extends UICorePlugin {
16208
15936
  }
16209
15937
  }
16210
15938
 
16211
- 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";
15939
+ 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";
16212
15940
 
16213
- 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>";
15941
+ 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>";
16214
15942
 
16215
15943
  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";
16216
15944
 
15945
+ 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";
15946
+
15947
+ 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";
15948
+
15949
+ 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";
15950
+
16217
15951
  var PlaybackEvents;
16218
15952
  (function (PlaybackEvents) {
16219
15953
  /**
@@ -16234,7 +15968,7 @@ const DEFAULT_PLAYBACK_RATES = [
16234
15968
  { value: 2.0, label: '2x' },
16235
15969
  ];
16236
15970
  const DEFAULT_PLAYBACK_RATE = 1;
16237
- const T$6 = 'plugins.playback_rate';
15971
+ const T$7 = 'plugins.playback_rate';
16238
15972
  /**
16239
15973
  * `PLUGIN` that allows changing the playback speed of the video.
16240
15974
  * @beta
@@ -16283,8 +16017,8 @@ class PlaybackRate extends UICorePlugin {
16283
16017
  get supportedVersion() {
16284
16018
  return { min: CLAPPR_VERSION };
16285
16019
  }
16286
- static buttonTemplate = tmpl(buttonHtml);
16287
- static listTemplate = tmpl(listHtml);
16020
+ static buttonTemplate = tmpl(buttonHtml$1);
16021
+ static listTemplate = tmpl(listHtml$1);
16288
16022
  constructor(core) {
16289
16023
  super(core);
16290
16024
  this.playbackRates =
@@ -16362,7 +16096,7 @@ class PlaybackRate extends UICorePlugin {
16362
16096
  this.core.activePlayback?.setPlaybackRate(this.selectedRate);
16363
16097
  }
16364
16098
  else {
16365
- trace(`${T$6} onPlaybackRateChange not steering to the selected rate, it is seemingly a catchup algorithm working`, {
16099
+ trace(`${T$7} onPlaybackRateChange not steering to the selected rate, it is seemingly a catchup algorithm working`, {
16366
16100
  selectedRate: this.selectedRate,
16367
16101
  });
16368
16102
  }
@@ -16381,7 +16115,7 @@ class PlaybackRate extends UICorePlugin {
16381
16115
  * @internal
16382
16116
  */
16383
16117
  render() {
16384
- trace(`${T$6} render`, {
16118
+ trace(`${T$7} render`, {
16385
16119
  shouldRender: this.shouldRender(),
16386
16120
  });
16387
16121
  if (!this.shouldRender()) {
@@ -16465,7 +16199,7 @@ const posterHTML = "<div class=\"play-wrapper\" data-poster></div>\n";
16465
16199
  //Copyright 2014 Globo.com Player authors. All rights reserved.
16466
16200
  // Use of this source code is governed by a BSD-style
16467
16201
  // license that can be found in the LICENSE file.
16468
- const T$5 = 'plugins.poster';
16202
+ const T$6 = 'plugins.poster';
16469
16203
  /**
16470
16204
  * `PLUGIN` that displays a poster image in the background and a big play button on top when playback is stopped
16471
16205
  * @beta
@@ -16576,7 +16310,7 @@ class Poster extends UIContainerPlugin {
16576
16310
  super.disable();
16577
16311
  }
16578
16312
  onError(error) {
16579
- trace(`${T$5} onError`, {
16313
+ trace(`${T$6} onError`, {
16580
16314
  enabled: this.enabled,
16581
16315
  });
16582
16316
  this.hasFatalError = error.level === PlayerError.Levels.FATAL;
@@ -16597,7 +16331,7 @@ class Poster extends UIContainerPlugin {
16597
16331
  this.update();
16598
16332
  }
16599
16333
  onStop() {
16600
- trace(`${T$5} onStop`, {
16334
+ trace(`${T$6} onStop`, {
16601
16335
  enabled: this.enabled,
16602
16336
  });
16603
16337
  this.hasStartedPlaying = false;
@@ -16605,7 +16339,7 @@ class Poster extends UIContainerPlugin {
16605
16339
  this.update();
16606
16340
  }
16607
16341
  updatePlayButton(show) {
16608
- trace(`${T$5} updatePlayButton`, {
16342
+ trace(`${T$6} updatePlayButton`, {
16609
16343
  chromeless: this.options.chromeless,
16610
16344
  allowUserInteraction: this.options.allowUserInteraction,
16611
16345
  });
@@ -16633,7 +16367,7 @@ class Poster extends UIContainerPlugin {
16633
16367
  this.$el.removeClass('clickable');
16634
16368
  }
16635
16369
  clicked() {
16636
- trace(`${T$5} clicked`, {
16370
+ trace(`${T$6} clicked`, {
16637
16371
  hasStartedPlaying: this.hasStartedPlaying,
16638
16372
  chromeless: this.options.chromeless,
16639
16373
  allowUserInteraction: this.options.allowUserInteraction,
@@ -16654,7 +16388,7 @@ class Poster extends UIContainerPlugin {
16654
16388
  return !this.container.playback.isAudioOnly;
16655
16389
  }
16656
16390
  update() {
16657
- trace(`${T$5} update`, {
16391
+ trace(`${T$6} update`, {
16658
16392
  shouldRender: this.shouldRender,
16659
16393
  });
16660
16394
  if (!this.shouldRender) {
@@ -16667,7 +16401,7 @@ class Poster extends UIContainerPlugin {
16667
16401
  this.updatePoster();
16668
16402
  }
16669
16403
  updatePoster() {
16670
- trace(`${T$5} updatePoster`, {
16404
+ trace(`${T$6} updatePoster`, {
16671
16405
  hasStartedPlaying: this.hasStartedPlaying,
16672
16406
  });
16673
16407
  if (!this.hasStartedPlaying) {
@@ -16682,7 +16416,7 @@ class Poster extends UIContainerPlugin {
16682
16416
  this.$el.show();
16683
16417
  }
16684
16418
  hidePoster() {
16685
- trace(`${T$5} hidePoster`, {
16419
+ trace(`${T$6} hidePoster`, {
16686
16420
  shouldHideOnPlay: this.shouldHideOnPlay(),
16687
16421
  });
16688
16422
  if (!this.options.disableMediaControl) {
@@ -16732,6 +16466,275 @@ class Poster extends UIContainerPlugin {
16732
16466
  }
16733
16467
  }
16734
16468
 
16469
+ 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";
16470
+
16471
+ 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";
16472
+
16473
+ 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";
16474
+
16475
+ const T$5 = 'plugins.quality_levels';
16476
+ const VERSION$2 = 'v2.22.5';
16477
+ /**
16478
+ * `PLUGIN` that provides a UI to select the desired quality level of the playback.
16479
+ * @beta
16480
+ *
16481
+ * @remarks
16482
+ * Depends on:
16483
+ *
16484
+ * - {@link MediaControl}
16485
+ *
16486
+ * - {@link BottomGear}
16487
+ *
16488
+ * The plugin is rendered as an item in the gear menu, which, when clicked, shows a list of quality levels to choose from.
16489
+ *
16490
+ * Configuration options - {@link QualityLevelsPluginSettings}
16491
+ *
16492
+ * @example
16493
+ * ```ts
16494
+ * new Player({
16495
+ * qualityLevels: {
16496
+ * restrictResolution: 360,
16497
+ * labels: { 360: 'SD', 720: 'HD' },
16498
+ * },
16499
+ * })
16500
+ * ```
16501
+ */
16502
+ class QualityLevels extends UICorePlugin {
16503
+ levels = [];
16504
+ levelLabels = [];
16505
+ removeAuto = false;
16506
+ isHd = false;
16507
+ currentText = '';
16508
+ selectedLevelId = -1;
16509
+ static buttonTemplate = tmpl(buttonHtml);
16510
+ static listTemplate = tmpl(listHtml);
16511
+ /**
16512
+ * @internal
16513
+ */
16514
+ get name() {
16515
+ return 'level_selector';
16516
+ }
16517
+ /**
16518
+ * @internal
16519
+ */
16520
+ get supportedVersion() {
16521
+ return { min: CLAPPR_VERSION };
16522
+ }
16523
+ /**
16524
+ * @internal
16525
+ */
16526
+ static get version() {
16527
+ return VERSION$2;
16528
+ }
16529
+ /**
16530
+ * @internal
16531
+ */
16532
+ get attributes() {
16533
+ return {
16534
+ class: 'level-selector',
16535
+ 'data-level-selector': '',
16536
+ };
16537
+ }
16538
+ get events() {
16539
+ return {
16540
+ 'click .gear-sub-menu_btn': 'onSelect',
16541
+ 'click .go-back': 'goBack',
16542
+ };
16543
+ }
16544
+ /**
16545
+ * @internal
16546
+ */
16547
+ bindEvents() {
16548
+ this.listenToOnce(this.core, Events.CORE_READY, this.onCoreReady);
16549
+ this.listenTo(this.core, Events.CORE_ACTIVE_CONTAINER_CHANGED, this.onActiveContainerChange);
16550
+ }
16551
+ onCoreReady() {
16552
+ const gear = this.core.getPlugin('bottom_gear');
16553
+ assert(gear, 'bottom_gear plugin is required');
16554
+ this.currentText = this.core.i18n.t('auto');
16555
+ this.listenTo(gear, GearEvents.RENDERED, this.onGearRendered);
16556
+ }
16557
+ onGearRendered() {
16558
+ this.render();
16559
+ }
16560
+ onActiveContainerChange() {
16561
+ this.removeAuto = false;
16562
+ this.isHd = false;
16563
+ const activePlayback = this.core.activePlayback;
16564
+ this.listenTo(activePlayback, Events.PLAYBACK_LEVELS_AVAILABLE, this.onLevelsAvailable);
16565
+ this.listenTo(activePlayback, Events.PLAYBACK_LEVEL_SWITCH_START, this.onLevelSwitchStart);
16566
+ this.listenTo(activePlayback, Events.PLAYBACK_LEVEL_SWITCH_END, this.onLevelSwitchEnd);
16567
+ this.listenTo(activePlayback, Events.PLAYBACK_BITRATE, this.onBitrate);
16568
+ this.listenTo(activePlayback, Events.PLAYBACK_STOP, this.onStop);
16569
+ this.listenTo(activePlayback, Events.PLAYBACK_HIGHDEFINITIONUPDATE, (isHd) => {
16570
+ this.isHd = isHd;
16571
+ this.updateHd();
16572
+ });
16573
+ if (activePlayback.levels?.length > 0) {
16574
+ this.onLevelsAvailable(activePlayback.levels);
16575
+ }
16576
+ }
16577
+ updateHd() {
16578
+ if (this.isHd) {
16579
+ this.$el.find('.gear-option_hd-icon').removeClass('hidden');
16580
+ }
16581
+ else {
16582
+ this.$el.find('.gear-option_hd-icon').addClass('hidden');
16583
+ }
16584
+ }
16585
+ onStop() {
16586
+ this.listenToOnce(this.core.activePlayback, Events.PLAYBACK_PLAY, () => {
16587
+ if (this.core.activePlayback.getPlaybackType() === 'live') {
16588
+ if (this.selectedLevelId !== -1) {
16589
+ this.core.activePlayback.currentLevel = this.selectedLevelId;
16590
+ }
16591
+ }
16592
+ });
16593
+ }
16594
+ shouldRender() {
16595
+ const activePlayback = this.core.activePlayback;
16596
+ if (!activePlayback) {
16597
+ return false;
16598
+ }
16599
+ const supportsCurrentLevel = 'currentLevel' in activePlayback;
16600
+ if (!supportsCurrentLevel) {
16601
+ return false;
16602
+ }
16603
+ // Only care if we have at least 2 to choose from
16604
+ return !!(this.levels && this.levels.length > 1);
16605
+ }
16606
+ /**
16607
+ * @internal
16608
+ */
16609
+ render() {
16610
+ if (!this.shouldRender()) {
16611
+ return this;
16612
+ }
16613
+ this.renderDropdown();
16614
+ this.updateButton();
16615
+ return this;
16616
+ }
16617
+ renderDropdown() {
16618
+ this.$el.html(QualityLevels.listTemplate({
16619
+ arrowLeftIcon,
16620
+ checkIcon,
16621
+ current: this.selectedLevelId,
16622
+ labels: this.levelLabels,
16623
+ levels: this.levels,
16624
+ maxLevel: this.maxLevel,
16625
+ removeAuto: this.removeAuto,
16626
+ i18n: this.core.i18n,
16627
+ }));
16628
+ }
16629
+ updateButton() {
16630
+ this.core.getPlugin('bottom_gear')
16631
+ ?.addItem('quality', this.$el)
16632
+ .html(QualityLevels.buttonTemplate({
16633
+ arrowRightIcon,
16634
+ currentText: this.currentText,
16635
+ isHd: this.isHd,
16636
+ hdIcon,
16637
+ i18n: this.core.i18n,
16638
+ }));
16639
+ }
16640
+ get pluginOptions() {
16641
+ return (this.core.options.qualityLevels || this.core.options.levelSelector || {});
16642
+ }
16643
+ get maxLevel() {
16644
+ const maxRes = this.pluginOptions.restrictResolution;
16645
+ return maxRes
16646
+ ? this.levels.find((level) => (level.height > level.width ? level.width : level.height) ===
16647
+ maxRes)?.level ?? -1
16648
+ : -1;
16649
+ }
16650
+ onLevelsAvailable(levels) {
16651
+ const maxResolution = this.pluginOptions.restrictResolution;
16652
+ this.levels = levels;
16653
+ this.makeLevelsLabels();
16654
+ if (maxResolution) {
16655
+ this.removeAuto = true;
16656
+ const initialLevel = levels
16657
+ .filter((level) => (level.width > level.height ? level.height : level.width) <=
16658
+ maxResolution)
16659
+ .pop();
16660
+ this.setLevel(initialLevel?.level ?? 0);
16661
+ }
16662
+ this.render();
16663
+ }
16664
+ makeLevelsLabels() {
16665
+ const labels = this.pluginOptions.labels ?? {};
16666
+ this.levelLabels = [];
16667
+ for (const level of this.levels) {
16668
+ const ll = level.width > level.height ? level.height : level.width;
16669
+ const label = labels[ll] || `${ll}p`;
16670
+ this.levelLabels.push(label);
16671
+ }
16672
+ }
16673
+ onSelect(event) {
16674
+ const selectedLevel = parseInt(event.currentTarget?.dataset?.id ?? '-1', 10);
16675
+ this.setLevel(selectedLevel);
16676
+ event.stopPropagation();
16677
+ event.preventDefault();
16678
+ return false;
16679
+ }
16680
+ goBack() {
16681
+ this.core.getPlugin('bottom_gear').refresh();
16682
+ }
16683
+ setLevel(index) {
16684
+ this.selectedLevelId = index;
16685
+ this.core.activePlayback.currentLevel = this.selectedLevelId;
16686
+ this.highlightCurrentLevel();
16687
+ }
16688
+ allLevelElements() {
16689
+ return this.$('#level-selector-menu li');
16690
+ }
16691
+ levelElement(id = -1) {
16692
+ return this.$(`#level-selector-menu a[data-id="${id}"]`).parent();
16693
+ }
16694
+ onLevelSwitchStart() {
16695
+ this.levelElement(this.selectedLevelId).addClass('changing');
16696
+ }
16697
+ onLevelSwitchEnd() {
16698
+ this.levelElement(this.selectedLevelId).removeClass('changing');
16699
+ }
16700
+ updateText(level) {
16701
+ this.currentText = this.getLevelLabel(level);
16702
+ this.updateButton();
16703
+ }
16704
+ getLevelLabel(id) {
16705
+ if (id < 0) {
16706
+ return this.core.i18n.t('auto');
16707
+ }
16708
+ const index = this.levels.findIndex((l) => l.level === id);
16709
+ if (index < 0) {
16710
+ return this.core.i18n.t('auto');
16711
+ }
16712
+ return this.levelLabels[index] ?? formatLevelLabel(this.levels[index]);
16713
+ }
16714
+ onBitrate(info) {
16715
+ this.highlightCurrentLevel();
16716
+ }
16717
+ highlightCurrentLevel() {
16718
+ trace(`${T$5} highlightCurrentLevel`, {
16719
+ selectedLevelId: this.selectedLevelId,
16720
+ });
16721
+ this.allLevelElements()
16722
+ .removeClass('current')
16723
+ .find('a')
16724
+ .removeClass('gcore-skin-active');
16725
+ const currentLevelElement = this.levelElement(this.selectedLevelId);
16726
+ currentLevelElement
16727
+ .addClass('current')
16728
+ .find('a')
16729
+ .addClass('gcore-skin-active');
16730
+ this.updateText(this.selectedLevelId);
16731
+ }
16732
+ }
16733
+ function formatLevelLabel(level) {
16734
+ const h = level.width > level.height ? level.height : level.width;
16735
+ return `${h}p`;
16736
+ }
16737
+
16735
16738
  const seekTimeHTML = "<span data-seek-time></span>\n<span data-duration></span>\n";
16736
16739
 
16737
16740
  // Copyright 2014 Globo.com Player authors. All rights reserved.
@@ -18691,4 +18694,4 @@ class VolumeFade extends UICorePlugin {
18691
18694
  }
18692
18695
  }
18693
18696
 
18694
- export { AudioTracks as AudioSelector, AudioTracks, BigMuteButton, BottomGear, ClapprNerdStats, ClapprStats, ClickToPause, ClipsPlugin, ClosedCaptions, ContextMenu, DvrControls, ErrorScreen, Favicon, GearEvents, GoogleAnalytics, LevelSelector, Logo, MediaControl, MultiCamera, PictureInPicture, PlaybackRate, Poster, SeekTime, Share, SkipTime, SourceController, SpinnerThreeBounce as Spinner, SpinnerEvents, SpinnerThreeBounce, ClosedCaptions as Subtitles, Telemetry, TelemetryEvent, Thumbnails, VolumeFade, VolumeFadeEvents };
18697
+ export { AudioTracks as AudioSelector, AudioTracks, BigMuteButton, BottomGear, ClapprNerdStats, ClapprStats, ClickToPause, ClipsPlugin, ClosedCaptions, ContextMenu, DvrControls, ErrorScreen, Favicon, GearEvents, GoogleAnalytics, QualityLevels as LevelSelector, Logo, MediaControl, MultiCamera, PictureInPicture, PlaybackRate, Poster, QualityLevels, SeekTime, Share, SkipTime, SourceController, SpinnerThreeBounce as Spinner, SpinnerEvents, SpinnerThreeBounce, ClosedCaptions as Subtitles, Telemetry, TelemetryEvent, Thumbnails, VolumeFade, VolumeFadeEvents };