@gcorevideo/player 2.22.14 → 2.22.16

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 (80) hide show
  1. package/assets/clips/clips.ejs +1 -0
  2. package/assets/clips/clips.scss +23 -3
  3. package/assets/context-menu/context_menu.ejs +14 -6
  4. package/assets/context-menu/context_menu.scss +18 -4
  5. package/assets/level-selector/list.ejs +9 -3
  6. package/assets/media-control/media-control.ejs +1 -9
  7. package/assets/media-control/media-control.scss +0 -25
  8. package/assets/media-control/width370.scss +4 -4
  9. package/dist/core.js +5 -23
  10. package/dist/index.css +424 -412
  11. package/dist/index.js +294 -286
  12. package/dist/player.d.ts +211 -144
  13. package/dist/plugins/index.css +1513 -1501
  14. package/dist/plugins/index.js +224 -227
  15. package/docs/api/{player.audioselector.md → player.audiotracks.md} +3 -3
  16. package/docs/api/player.contextmenu.md +2 -0
  17. package/docs/api/player.contextmenupluginsettings.md +2 -40
  18. package/docs/api/{player.contextmenupluginsettings.label.md → player.contextmenupluginsettings.options.md} +3 -3
  19. package/docs/api/player.md +78 -23
  20. package/docs/api/player.mediacontrol.md +8 -14
  21. package/docs/api/player.mediacontrolelement.md +4 -2
  22. package/docs/api/{player.contextmenupluginsettings.preventshowcontextmenu.md → player.mediacontrollayerelement.md} +5 -3
  23. package/docs/api/player.mediacontrolleftelement.md +16 -0
  24. package/docs/api/player.mediacontrolrightelement.md +16 -0
  25. package/docs/api/player.mediacontrolsettings.md +23 -0
  26. package/docs/api/{player.contextmenupluginsettings.url.md → player.menuoption.md} +10 -3
  27. package/docs/api/player.playbackrate.md +1 -1
  28. package/docs/api/player.playerconfig.md +1 -1
  29. package/docs/api/player.playerconfig.playbacktype.md +1 -1
  30. package/docs/api/{player.levelselector.events.md → player.qualitylevels.events.md} +2 -2
  31. package/docs/api/{player.levelselector.md → player.qualitylevels.md} +6 -6
  32. package/docs/api/{player.levelselectorpluginsettings.labels.md → player.qualitylevelspluginsettings.labels.md} +2 -2
  33. package/docs/api/{player.levelselectorpluginsettings.md → player.qualitylevelspluginsettings.md} +6 -6
  34. package/docs/api/{player.levelselectorpluginsettings.restrictresolution.md → player.qualitylevelspluginsettings.restrictresolution.md} +2 -2
  35. package/lib/Player.d.ts.map +1 -1
  36. package/lib/Player.js +4 -1
  37. package/lib/playback/hls-playback/HlsPlayback.d.ts.map +1 -1
  38. package/lib/playback/hls-playback/HlsPlayback.js +0 -21
  39. package/lib/plugins/click-to-pause/ClickToPause.js +1 -1
  40. package/lib/plugins/clips/Clips.d.ts +21 -16
  41. package/lib/plugins/clips/Clips.d.ts.map +1 -1
  42. package/lib/plugins/clips/Clips.js +96 -98
  43. package/lib/plugins/clips/types.d.ts +19 -0
  44. package/lib/plugins/clips/types.d.ts.map +1 -0
  45. package/lib/plugins/clips/types.js +1 -0
  46. package/lib/plugins/clips/utils.d.ts +4 -0
  47. package/lib/plugins/clips/utils.d.ts.map +1 -0
  48. package/lib/plugins/clips/utils.js +36 -0
  49. package/lib/plugins/context-menu/ContextMenu.d.ts +33 -12
  50. package/lib/plugins/context-menu/ContextMenu.d.ts.map +1 -1
  51. package/lib/plugins/context-menu/ContextMenu.js +40 -37
  52. package/lib/plugins/media-control/MediaControl.d.ts +4 -7
  53. package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
  54. package/lib/plugins/media-control/MediaControl.js +19 -31
  55. package/lib/plugins/utils.d.ts +9 -1
  56. package/lib/plugins/utils.d.ts.map +1 -1
  57. package/lib/plugins/utils.js +9 -10
  58. package/lib/plugins/vast-ads/loaderxml.js +2 -2
  59. package/lib/testUtils.d.ts.map +1 -1
  60. package/lib/testUtils.js +2 -5
  61. package/package.json +1 -1
  62. package/src/Player.ts +4 -3
  63. package/src/playback/hls-playback/HlsPlayback.ts +0 -22
  64. package/src/plugins/click-to-pause/ClickToPause.ts +1 -1
  65. package/src/plugins/clips/Clips.ts +116 -135
  66. package/src/plugins/clips/__tests__/Clips.test.ts +72 -0
  67. package/src/plugins/clips/__tests__/__snapshots__/Clips.test.ts.snap +14 -0
  68. package/src/plugins/clips/types.ts +22 -0
  69. package/src/plugins/clips/utils.ts +54 -0
  70. package/src/plugins/context-menu/ContextMenu.ts +72 -56
  71. package/src/plugins/level-selector/__tests__/__snapshots__/QualityLevels.test.ts.snap +18 -18
  72. package/src/plugins/media-control/MediaControl.ts +31 -58
  73. package/src/plugins/media-control/__tests__/MediaControl.test.ts +66 -30
  74. package/src/plugins/media-control/__tests__/__snapshots__/MediaControl.test.ts.snap +7 -35
  75. package/src/plugins/utils.ts +9 -7
  76. package/src/plugins/vast-ads/loaderxml.ts +2 -2
  77. package/src/testUtils.ts +2 -5
  78. package/temp/player.api.json +332 -262
  79. package/tsconfig.tsbuildinfo +1 -1
  80. package/docs/api/player.mediacontrol.handlecustomarea.md +0 -52
@@ -9765,13 +9765,13 @@ function ifError(err) {
9765
9765
 
9766
9766
  // assert(process.env.CLAPPR_VERSION, 'CLAPPR_VERSION is required');
9767
9767
  // export const CLAPPR_VERSION: string = process.env.CLAPPR_VERSION || '0.11.3';
9768
- const CLAPPR_VERSION = '0.11.3';
9768
+ const CLAPPR_VERSION$1 = '0.11.3';
9769
9769
 
9770
9770
  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";
9771
9771
 
9772
9772
  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";
9773
9773
 
9774
- const VERSION$6 = '2.22.4';
9774
+ const VERSION$7 = '2.22.4';
9775
9775
  // const T = 'plugins.audiotracks'
9776
9776
  /**
9777
9777
  * `PLUGIN` that makes possible to switch audio tracks via the media control UI.
@@ -9796,13 +9796,13 @@ class AudioTracks extends UICorePlugin {
9796
9796
  * @internal
9797
9797
  */
9798
9798
  get supportedVersion() {
9799
- return { min: CLAPPR_VERSION };
9799
+ return { min: CLAPPR_VERSION$1 };
9800
9800
  }
9801
9801
  /**
9802
9802
  * @internal
9803
9803
  */
9804
9804
  static get version() {
9805
- return VERSION$6;
9805
+ return VERSION$7;
9806
9806
  }
9807
9807
  static template = tmpl(pluginHtml$7);
9808
9808
  /**
@@ -9965,7 +9965,7 @@ class BigMuteButton extends UICorePlugin {
9965
9965
  * @internal
9966
9966
  */
9967
9967
  get supportedVersion() {
9968
- return { min: CLAPPR_VERSION };
9968
+ return { min: CLAPPR_VERSION$1 };
9969
9969
  }
9970
9970
  static template = tmpl(pluginHtml$6);
9971
9971
  /**
@@ -10086,7 +10086,7 @@ const gearIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"n
10086
10086
 
10087
10087
  const gearHdIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <g clip-path=\"url(#clip0_28_1567)\">\n <path\n d=\"M19.14 12.94C19.18 12.64 19.2 12.33 19.2 12C19.2 11.68 19.18 11.36 19.13 11.06L21.16 9.47999C21.34 9.33999 21.39 9.06999 21.28 8.86999L19.36 5.54999C19.24 5.32999 18.99 5.25999 18.77 5.32999L16.38 6.28999C15.88 5.90999 15.35 5.58999 14.76 5.34999L14.4 2.80999C14.36 2.56999 14.16 2.39999 13.92 2.39999H10.08C9.83999 2.39999 9.64999 2.56999 9.60999 2.80999L9.24999 5.34999C8.65999 5.58999 8.11999 5.91999 7.62999 6.28999L5.23999 5.32999C5.01999 5.24999 4.76999 5.32999 4.64999 5.54999L2.73999 8.86999C2.61999 9.07999 2.65999 9.33999 2.85999 9.47999L4.88999 11.06C4.83999 11.36 4.79999 11.69 4.79999 12C4.79999 12.31 4.81999 12.64 4.86999 12.94L2.83999 14.52C2.65999 14.66 2.60999 14.93 2.71999 15.13L4.63999 18.45C4.75999 18.67 5.00999 18.74 5.22999 18.67L7.61999 17.71C8.11999 18.09 8.64999 18.41 9.23999 18.65L9.59999 21.19C9.64999 21.43 9.83999 21.6 10.08 21.6H13.92C14.16 21.6 14.36 21.43 14.39 21.19L14.75 18.65C15.34 18.41 15.88 18.09 16.37 17.71L18.76 18.67C18.98 18.75 19.23 18.67 19.35 18.45L21.27 15.13C21.39 14.91 21.34 14.66 21.15 14.52L19.14 12.94ZM12 15.6C10.02 15.6 8.39999 13.98 8.39999 12C8.39999 10.02 10.02 8.39999 12 8.39999C13.98 8.39999 15.6 10.02 15.6 12C15.6 13.98 13.98 15.6 12 15.6Z\"\n fill=\"#C9C9C9\"/>\n <rect x=\"13\" width=\"11\" height=\"7\" rx=\"1\" fill=\"#F6413B\"/>\n <path\n d=\"M14.6962 6V1.63636H15.3546V3.53267H17.53V1.63636H18.1905V6H17.53V4.0973H15.3546V6H14.6962ZM20.562 6H19.1493V1.63636H20.6067C21.0343 1.63636 21.4015 1.72372 21.7083 1.89844C22.0151 2.07173 22.2502 2.32102 22.4135 2.64631C22.5783 2.97017 22.6607 3.35866 22.6607 3.81179C22.6607 4.26634 22.5776 4.65696 22.4114 4.98366C22.2466 5.31037 22.008 5.56179 21.6955 5.73793C21.383 5.91264 21.0051 6 20.562 6ZM19.8077 5.42472H20.5257C20.8581 5.42472 21.1344 5.36222 21.3546 5.23722C21.5748 5.1108 21.7395 4.92827 21.8489 4.68963C21.9583 4.44957 22.013 4.15696 22.013 3.81179C22.013 3.46946 21.9583 3.17898 21.8489 2.94034C21.7409 2.7017 21.5797 2.5206 21.3652 2.39702C21.1507 2.27344 20.8844 2.21165 20.5662 2.21165H19.8077V5.42472Z\"\n fill=\"#C9C9C9\"/>\n </g>\n <defs>\n <clipPath id=\"clip0_28_1567\">\n <rect width=\"24\" height=\"24\" fill=\"white\"/>\n </clipPath>\n </defs>\n</svg>\n";
10088
10088
 
10089
- const VERSION$5 = '2.19.12';
10089
+ const VERSION$6 = '2.19.12';
10090
10090
  /**
10091
10091
  * Events triggered by the plugin
10092
10092
  * @beta
@@ -10179,13 +10179,13 @@ class BottomGear extends UICorePlugin {
10179
10179
  * @internal
10180
10180
  */
10181
10181
  get supportedVersion() {
10182
- return { min: CLAPPR_VERSION };
10182
+ return { min: CLAPPR_VERSION$1 };
10183
10183
  }
10184
10184
  /**
10185
10185
  * @internal
10186
10186
  */
10187
10187
  static get version() {
10188
- return VERSION$5;
10188
+ return VERSION$6;
10189
10189
  }
10190
10190
  static template = tmpl(pluginHtml$5);
10191
10191
  /**
@@ -12483,7 +12483,7 @@ class ClapprNerdStats extends UICorePlugin {
12483
12483
  * @internal
12484
12484
  */
12485
12485
  get supportedVersion() {
12486
- return { min: CLAPPR_VERSION };
12486
+ return { min: CLAPPR_VERSION$1 };
12487
12487
  }
12488
12488
  static template = tmpl(pluginHtml$4);
12489
12489
  /**
@@ -12738,7 +12738,7 @@ class ClapprStats extends ContainerPlugin {
12738
12738
  * @internal
12739
12739
  */
12740
12740
  get supportedVersion() {
12741
- return { min: CLAPPR_VERSION };
12741
+ return { min: CLAPPR_VERSION$1 };
12742
12742
  }
12743
12743
  get _playbackName() {
12744
12744
  return String(this.container.playback.name || '');
@@ -13077,7 +13077,7 @@ class ClickToPause extends ContainerPlugin {
13077
13077
  * @internal
13078
13078
  */
13079
13079
  get supportedVersion() {
13080
- return { min: CLAPPR_VERSION };
13080
+ return { min: CLAPPR_VERSION$1 };
13081
13081
  }
13082
13082
  /**
13083
13083
  * @internal
@@ -13127,7 +13127,15 @@ class ClickToPause extends ContainerPlugin {
13127
13127
  }
13128
13128
  }
13129
13129
 
13130
- function strtimeToMiliseconds(str) {
13130
+ /**
13131
+ * Parse a time string in the format "hh:mm:ss" or "mm:ss" or "ss" to seconds.
13132
+ * @param str - The time string to parse.
13133
+ * @returns The time in seconds.
13134
+ * @example "01:01:00" -> 3660
13135
+ * @example "01:00" -> 60
13136
+ * @example "33" -> 33
13137
+ */
13138
+ function parseClipTime(str) {
13131
13139
  if (!str) {
13132
13140
  return 0;
13133
13141
  }
@@ -13136,21 +13144,12 @@ function strtimeToMiliseconds(str) {
13136
13144
  if (arr.length >= 3) {
13137
13145
  h = parseInt(arr[arr.length - 3]) * 60 * 60;
13138
13146
  }
13139
- else {
13140
- h = 0;
13141
- }
13142
13147
  if (arr.length >= 2) {
13143
13148
  m = parseInt(arr[arr.length - 2]) * 60;
13144
13149
  }
13145
- else {
13146
- m = 0;
13147
- }
13148
13150
  if (arr.length >= 1) {
13149
13151
  s = parseInt(arr[arr.length - 1]);
13150
13152
  }
13151
- else {
13152
- s = 0;
13153
- }
13154
13153
  return (h + m + s);
13155
13154
  }
13156
13155
  function getPageX(event) {
@@ -13163,22 +13162,64 @@ function getPageX(event) {
13163
13162
  return 0;
13164
13163
  }
13165
13164
 
13165
+ function parseClips(text) {
13166
+ const clipsArr = text
13167
+ .split('\n')
13168
+ .map((val) => {
13169
+ const matchRes = val.match(/(((\d+:)?\d+:)?\d+) (.+)/i);
13170
+ return matchRes
13171
+ ? {
13172
+ start: parseClipTime(matchRes[1]),
13173
+ text: matchRes[4],
13174
+ }
13175
+ : null;
13176
+ })
13177
+ .filter((clip) => clip !== null)
13178
+ .sort((a, b) => a.start - b.start);
13179
+ return clipsArr.map((clip, index) => ({
13180
+ start: clip.start,
13181
+ text: clip.text,
13182
+ end: index < clipsArr.length - 1 ? clipsArr[index + 1].start : 0,
13183
+ }));
13184
+ }
13185
+ function buildSvg(clips, duration, barWidth) {
13186
+ let svg = '<svg width="0" height="0">\n' + '<defs>\n' + '<clipPath id="myClip">\n';
13187
+ let rightEdge = 0;
13188
+ clips.forEach((val) => {
13189
+ const end = val.end || duration;
13190
+ const chunkWidth = Math.round(((end - val.start) * barWidth) / duration);
13191
+ svg += `<rect x="${rightEdge}" y="0" width="${chunkWidth - 2}" height="30"/>\n`;
13192
+ rightEdge += chunkWidth;
13193
+ });
13194
+ if (rightEdge < barWidth) {
13195
+ svg += `<rect x="${rightEdge}" y="0" width="${barWidth - rightEdge}" height="30"/>\n`;
13196
+ }
13197
+ svg += '</clipPath>' + '</defs>' + '</svg>';
13198
+ return svg;
13199
+ }
13200
+
13201
+ const clipsHTML = "<div class=\"media-clip-text\" id=\"clips-text\"></div>";
13202
+
13203
+ const VERSION$5 = '2.22.16';
13204
+ const CLAPPR_VERSION = '0.11.4';
13166
13205
  /**
13167
- * `PLUGIN` that shows text over the seekbar to indicate the current clip.
13206
+ * `PLUGIN` that allows marking up the timeline of the video
13168
13207
  * @beta
13169
13208
  * @remarks
13209
+ * The plugin decorates the seekbar with notches to indicate the clips of the video and displays current clip text in the left panel
13210
+ *
13170
13211
  * Depends on:
13171
13212
  *
13172
13213
  * - {@link MediaControl}
13173
13214
  *
13174
13215
  * Configuration options - {@link ClipsPluginSettings}
13175
13216
  */
13176
- class ClipsPlugin extends UICorePlugin {
13177
- clips = new Map();
13178
- duration = 0;
13179
- durationGetting = false;
13180
- _oldContainer;
13217
+ class Clips extends UICorePlugin {
13218
+ barStyle = null;
13219
+ clips = [];
13220
+ oldContainer;
13181
13221
  svgMask = null;
13222
+ static template = tmpl(clipsHTML);
13182
13223
  /**
13183
13224
  * @internal
13184
13225
  */
@@ -13190,170 +13231,133 @@ class ClipsPlugin extends UICorePlugin {
13190
13231
  */
13191
13232
  get attributes() {
13192
13233
  return {
13193
- class: this.name,
13234
+ class: 'media-control-clips',
13194
13235
  };
13195
13236
  }
13237
+ get version() {
13238
+ return VERSION$5;
13239
+ }
13240
+ get supportedVersion() {
13241
+ return { min: CLAPPR_VERSION };
13242
+ }
13196
13243
  /**
13197
13244
  * @internal
13198
13245
  */
13199
13246
  bindEvents() {
13200
- const mediaControl = this.core.getPlugin('media_control');
13201
- assert(mediaControl, 'media_control plugin is required');
13202
- this.listenToOnce(this.core, Events.CORE_READY, this._onCoreReady);
13203
- // TODO listen to CORE_ACTIVE_CONTAINER_CHANGED
13204
- this.listenTo(mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this._onMediaControlContainerChanged);
13247
+ this.listenToOnce(this.core, Events.CORE_READY, this.onCoreReady);
13205
13248
  this.listenTo(this.core, Events.CORE_RESIZE, this.playerResize);
13249
+ this.listenTo(this.core, Events.CORE_ACTIVE_CONTAINER_CHANGED, this.onContainerChanged);
13206
13250
  }
13207
- _onCoreReady() {
13251
+ render() {
13208
13252
  if (!this.options.clips) {
13209
- this.destroy();
13210
- return;
13253
+ return this;
13211
13254
  }
13212
- this.parseClips();
13213
- }
13214
- _onMediaControlContainerChanged() {
13215
- this._bindContainerEvents();
13255
+ this.$el.html(Clips.template());
13256
+ this.$el.hide();
13257
+ return this;
13216
13258
  }
13217
- playerResize() {
13218
- this.durationGetting = false;
13219
- if (this.durationGetting) {
13220
- this.makeSvg(this.duration);
13259
+ destroy() {
13260
+ if (this.barStyle) {
13261
+ this.barStyle.remove();
13262
+ this.barStyle = null;
13221
13263
  }
13264
+ return super.destroy();
13222
13265
  }
13223
- _bindContainerEvents() {
13224
- if (this._oldContainer) {
13225
- this.stopListening(this._oldContainer, Events.CONTAINER_TIMEUPDATE, this.onTimeUpdate);
13266
+ disable() {
13267
+ if (this.barStyle) {
13268
+ this.barStyle.remove();
13269
+ this.barStyle = null;
13226
13270
  }
13271
+ return super.disable();
13272
+ }
13273
+ enable() {
13274
+ this.render();
13275
+ return super.enable();
13276
+ }
13277
+ onCoreReady() {
13227
13278
  const mediaControl = this.core.getPlugin('media_control');
13228
- this._oldContainer = mediaControl.container;
13229
- this.durationGetting = false;
13230
- this.listenTo(mediaControl.container, Events.CONTAINER_TIMEUPDATE, this.onTimeUpdate);
13279
+ assert(mediaControl, 'media_control plugin is required');
13280
+ this.parseClips(this.options.clips.text);
13281
+ this.listenTo(mediaControl, Events.MEDIACONTROL_RENDERED, this.onMcRender);
13282
+ }
13283
+ onMcRender() {
13284
+ const mediaControl = this.core.getPlugin('media_control');
13285
+ mediaControl.mount('clips', this.$el);
13286
+ }
13287
+ onContainerChanged() {
13288
+ // TODO figure out the conditions of changing the container (without destroying the previous one)
13289
+ if (this.oldContainer) {
13290
+ this.stopListening(this.oldContainer, Events.CONTAINER_TIMEUPDATE, this.onTimeUpdate);
13291
+ }
13292
+ this.oldContainer = this.core.activeContainer;
13293
+ if (this.svgMask) {
13294
+ this.svgMask.remove();
13295
+ this.svgMask = null;
13296
+ }
13297
+ this.listenTo(this.core.activeContainer, Events.CONTAINER_TIMEUPDATE, this.onTimeUpdate);
13298
+ }
13299
+ playerResize() {
13300
+ const duration = this.core.activeContainer.getDuration();
13301
+ if (duration) {
13302
+ this.makeSvg(duration);
13303
+ }
13231
13304
  }
13232
13305
  onTimeUpdate(event) {
13233
- if (!this.durationGetting) {
13234
- this.duration = event.total;
13306
+ if (!this.svgMask) {
13235
13307
  this.makeSvg(event.total);
13236
- this.durationGetting = true;
13237
13308
  }
13238
- for (const value of this.clips.values()) {
13239
- if (event.current >= value.start && event.current < value.end) {
13309
+ for (const value of this.clips) {
13310
+ if ((event.current >= value.start && !value.end) ||
13311
+ event.current < value.end) {
13240
13312
  this.setClipText(value.text);
13241
13313
  break;
13242
13314
  }
13243
13315
  }
13244
13316
  }
13245
- parseClips() {
13246
- const textArr = this.options.clips.text.split('\n');
13247
- const clipsArr = textArr
13248
- .map((val) => {
13249
- const matchRes = val.match(/(\d+:\d+|:\d+) (.+)/i);
13250
- return matchRes
13251
- ? {
13252
- start: strtimeToMiliseconds(matchRes[1]),
13253
- text: matchRes[2],
13254
- }
13255
- : null;
13256
- })
13257
- .filter((clip) => clip !== null);
13258
- clipsArr.sort((a, b) => a.start - b.start);
13259
- clipsArr.forEach((clip, index) => {
13260
- this.clips.set(clip.start, {
13261
- index,
13262
- start: clip.start,
13263
- text: clip.text,
13264
- end: clipsArr[index + 1] ? clipsArr[index + 1].start : null,
13265
- });
13266
- });
13267
- }
13268
- /**
13269
- * Returns the text of the current clip.
13270
- * @param time - The current time of the player.
13271
- * @returns The text of the current clip.
13272
- */
13273
- getText(time) {
13274
- for (const [key, value] of this.clips.entries()) {
13275
- if (time >= value.start && time < value.end) {
13276
- return value.text;
13277
- }
13278
- }
13279
- return '';
13317
+ parseClips(text) {
13318
+ this.clips = parseClips(text);
13280
13319
  }
13281
13320
  makeSvg(duration) {
13282
- let svg = '<svg width="0" height="0">\n' + '<defs>\n' + '<clipPath id="myClip">\n';
13283
- const widthOfSeek = this.core.activeContainer.$el.width();
13284
- let finishValue = 0;
13285
- this.clips.forEach((val) => {
13286
- let end = val.end;
13287
- if (!end) {
13288
- end = val.end = duration;
13289
- }
13290
- const widthChunk = ((end - val.start) * widthOfSeek) / duration;
13291
- svg += `<rect x="${finishValue}" y="0" width="${widthChunk - 2}" height="30"/>\n`;
13292
- finishValue += widthChunk;
13293
- });
13294
- svg += `<rect x="${finishValue}" y="0" width="${widthOfSeek - finishValue}" height="30"/>\n`;
13295
- svg += '</clipPath>' + '</defs>' + '</svg>';
13321
+ const svg = buildSvg(this.clips, duration, this.core.activeContainer.$el.width());
13296
13322
  this.setSVGMask(svg);
13297
13323
  }
13298
13324
  setSVGMask(svg) {
13299
- // this.core.mediaControl.setSVGMask(svg);
13300
13325
  if (this.svgMask) {
13301
13326
  this.svgMask.remove();
13302
13327
  }
13303
- const mediaControl = this.core.getPlugin('media_control');
13304
- const $seekBarContainer = mediaControl.getElement('seekBarContainer');
13305
- if ($seekBarContainer?.get(0)) {
13306
- $seekBarContainer.addClass('clips');
13307
- }
13308
13328
  this.svgMask = $(svg);
13309
- $seekBarContainer?.append(this.svgMask);
13329
+ this.$el.append(this.svgMask);
13330
+ if (!this.barStyle) {
13331
+ this.barStyle = document.createElement('style');
13332
+ this.barStyle.textContent = `
13333
+ .bar-container[data-seekbar] {
13334
+ clip-path: url("#myClip");
13335
+ }`;
13336
+ this.$el.append(this.barStyle);
13337
+ }
13310
13338
  }
13311
13339
  setClipText(text) {
13312
- const mediaControl = this.core.getPlugin('media_control');
13313
- const $clipText = mediaControl.getElement('clipText');
13314
- if ($clipText && text) {
13315
- $clipText.show();
13316
- $clipText.text(`${text}`);
13340
+ if (text) {
13341
+ this.$el.show().find('#clips-text').text(text);
13342
+ }
13343
+ else {
13344
+ this.$el.hide();
13317
13345
  }
13318
13346
  }
13319
13347
  }
13320
13348
 
13321
- 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";
13322
-
13323
- var version$1 = "2.22.14";
13324
-
13325
- var packages = {
13326
- "node_modules/@clappr/core": {
13327
- version: "0.11.4"},
13328
- "node_modules/dashjs": {
13329
- version: "4.7.4"},
13330
- "node_modules/hls.js": {
13331
- version: "1.5.20"}};
13332
-
13333
- /**
13334
- * Version information about the gplayer and its main dependencies
13335
- * @returns Version information about the gplayer and its main dependencies
13336
- * @beta
13337
- */
13338
- function version() {
13339
- return {
13340
- gplayer: version$1,
13341
- clappr: packages['node_modules/@clappr/core'].version,
13342
- dashjs: packages['node_modules/dashjs'].version,
13343
- hlsjs: packages['node_modules/hls.js'].version,
13344
- };
13345
- }
13349
+ const templateHtml$1 = "<ul class=\"context-menu-list\" role=\"menu\" id=\"context-menu-options\">\n <% for (const item of options) { %>\n <li class=\"context-menu-list-item <%= item.class %>\">\n <button role=\"menuitem\" data-name=\"<%= item.name %>\">\n <% if (iconic) { %>\n <span class=\"context-menu-list-item_icon\"><%= item.icon || '' %></span>\n <% } %>\n <% if (item.labelKey) { %>\n <%= i18n.t(item.labelKey) %>\n <% } else { %>\n <%= item.label %>\n <% } %>\n </button>\n </li>\n <% } %>\n</ul>\n";
13346
13350
 
13347
13351
  /**
13348
13352
  * `PLUGIN` that displays a small context menu when clicked on the player container.
13349
13353
  * @beta
13350
13354
  * @remarks
13351
13355
  * Configuration options - {@link ContextMenuPluginSettings}
13356
+ *
13357
+ * Should not be used together with {@link ClickToPause} plugin
13352
13358
  */
13353
13359
  class ContextMenu extends UIContainerPlugin {
13354
- _label = '';
13355
- _url = '';
13356
- menuOptions = [];
13360
+ open = false;
13357
13361
  /**
13358
13362
  * @internal
13359
13363
  */
@@ -13364,7 +13368,7 @@ class ContextMenu extends UIContainerPlugin {
13364
13368
  * @internal
13365
13369
  */
13366
13370
  get supportedVersion() {
13367
- return { min: CLAPPR_VERSION };
13371
+ return { min: CLAPPR_VERSION$1 };
13368
13372
  }
13369
13373
  /**
13370
13374
  * @internal
@@ -13373,34 +13377,16 @@ class ContextMenu extends UIContainerPlugin {
13373
13377
  return { class: 'context-menu' };
13374
13378
  }
13375
13379
  static template = tmpl(templateHtml$1);
13376
- get label() {
13377
- return this._label || 'Gcore player ver. ' + version().gplayer;
13378
- }
13379
- get url() {
13380
- return this._url || 'https://gcore.com/';
13381
- }
13382
- get exposeVersion() {
13383
- return {
13384
- label: this.label,
13385
- name: 'version',
13386
- };
13387
- }
13388
13380
  /**
13389
13381
  * @internal
13390
13382
  */
13391
13383
  get events() {
13392
13384
  return {
13393
- 'click [data-version]': 'onOpenMainPage',
13385
+ 'click [role="menuitem"]': 'runAction',
13394
13386
  };
13395
13387
  }
13396
13388
  constructor(container) {
13397
13389
  super(container);
13398
- if (this.options.contextMenu && this.options.contextMenu.label) {
13399
- this._label = this.options.contextMenu.label;
13400
- }
13401
- if (this.options.contextMenu && this.options.contextMenu.url) {
13402
- this._url = this.options.contextMenu.url;
13403
- }
13404
13390
  this.render();
13405
13391
  $('body').on('click', this.hideOnBodyClick);
13406
13392
  }
@@ -13408,8 +13394,8 @@ class ContextMenu extends UIContainerPlugin {
13408
13394
  * @internal
13409
13395
  */
13410
13396
  bindEvents() {
13411
- this.listenTo(this.container, Events.CONTAINER_CONTEXTMENU, this.toggleContextMenu);
13412
- this.listenTo(this.container, Events.CONTAINER_CLICK, this.hide);
13397
+ this.listenTo(this.container, Events.CONTAINER_CONTEXTMENU, this.onContextMenu);
13398
+ this.listenTo(this.container, Events.CONTAINER_CLICK, this.onContainerClick);
13413
13399
  }
13414
13400
  /**
13415
13401
  * @internal
@@ -13418,34 +13404,55 @@ class ContextMenu extends UIContainerPlugin {
13418
13404
  $('body').off('click', this.hideOnBodyClick);
13419
13405
  return super.destroy();
13420
13406
  }
13421
- toggleContextMenu(event) {
13407
+ onContainerClick() {
13408
+ this.hide();
13409
+ }
13410
+ onContextMenu(event) {
13411
+ if (!this.options.contextMenu?.options?.length) {
13412
+ return;
13413
+ }
13422
13414
  event.preventDefault();
13415
+ event.stopPropagation();
13423
13416
  const offset = this.container?.$el.offset();
13424
13417
  this.show(event.pageY - offset.top, event.pageX - offset.left);
13425
13418
  }
13426
13419
  show(top, left) {
13427
- this.hide();
13428
- if (this.options.contextMenu &&
13429
- this.options.contextMenu.preventShowContextMenu) {
13430
- return;
13431
- }
13420
+ this.open = true;
13432
13421
  this.$el.css({ top, left });
13433
13422
  this.$el.show();
13434
13423
  }
13435
13424
  hide() {
13425
+ this.open = false;
13436
13426
  this.$el.hide();
13437
13427
  }
13438
- onOpenMainPage() {
13439
- window.open(this.url, '_blank');
13428
+ runAction(event) {
13429
+ event.preventDefault();
13430
+ event.stopPropagation();
13431
+ const itemName = event.currentTarget.dataset.name;
13432
+ if (!itemName) {
13433
+ return;
13434
+ }
13435
+ const item = this.options.contextMenu?.options.find((option) => option.name === itemName);
13436
+ if (item?.handler) {
13437
+ item.handler();
13438
+ }
13439
+ this.hide();
13440
13440
  }
13441
13441
  /**
13442
13442
  * @internal
13443
13443
  */
13444
13444
  render() {
13445
- this.menuOptions = [this.exposeVersion];
13446
- this.$el.html(ContextMenu.template({ options: this.menuOptions }));
13445
+ if (!this.options.contextMenu?.options?.length) {
13446
+ return this;
13447
+ }
13448
+ const options = this.options.contextMenu.options;
13449
+ this.$el.html(ContextMenu.template({
13450
+ options,
13451
+ i18n: this.container.i18n,
13452
+ iconic: options.some((option) => option.icon),
13453
+ }));
13447
13454
  this.container.$el.append(this.$el); // TODO append to the container, turn into a container plugin
13448
- this.hide();
13455
+ this.$el.hide();
13449
13456
  return this;
13450
13457
  }
13451
13458
  hideOnBodyClick = () => {
@@ -13482,7 +13489,7 @@ class DvrControls extends UICorePlugin {
13482
13489
  * @internal
13483
13490
  */
13484
13491
  get supportedVersion() {
13485
- return { min: CLAPPR_VERSION };
13492
+ return { min: CLAPPR_VERSION$1 };
13486
13493
  }
13487
13494
  /**
13488
13495
  * @internal
@@ -13588,7 +13595,7 @@ class ErrorScreen extends UICorePlugin {
13588
13595
  * @internal
13589
13596
  */
13590
13597
  get supportedVersion() {
13591
- return { min: CLAPPR_VERSION };
13598
+ return { min: CLAPPR_VERSION$1 };
13592
13599
  }
13593
13600
  static template = tmpl(templateHtml);
13594
13601
  /**
@@ -13709,7 +13716,7 @@ class Favicon extends CorePlugin {
13709
13716
  * @internal
13710
13717
  */
13711
13718
  get supportedVersion() {
13712
- return { min: CLAPPR_VERSION };
13719
+ return { min: CLAPPR_VERSION$1 };
13713
13720
  }
13714
13721
  /**
13715
13722
  * @internal
@@ -13801,7 +13808,7 @@ class GoogleAnalytics extends ContainerPlugin {
13801
13808
  return 'google_analytics';
13802
13809
  }
13803
13810
  get supportedVersion() {
13804
- return { min: CLAPPR_VERSION };
13811
+ return { min: CLAPPR_VERSION$1 };
13805
13812
  }
13806
13813
  constructor(container) {
13807
13814
  super(container);
@@ -13948,7 +13955,7 @@ class Logo extends UIContainerPlugin {
13948
13955
  return 'logo';
13949
13956
  }
13950
13957
  get supportedVersion() {
13951
- return { min: CLAPPR_VERSION };
13958
+ return { min: CLAPPR_VERSION$1 };
13952
13959
  }
13953
13960
  get template() {
13954
13961
  return tmpl(logoHTML);
@@ -14337,7 +14344,7 @@ const FullscreenIOS = {
14337
14344
  },
14338
14345
  };
14339
14346
 
14340
- const mediaControlHTML = "<div class=\"media-control-background\" data-background></div>\n\n<div class=\"media-control-layer gcore-skin-bg-color\" data-controls>\n <% var renderBar = function(name) { %>\n <div class=\"bar-container\" data-<%= name %>>\n <div class=\"bar-background\" data-<%= name %>>\n <div class=\"bar-fill-1\" data-<%= name %>></div>\n <div class=\"bar-fill-2 gcore-skin-main-color\" data-<%= name %>></div>\n <div class=\"bar-hover\" data-<%= name %>></div>\n </div>\n </div>\n <div class=\"bar-scrubber\" data-<%= name %>>\n <div class=\"bar-scrubber-icon gcore-skin-main-color\" data-<%= name %>></div>\n </div>\n <% }; %>\n <% var renderSegmentedBar = function(name, segments) {\n segments = segments || 10; %>\n <div class=\"bar-container\" data-<%= name %>>\n <div class=\"bar-background\" data-<%= name %>>\n <div class=\"bar-fill-1 gcore-skin-main-color\" data-<%= name %>></div>\n </div>\n <div class=\"bar-scrubber\" data-<%= name %>>\n <div class=\"bar-scrubber-icon gcore-skin-main-color\" data-<%= name %>></div>\n </div>\n </div>\n <% }; %>\n <% var renderDrawer = function(name, renderContent) { %>\n <div class=\"drawer-container\" data-<%= name %>>\n <div class=\"drawer-icon-container\" data-<%= name %>>\n <div class=\"drawer-icon media-control-icon gcore-skin-button-color\" data-<%= name %>></div>\n <span class=\"drawer-text\" data-<%= name %>></span>\n </div>\n <% renderContent(name); %>\n </div>\n <% }; %>\n <% var renderIndicator = function(name) { %>\n <div class=\"media-control-indicator gcore-skin-text-color\" data-<%= name %>></div>\n <% }; %>\n <% var renderQuality = function(name) { %>\n <div class=\"media-control-quality\" data-<%= name %>></div>\n <% }; %>\n <% var renderNerd = function(name) { %>\n <div class=\"media-control-nerd\" data-<%= name %>></div>\n <% }; %>\n <% var renderMultiCamera = function(name) { %>\n <div class=\"media-control-multicamera\" data-<%= name %>></div>\n <% }; %>\n <% var renderClipsText = function(name) { %>\n <div class=\"media-clip-container gcore-skin-text-color\" data-<%= name %>>\n <div class=\"media-clip-point gcore-skin-text-color\" data-<%= name %>>•</div>\n <div class=\"media-clip-text gcore-skin-text-color\" data-<%= name %>></div>\n </div>\n <% }; %>\n <% var renderVR = function(name) { %>\n <div class=\"media-control-vr\" data-<%= name %>></div>\n <% }; %>\n <% var renderButton = function(name) { %>\n <button type=\"button\" class=\"media-control-button media-control-icon gcore-skin-button-color\" data-<%= name %>\n aria-label=\"<%= name %>\"></button>\n <% }; %>\n\n <% var templates = {\n bar: renderBar,\n segmentedBar: renderSegmentedBar,\n };\n var render = function (settingsList) {\n settingsList.forEach(function (setting) {\n\n if (setting === \"seekbar\") {\n renderBar(setting);\n } else if (setting === \"volume\") {\n renderDrawer(setting, settings.volumeBarTemplate ? templates[settings.volumeBarTemplate] : function (name) {\n return renderSegmentedBar(name);\n });\n } else if (setting === \"duration\" || setting === \"position\") {\n renderIndicator(setting);\n } else if (setting === \"quality\") {\n renderQuality(setting)\n } else if (setting === \"nerd\") {\n renderNerd(setting)\n } else if (setting === \"multicamera\") {\n renderMultiCamera(setting)\n } else if (setting === \"vr\") {\n renderVR(setting)\n } else if (setting === \"clipsText\") {\n renderClipsText(setting)\n } else if ([\"playpause\", \"playstop\", \"fullscreen\"].includes(setting)) {\n renderButton(setting);\n }\n });\n }; %>\n <% if (settings.left && settings.left.length) { %>\n <div class=\"media-control-left-panel\" data-media-control>\n <% render(settings.left); %>\n </div>\n <% } %>\n <% if (settings.default && settings.default.length) { %>\n <div class=\"media-control-center-panel\" data-media-control>\n <% render(settings.default); %>\n </div>\n <% } %>\n <% if (settings.right && settings.right.length) { %>\n <div class=\"media-control-right-panel\" data-media-control>\n <% render(settings.right); %>\n </div>\n <% } %>\n</div>\n";
14347
+ const mediaControlHTML = "<div class=\"media-control-background\" data-background></div>\n\n<div class=\"media-control-layer gcore-skin-bg-color\" data-controls>\n <% var renderBar = function(name) { %>\n <div class=\"bar-container\" data-<%= name %>>\n <div class=\"bar-background\" data-<%= name %>>\n <div class=\"bar-fill-1\" data-<%= name %>></div>\n <div class=\"bar-fill-2 gcore-skin-main-color\" data-<%= name %>></div>\n <div class=\"bar-hover\" data-<%= name %>></div>\n </div>\n </div>\n <div class=\"bar-scrubber\" data-<%= name %>>\n <div class=\"bar-scrubber-icon gcore-skin-main-color\" data-<%= name %>></div>\n </div>\n <% }; %>\n <% var renderSegmentedBar = function(name, segments) {\n segments = segments || 10; %>\n <div class=\"bar-container\" data-<%= name %>>\n <div class=\"bar-background\" data-<%= name %>>\n <div class=\"bar-fill-1 gcore-skin-main-color\" data-<%= name %>></div>\n </div>\n <div class=\"bar-scrubber\" data-<%= name %>>\n <div class=\"bar-scrubber-icon gcore-skin-main-color\" data-<%= name %>></div>\n </div>\n </div>\n <% }; %>\n <% var renderDrawer = function(name, renderContent) { %>\n <div class=\"drawer-container\" data-<%= name %>>\n <div class=\"drawer-icon-container\" data-<%= name %>>\n <div class=\"drawer-icon media-control-icon gcore-skin-button-color\" data-<%= name %>></div>\n <span class=\"drawer-text\" data-<%= name %>></span>\n </div>\n <% renderContent(name); %>\n </div>\n <% }; %>\n <% var renderIndicator = function(name) { %>\n <div class=\"media-control-indicator gcore-skin-text-color\" data-<%= name %>></div>\n <% }; %>\n <% var renderQuality = function(name) { %>\n <div class=\"media-control-quality\" data-<%= name %>></div>\n <% }; %>\n <% var renderNerd = function(name) { %>\n <div class=\"media-control-nerd\" data-<%= name %>></div>\n <% }; %>\n <% var renderMultiCamera = function(name) { %>\n <div class=\"media-control-multicamera\" data-<%= name %>></div>\n <% }; %>\n <% var renderVR = function(name) { %>\n <div class=\"media-control-vr\" data-<%= name %>></div>\n <% }; %>\n <% var renderButton = function(name) { %>\n <button type=\"button\" class=\"media-control-button media-control-icon gcore-skin-button-color\" data-<%= name %>\n aria-label=\"<%= name %>\"></button>\n <% }; %>\n\n <% var templates = {\n bar: renderBar,\n segmentedBar: renderSegmentedBar,\n };\n var render = function (settingsList) {\n settingsList.forEach(function (setting) {\n\n if (setting === \"seekbar\") {\n renderBar(setting);\n } else if (setting === \"volume\") {\n renderDrawer(setting, settings.volumeBarTemplate ? templates[settings.volumeBarTemplate] : function (name) {\n return renderSegmentedBar(name);\n });\n } else if (setting === \"duration\" || setting === \"position\" || setting === \"clips\") {\n renderIndicator(setting);\n } else if (setting === \"quality\") {\n renderQuality(setting)\n } else if (setting === \"nerd\") {\n renderNerd(setting)\n } else if (setting === \"multicamera\") {\n renderMultiCamera(setting)\n } else if (setting === \"vr\") {\n renderVR(setting)\n } else if ([\"playpause\", \"playstop\", \"fullscreen\"].includes(setting)) {\n renderButton(setting);\n }\n });\n }; %>\n <% if (settings.left && settings.left.length) { %>\n <div class=\"media-control-left-panel\" data-media-control>\n <% render(settings.left); %>\n </div>\n <% } %>\n <% if (settings.default && settings.default.length) { %>\n <div class=\"media-control-center-panel\" data-media-control>\n <% render(settings.default); %>\n </div>\n <% } %>\n <% if (settings.right && settings.right.length) { %>\n <div class=\"media-control-right-panel\" data-media-control>\n <% render(settings.right); %>\n </div>\n <% } %>\n</div>\n";
14341
14348
 
14342
14349
  const volumeMaxIcon = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M14.187 7.71405C13.759 8.06405 13.697 8.69307 14.046 9.12107C14.662 9.87207 15 10.8941 15 11.9961C15 13.0991 14.662 14.1201 14.046 14.8711C13.697 15.2991 13.759 15.9291 14.187 16.2781C14.373 16.4311 14.597 16.5051 14.82 16.5051C15.109 16.5051 15.396 16.3801 15.594 16.1391C16.501 15.0301 17 13.5601 17 11.9961C17 10.4331 16.501 8.96207 15.594 7.85407C15.245 7.42707 14.614 7.36405 14.187 7.71405ZM19.772 5.14408C19.443 4.70008 18.816 4.60907 18.374 4.94007C17.931 5.27007 17.839 5.89605 18.169 6.33905C19.367 7.94705 20 9.90307 20 11.9961C20 14.0891 19.367 16.0451 18.169 17.6531C17.839 18.0971 17.931 18.7231 18.374 19.0531C18.553 19.1871 18.762 19.2511 18.97 19.2511C19.275 19.2511 19.576 19.1121 19.772 18.8491C21.23 16.8921 22 14.5231 22 11.9961C22 9.47007 21.23 7.10108 19.772 5.14408ZM12 3.85108V20.1421C12 20.4881 11.793 20.7971 11.473 20.9291C11.368 20.9721 11.258 20.9921 11.149 20.9921C10.926 20.9921 10.708 20.9031 10.544 20.7371L6.317 16.4431C6.038 16.1591 5.648 15.9961 5.249 15.9961H3.5C2.673 15.9961 2 15.3231 2 14.4961V9.49607C2 8.66907 2.673 7.99607 3.5 7.99607H5.249C5.648 7.99607 6.038 7.83308 6.317 7.54908L10.544 3.25507C10.787 3.00807 11.151 2.93206 11.473 3.06406C11.793 3.19506 12 3.50408 12 3.85108Z\"\n fill=\"#C9C9C9\"/>\n</svg>\n";
14343
14350
 
@@ -14427,8 +14434,6 @@ class MediaControl extends UICorePlugin {
14427
14434
  userDisabled = false;
14428
14435
  userKeepVisible = false;
14429
14436
  verticalVolume = false;
14430
- $clipText = null;
14431
- $clipTextContainer = null;
14432
14437
  $duration = null;
14433
14438
  $fullscreenToggle = null;
14434
14439
  $multiCameraSelector = null;
@@ -14457,7 +14462,7 @@ class MediaControl extends UICorePlugin {
14457
14462
  * @internal
14458
14463
  */
14459
14464
  get supportedVersion() {
14460
- return { min: CLAPPR_VERSION };
14465
+ return { min: CLAPPR_VERSION$1 };
14461
14466
  }
14462
14467
  get disabled() {
14463
14468
  const playbackIsNOOP = this.core.activeContainer &&
@@ -14619,7 +14624,7 @@ class MediaControl extends UICorePlugin {
14619
14624
  this.userDisabled = true; // TODO distinguish between user and system (e.g., unplayable) disabled?
14620
14625
  this.hide();
14621
14626
  this.unbindKeyEvents();
14622
- this.$el.hide();
14627
+ this.$el.hide(); // TODO why?
14623
14628
  }
14624
14629
  /**
14625
14630
  * Reenables the plugin disabled earlier with the {@link MediaControl.disable} method
@@ -15075,16 +15080,16 @@ class MediaControl extends UICorePlugin {
15075
15080
  default: [],
15076
15081
  right: [],
15077
15082
  }, this.core.activeContainer.settings);
15083
+ newSettings.left.push('clips'); // TODO
15078
15084
  // TODO make order controlled via CSS
15079
- newSettings.left = orderByOrderPattern([...newSettings.left, 'clipsText', 'volume'], LEFT_ORDER);
15085
+ newSettings.left = orderByOrderPattern([...newSettings.left, 'volume', 'clips'], LEFT_ORDER);
15080
15086
  if (this.core.activePlayback.getPlaybackType() === Playback.LIVE &&
15081
15087
  this.core.activePlayback.dvrEnabled) {
15082
15088
  newSettings.left.push('dvr');
15083
15089
  }
15084
15090
  // actual order of the items appear rendered is controlled by CSS
15085
15091
  newSettings.right = DEFAULT_SETTINGS.right; // TODO get from the options
15086
- if ((!this.fullScreenOnVideoTagSupported &&
15087
- !fullscreenEnabled()) ||
15092
+ if ((!this.fullScreenOnVideoTagSupported && !fullscreenEnabled()) ||
15088
15093
  this.options.fullscreenDisable) {
15089
15094
  trace(`${T$a} updateSettings removing fullscreen`, {
15090
15095
  supported: this.fullScreenOnVideoTagSupported,
@@ -15130,8 +15135,6 @@ class MediaControl extends UICorePlugin {
15130
15135
  this.$volumeBarFill = this.$el.find('.bar-fill-1[data-volume]');
15131
15136
  this.$volumeBarScrubber = this.$el.find('.bar-scrubber[data-volume]');
15132
15137
  this.$multiCameraSelector = this.$el.find('.media-control-multicamera[data-multicamera]');
15133
- this.$clipText = this.$el.find('.media-clip-text[data-clipstext]'); // TODO
15134
- this.$clipTextContainer = this.$el.find('.media-clip-container[data-clipstext]');
15135
15138
  this.resetIndicators();
15136
15139
  this.initializeIcons();
15137
15140
  }
@@ -15146,25 +15149,14 @@ class MediaControl extends UICorePlugin {
15146
15149
  * ```ts
15147
15150
  * class MyPlugin extends UICorePlugin {
15148
15151
  * override render() {
15149
- * const mediaControl = this.core.getPlugin('media_control')
15150
- * const clipText = mediaControl.getElement('clipText')
15151
- * clipText?.el.text('Here we go')
15152
+ * this.$el.html('<div data-clips>Here we go</div>')
15153
+ * this.core.getPlugin('media_control').mount('clips', this.$el)
15152
15154
  * return this
15153
15155
  * }
15154
15156
  * }
15155
15157
  * ```
15156
15158
  */
15157
- getElement(name) {
15158
- switch (name) {
15159
- case 'audiotracks':
15160
- return null;
15161
- case 'clipText':
15162
- return this.$clipText;
15163
- case 'seekBarContainer':
15164
- return this.$seekBarContainer;
15165
- }
15166
- }
15167
- putElement(name, element) {
15159
+ mount(name, element) {
15168
15160
  const panel = this.getElementLocation(name);
15169
15161
  if (panel) {
15170
15162
  const current = panel.find(`[data-${name}]`);
@@ -15182,6 +15174,9 @@ class MediaControl extends UICorePlugin {
15182
15174
  return;
15183
15175
  }
15184
15176
  }
15177
+ putElement(name, element) {
15178
+ this.mount(name, element);
15179
+ }
15185
15180
  /**
15186
15181
  * Toggle the visibility of a media control element
15187
15182
  * @param name - The name of the media control element
@@ -15231,11 +15226,11 @@ class MediaControl extends UICorePlugin {
15231
15226
  if (!this.settings.seekEnabled) {
15232
15227
  return;
15233
15228
  }
15234
- const currentTime = this.container.getCurrentTime();
15235
- const duration = this.container.getDuration();
15229
+ const currentTime = this.core.activeContainer.getCurrentTime();
15230
+ const duration = this.core.activeContainer.getDuration();
15236
15231
  let position = Math.min(Math.max(currentTime + delta, 0), duration);
15237
15232
  position = Math.min((position * 100) / duration, 100);
15238
- this.container.seekPercentage(position);
15233
+ this.core.activeContainer.seekPercentage(position);
15239
15234
  }
15240
15235
  bindKeyAndShow(key, callback) {
15241
15236
  // TODO or boolean return type
@@ -15353,7 +15348,10 @@ class MediaControl extends UICorePlugin {
15353
15348
  * @internal
15354
15349
  */
15355
15350
  render() {
15356
- trace(`${T$a} render`, { needsUpdate: this.hasUpdate, metadataLoaded: this.metadataLoaded });
15351
+ trace(`${T$a} render`, {
15352
+ needsUpdate: this.hasUpdate,
15353
+ metadataLoaded: this.metadataLoaded,
15354
+ });
15357
15355
  if (!this.hasUpdate || !this.metadataLoaded) {
15358
15356
  return this;
15359
15357
  }
@@ -15508,8 +15506,7 @@ MediaControl.extend = function (properties) {
15508
15506
  return extend(MediaControl, properties);
15509
15507
  };
15510
15508
  function serializeSettings(s) {
15511
- return s.left
15512
- .slice()
15509
+ return s.left.slice()
15513
15510
  .sort()
15514
15511
  .concat(s.right.slice().sort())
15515
15512
  .concat(s.default.slice().sort())
@@ -15541,7 +15538,7 @@ class MultiCamera extends UICorePlugin {
15541
15538
  return 'multicamera';
15542
15539
  }
15543
15540
  get supportedVersion() {
15544
- return { min: CLAPPR_VERSION };
15541
+ return { min: CLAPPR_VERSION$1 };
15545
15542
  }
15546
15543
  static get version() {
15547
15544
  return VERSION$4;
@@ -15894,7 +15891,7 @@ class PictureInPicture extends UICorePlugin {
15894
15891
  * @internal
15895
15892
  */
15896
15893
  get supportedVersion() {
15897
- return { min: CLAPPR_VERSION };
15894
+ return { min: CLAPPR_VERSION$1 };
15898
15895
  }
15899
15896
  /**
15900
15897
  * @internal
@@ -16045,7 +16042,7 @@ class PlaybackRate extends UICorePlugin {
16045
16042
  * @internal
16046
16043
  */
16047
16044
  get supportedVersion() {
16048
- return { min: CLAPPR_VERSION };
16045
+ return { min: CLAPPR_VERSION$1 };
16049
16046
  }
16050
16047
  static buttonTemplate = tmpl(buttonHtml$1);
16051
16048
  static listTemplate = tmpl(listHtml$1);
@@ -16323,7 +16320,7 @@ class Poster extends UIContainerPlugin {
16323
16320
  * @internal
16324
16321
  */
16325
16322
  get supportedVersion() {
16326
- return { min: CLAPPR_VERSION };
16323
+ return { min: CLAPPR_VERSION$1 };
16327
16324
  }
16328
16325
  static template = tmpl(posterHTML);
16329
16326
  get shouldRender() {
@@ -16545,7 +16542,7 @@ class Poster extends UIContainerPlugin {
16545
16542
 
16546
16543
  const buttonHtml = "<button class='gplayer-lite-btn gcore-skin-text-color gear-option' aria-haspopup=\"menu\">\n <span class=\"gear-option_icon<%= isHd ? '' : ' hidden' %>\"><%= hdIcon %></span>\n <span class=\"gear-option_label\"><%= i18n.t('quality') %></span>\n <span class='gear-option_value'><%= currentText %></span>\n <span class=\"gear-option_arrow-right-icon\"><%= arrowRightIcon %></span>\n</button>\n";
16547
16544
 
16548
- 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";
16545
+ 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=\"#\"\n class=\"gear-sub-menu_btn gcore-skin-text-color\"\n data-id=\"-1\"\n id=\"level_selector_auto\"\n aria-checked=\"<%= current === -1 %>\"\n role=\"menuitemradio\"\n >\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 aria-disabled=\"<%= disabled %>\"\n aria-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";
16549
16546
 
16550
16547
  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";
16551
16548
 
@@ -16595,7 +16592,7 @@ class QualityLevels extends UICorePlugin {
16595
16592
  * @internal
16596
16593
  */
16597
16594
  get supportedVersion() {
16598
- return { min: CLAPPR_VERSION };
16595
+ return { min: CLAPPR_VERSION$1 };
16599
16596
  }
16600
16597
  /**
16601
16598
  * @internal
@@ -16827,7 +16824,7 @@ class SeekTime extends UICorePlugin {
16827
16824
  return 'seek_time';
16828
16825
  }
16829
16826
  get supportedVersion() {
16830
- return { min: CLAPPR_VERSION };
16827
+ return { min: CLAPPR_VERSION$1 };
16831
16828
  }
16832
16829
  get template() {
16833
16830
  return tmpl(seekTimeHTML);
@@ -16989,7 +16986,7 @@ class Share extends UICorePlugin {
16989
16986
  return 'share';
16990
16987
  }
16991
16988
  get supportedVersion() {
16992
- return { min: CLAPPR_VERSION };
16989
+ return { min: CLAPPR_VERSION$1 };
16993
16990
  }
16994
16991
  get template() {
16995
16992
  return tmpl(pluginHtml$2);
@@ -17108,7 +17105,7 @@ class SkipTime extends UICorePlugin {
17108
17105
  return 'skip_time';
17109
17106
  }
17110
17107
  get supportedVersion() {
17111
- return { min: CLAPPR_VERSION };
17108
+ return { min: CLAPPR_VERSION$1 };
17112
17109
  }
17113
17110
  get container() {
17114
17111
  return this.core && this.core.activeContainer;
@@ -17247,7 +17244,7 @@ class SpinnerThreeBounce extends UIContainerPlugin {
17247
17244
  * @internal
17248
17245
  */
17249
17246
  get supportedVersion() {
17250
- return { min: CLAPPR_VERSION };
17247
+ return { min: CLAPPR_VERSION$1 };
17251
17248
  }
17252
17249
  /**
17253
17250
  * @internal
@@ -17478,7 +17475,7 @@ class SourceController extends CorePlugin {
17478
17475
  * @internal
17479
17476
  */
17480
17477
  get supportedVersion() {
17481
- return { min: CLAPPR_VERSION };
17478
+ return { min: CLAPPR_VERSION$1 };
17482
17479
  }
17483
17480
  /**
17484
17481
  * @param core - The Clappr core instance.
@@ -17654,7 +17651,7 @@ class ClosedCaptions extends UICorePlugin {
17654
17651
  * @internal
17655
17652
  */
17656
17653
  get supportedVersion() {
17657
- return { min: CLAPPR_VERSION };
17654
+ return { min: CLAPPR_VERSION$1 };
17658
17655
  }
17659
17656
  /**
17660
17657
  * @internal
@@ -17990,7 +17987,7 @@ class Telemetry extends ContainerPlugin {
17990
17987
  * The supported version of the plugin.
17991
17988
  */
17992
17989
  get supportedVersion() {
17993
- return { min: CLAPPR_VERSION };
17990
+ return { min: CLAPPR_VERSION$1 };
17994
17991
  }
17995
17992
  started = false;
17996
17993
  timeStart = 0;
@@ -18276,7 +18273,7 @@ class Thumbnails extends UICorePlugin {
18276
18273
  * @internal
18277
18274
  */
18278
18275
  get supportedVersion() {
18279
- return { min: CLAPPR_VERSION };
18276
+ return { min: CLAPPR_VERSION$1 };
18280
18277
  }
18281
18278
  /**
18282
18279
  * @internal
@@ -18771,4 +18768,4 @@ class VolumeFade extends UICorePlugin {
18771
18768
  }
18772
18769
  }
18773
18770
 
18774
- 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 };
18771
+ export { AudioTracks as AudioSelector, AudioTracks, BigMuteButton, BottomGear, ClapprNerdStats, ClapprStats, ClickToPause, Clips, 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 };