@mattebox/player 0.7.0 → 0.9.0

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 (138) hide show
  1. package/dist/cdn/mattebox-player.min.js +3 -3
  2. package/dist/controls/icons.d.ts +5 -28
  3. package/dist/controls/icons.d.ts.map +1 -1
  4. package/dist/controls/icons.js +38 -29
  5. package/dist/controls/icons.js.map +1 -1
  6. package/dist/controls/markers.d.ts +39 -0
  7. package/dist/controls/markers.d.ts.map +1 -0
  8. package/dist/controls/markers.js +38 -0
  9. package/dist/controls/markers.js.map +1 -0
  10. package/dist/controls/menu.d.ts +14 -2
  11. package/dist/controls/menu.d.ts.map +1 -1
  12. package/dist/controls/menu.js +50 -4
  13. package/dist/controls/menu.js.map +1 -1
  14. package/dist/controls/native-tracks.d.ts +28 -0
  15. package/dist/controls/native-tracks.d.ts.map +1 -0
  16. package/dist/controls/native-tracks.js +30 -0
  17. package/dist/controls/native-tracks.js.map +1 -0
  18. package/dist/controls/quality-names.d.ts +15 -0
  19. package/dist/controls/quality-names.d.ts.map +1 -0
  20. package/dist/controls/quality-names.js +62 -0
  21. package/dist/controls/quality-names.js.map +1 -0
  22. package/dist/controls/track-names.d.ts +40 -0
  23. package/dist/controls/track-names.d.ts.map +1 -0
  24. package/dist/controls/track-names.js +59 -0
  25. package/dist/controls/track-names.js.map +1 -0
  26. package/dist/element.d.ts +60 -2
  27. package/dist/element.d.ts.map +1 -1
  28. package/dist/element.js +182 -23
  29. package/dist/element.js.map +1 -1
  30. package/dist/elements/audio-menu.d.ts +19 -8
  31. package/dist/elements/audio-menu.d.ts.map +1 -1
  32. package/dist/elements/audio-menu.js +60 -19
  33. package/dist/elements/audio-menu.js.map +1 -1
  34. package/dist/elements/component.d.ts.map +1 -1
  35. package/dist/elements/component.js +10 -0
  36. package/dist/elements/component.js.map +1 -1
  37. package/dist/elements/control-bar.d.ts +2 -0
  38. package/dist/elements/control-bar.d.ts.map +1 -1
  39. package/dist/elements/control-bar.js +23 -7
  40. package/dist/elements/control-bar.js.map +1 -1
  41. package/dist/elements/current-time.d.ts.map +1 -1
  42. package/dist/elements/current-time.js +1 -1
  43. package/dist/elements/current-time.js.map +1 -1
  44. package/dist/elements/drm-badge.d.ts +3 -2
  45. package/dist/elements/drm-badge.d.ts.map +1 -1
  46. package/dist/elements/drm-badge.js +11 -9
  47. package/dist/elements/drm-badge.js.map +1 -1
  48. package/dist/elements/duration.d.ts.map +1 -1
  49. package/dist/elements/duration.js +6 -2
  50. package/dist/elements/duration.js.map +1 -1
  51. package/dist/elements/error-screen.js +1 -1
  52. package/dist/elements/live-button.js +1 -1
  53. package/dist/elements/marker-button.d.ts +22 -0
  54. package/dist/elements/marker-button.d.ts.map +1 -0
  55. package/dist/elements/marker-button.js +95 -0
  56. package/dist/elements/marker-button.js.map +1 -0
  57. package/dist/elements/quality-menu.d.ts +4 -0
  58. package/dist/elements/quality-menu.d.ts.map +1 -1
  59. package/dist/elements/quality-menu.js +22 -8
  60. package/dist/elements/quality-menu.js.map +1 -1
  61. package/dist/elements/scan-button.js +1 -1
  62. package/dist/elements/seek-bar.d.ts +6 -1
  63. package/dist/elements/seek-bar.d.ts.map +1 -1
  64. package/dist/elements/seek-bar.js +37 -25
  65. package/dist/elements/seek-bar.js.map +1 -1
  66. package/dist/elements/shared.js +3 -3
  67. package/dist/elements/skip-button.js +2 -2
  68. package/dist/elements/skip-button.js.map +1 -1
  69. package/dist/elements/spinner.js +1 -1
  70. package/dist/elements/start-button.d.ts +5 -0
  71. package/dist/elements/start-button.d.ts.map +1 -1
  72. package/dist/elements/start-button.js +15 -2
  73. package/dist/elements/start-button.js.map +1 -1
  74. package/dist/elements/subtitles-menu.d.ts +7 -1
  75. package/dist/elements/subtitles-menu.d.ts.map +1 -1
  76. package/dist/elements/subtitles-menu.js +62 -20
  77. package/dist/elements/subtitles-menu.js.map +1 -1
  78. package/dist/elements/title.d.ts.map +1 -1
  79. package/dist/elements/title.js +3 -1
  80. package/dist/elements/title.js.map +1 -1
  81. package/dist/elements/volume-slider.js +1 -1
  82. package/dist/elements/volume.js +1 -1
  83. package/dist/entries/marker-button.d.ts +5 -0
  84. package/dist/entries/marker-button.d.ts.map +1 -0
  85. package/dist/entries/marker-button.js +9 -0
  86. package/dist/entries/marker-button.js.map +1 -0
  87. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/asyncToGenerator.js +1 -1
  88. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/defineProperty.js +1 -1
  89. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/objectSpread2.js +1 -1
  90. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/toPrimitive.js +1 -1
  91. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/toPropertyKey.js +1 -1
  92. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/typeof.js +1 -1
  93. package/dist/es2015/controls/chapters.js +1 -1
  94. package/dist/es2015/controls/icons.js +38 -29
  95. package/dist/es2015/controls/markers.js +36 -0
  96. package/dist/es2015/controls/menu.js +52 -5
  97. package/dist/es2015/controls/native-tracks.js +29 -0
  98. package/dist/es2015/controls/quality-names.js +67 -0
  99. package/dist/es2015/controls/track-names.js +57 -0
  100. package/dist/es2015/element.js +185 -29
  101. package/dist/es2015/elements/audio-menu.js +66 -20
  102. package/dist/es2015/elements/component.js +10 -0
  103. package/dist/es2015/elements/control-bar.js +23 -7
  104. package/dist/es2015/elements/current-time.js +1 -1
  105. package/dist/es2015/elements/drm-badge.js +12 -9
  106. package/dist/es2015/elements/duration.js +6 -2
  107. package/dist/es2015/elements/error-screen.js +1 -1
  108. package/dist/es2015/elements/live-button.js +1 -1
  109. package/dist/es2015/elements/marker-button.js +96 -0
  110. package/dist/es2015/elements/quality-menu.js +23 -8
  111. package/dist/es2015/elements/scan-button.js +1 -1
  112. package/dist/es2015/elements/seek-bar.js +42 -29
  113. package/dist/es2015/elements/shared.js +3 -3
  114. package/dist/es2015/elements/skip-button.js +2 -2
  115. package/dist/es2015/elements/spinner.js +1 -1
  116. package/dist/es2015/elements/start-button.js +15 -2
  117. package/dist/es2015/elements/subtitles-menu.js +72 -26
  118. package/dist/es2015/elements/title.js +3 -1
  119. package/dist/es2015/elements/volume-slider.js +1 -1
  120. package/dist/es2015/elements/volume.js +1 -1
  121. package/dist/es2015/entries/marker-button.js +7 -0
  122. package/dist/es2015/index.js +3 -1
  123. package/dist/es2015/presets.js +1 -1
  124. package/dist/es2015/style.js +1 -1
  125. package/dist/es2015/tags.js +2 -1
  126. package/dist/host.d.ts +3 -0
  127. package/dist/host.d.ts.map +1 -1
  128. package/dist/host.js.map +1 -1
  129. package/dist/index.d.ts +4 -0
  130. package/dist/index.d.ts.map +1 -1
  131. package/dist/index.js +3 -1
  132. package/dist/style.js +1 -1
  133. package/dist/tags.d.ts +1 -0
  134. package/dist/tags.d.ts.map +1 -1
  135. package/dist/tags.js +2 -1
  136. package/dist/tags.js.map +1 -1
  137. package/package.json +4 -5
  138. package/NOTICE +0 -24
@@ -4,7 +4,7 @@ import { number, style } from "./shared.js";
4
4
  import { cueLift, cueStyle } from "../controls/cues.js";
5
5
  import { fullscreen } from "../controls/fullscreen.js";
6
6
  //#region src/elements/control-bar.ts
7
- const STYLE = ":host{box-sizing:border-box;color:var(--mbx-text);font:500 16px / 1.2 var(--mbx-font);background:linear-gradient(#0000,#0009);flex-direction:column;padding:40px 16px 12px;transition:opacity .2s;display:flex;position:absolute;bottom:0;left:0;right:0}:host([idle]){opacity:0;pointer-events:none}[part~=row]{align-items:center;margin:0 -4px;display:flex}[part~=buttons-row]{margin-top:4px}[part~=seek-row]{margin:0 -8px}slot:not([name])::slotted(*){margin:0 4px}slot[name=seek]::slotted(*){margin:0 8px}::slotted([collapsed]){display:none}@media (prefers-reduced-motion:reduce){:host{transition:none}}";
7
+ const STYLE = ":host{box-sizing:border-box;color:var(--mbx-text);font:500 1em / 1.2 var(--mbx-font);background:linear-gradient(#0000,#0009);flex-direction:column;padding:2.5em 1em .75em;transition:opacity .2s;display:flex;position:absolute;bottom:0;left:0;right:0}:host([menu]){z-index:2;--mbx-tooltip:none}:host([idle]){opacity:0;pointer-events:none}[part~=row]{align-items:center;margin:0 -.25em;display:flex}[part~=buttons-row]{margin-top:.25em}[part~=seek-row]{margin:0 -.5em}slot:not([name])::slotted(*){margin:0 .25em}slot[name=seek]::slotted(*){margin:0 .5em}::slotted([collapsed]){display:none}@media (prefers-reduced-motion:reduce){:host{transition:none}}:host([layout=compact]){padding:1.5em .5em .25em}";
8
8
  const IDLE_MS = 3e3;
9
9
  const SEEK_STEP = 5;
10
10
  /**
@@ -33,10 +33,10 @@ const PRIORITY = {
33
33
  [VOLUME]: 1,
34
34
  [MUTE_BUTTON]: 1
35
35
  };
36
- /** The width the volume group unfolds its slider to, from volume.ts: what a folded slider is counted at. */
37
- const SLIDER_WIDTH = 80;
38
- /** Room kept between the last button and the edge, so nothing sits flush against it. */
39
- const SLACK = 8;
36
+ /** The width the volume group unfolds its slider to, in em, from volume.css: what a folded slider is counted at. */
37
+ const SLIDER_WIDTH = 5;
38
+ /** Room kept between the last button and the edge, in em, so nothing sits flush against it. */
39
+ const SLACK = .5;
40
40
  function shown(node) {
41
41
  return node.getClientRects().length > 0;
42
42
  }
@@ -92,6 +92,10 @@ var MbxControlBar = class extends Component {
92
92
  * folded slider at the width it unfolds to. The row's own width says nothing, because the
93
93
  * spacer fills it whatever the buttons take.
94
94
  */
95
+ /** The bar's em in pixels: its sizes follow the player's font size. */
96
+ em() {
97
+ return Number.parseFloat(getComputedStyle(this).fontSize) || 16;
98
+ }
95
99
  needed(children) {
96
100
  let sum = 0;
97
101
  for (const child of children) {
@@ -100,7 +104,7 @@ var MbxControlBar = class extends Component {
100
104
  sum += child.getBoundingClientRect().width;
101
105
  sum += Number.parseFloat(margins.marginLeft) + Number.parseFloat(margins.marginRight);
102
106
  const folded = slider(child);
103
- if (folded !== null && shown(folded)) sum += Math.max(0, SLIDER_WIDTH - folded.getBoundingClientRect().width);
107
+ if (folded !== null && shown(folded)) sum += Math.max(0, SLIDER_WIDTH * this.em() - folded.getBoundingClientRect().width);
104
108
  }
105
109
  return sum;
106
110
  }
@@ -130,7 +134,7 @@ var MbxControlBar = class extends Component {
130
134
  });
131
135
  }
132
136
  candidates.sort((a, b) => b.priority - a.priority || b.index - a.index);
133
- const room = this.buttonsRow.clientWidth - SLACK;
137
+ const room = this.buttonsRow.clientWidth - SLACK * this.em();
134
138
  for (const { node, priority: level } of candidates) {
135
139
  if (level === 0) return;
136
140
  if (this.needed(children) <= room) return;
@@ -242,6 +246,18 @@ var MbxControlBar = class extends Component {
242
246
  };
243
247
  this.keep(screen.watch(reflect));
244
248
  reflect();
249
+ const menus = new MutationObserver(() => {
250
+ this.toggleAttribute("menu", this.querySelector("[open]") !== null);
251
+ });
252
+ menus.observe(this, {
253
+ subtree: true,
254
+ attributes: true,
255
+ attributeFilter: ["open"]
256
+ });
257
+ this.keep(() => {
258
+ menus.disconnect();
259
+ this.removeAttribute("menu");
260
+ });
245
261
  const pointer = () => {
246
262
  this.keyboard = false;
247
263
  this.wake(player);
@@ -20,7 +20,7 @@ var MbxCurrentTime = class extends TimeElement {
20
20
  const on = live(engine) !== void 0;
21
21
  const time = video.currentTime;
22
22
  this.text.data = on ? (_wall = wall(engine, time)) !== null && _wall !== void 0 ? _wall : `-${format(span(video, engine).end - time)}` : format(time);
23
- this.hidden = on && player.hasAttribute("live") && !player.hasAttribute("seekable");
23
+ this.hidden = on && player.hasAttribute("live") && !player.hasAttribute("seekable") || !on && this.getAttribute("layout") === "compact";
24
24
  }
25
25
  };
26
26
  //#endregion
@@ -5,7 +5,7 @@ import { Component } from "./component.js";
5
5
  import { style } from "./shared.js";
6
6
  import { fill } from "../labels.js";
7
7
  //#region src/elements/drm-badge.ts
8
- const STYLE = ":host{width:40px;height:40px;color:var(--mbx-muted);border-radius:var(--mbx-radius);cursor:default;justify-content:center;align-items:center;display:inline-flex;position:relative}:host([hidden]){display:none}:host(:focus){outline:2px solid var(--mbx-accent);outline-offset:-2px}:host(:focus:not(:focus-visible)){outline:none}[part~=icon],::slotted(*){fill:currentColor;width:1.75em;height:1.75em}[part~=tooltip]{border-radius:var(--mbx-radius);color:var(--mbx-text);text-align:left;white-space:nowrap;pointer-events:none;background:#101114f2;margin-bottom:8px;padding:8px 10px;font-size:13px;line-height:1.4;position:absolute;bottom:100%;right:0;box-shadow:0 4px 16px #00000080}[part~=tooltip][hidden]{display:none}[part~=tooltip-title]{font-weight:600}[part~=tooltip-text]{color:var(--mbx-muted)}";
8
+ const STYLE = ":host{width:2.5em;height:2.5em;color:var(--mbx-muted);border-radius:var(--mbx-radius);cursor:default;justify-content:center;align-items:center;display:inline-flex;position:relative}:host([hidden]){display:none}:host(:focus){outline:2px solid var(--mbx-accent);outline-offset:-2px}:host(:focus:not(:focus-visible)){outline:none}[part~=icon],::slotted(*){fill:currentColor;width:1.75em;height:1.75em}[part~=tooltip]{border-radius:var(--mbx-radius);color:var(--mbx-text);text-align:left;white-space:nowrap;pointer-events:none;background:#1c1c20f2;margin-bottom:.6154em;padding:.6154em .7692em;font-size:.8125em;line-height:1.4;position:absolute;bottom:100%;right:0;box-shadow:0 4px 16px #00000080}[part~=tooltip][hidden]{display:none}[part~=tooltip-title]{font-weight:600}[part~=tooltip-text]{color:var(--mbx-muted)}";
9
9
  /** The name a viewer knows a key system by. */
10
10
  function keySystemName(id) {
11
11
  if (id.startsWith("com.widevine")) return "Widevine";
@@ -24,7 +24,7 @@ var MbxDrmBadge = class extends Component {
24
24
  }
25
25
  constructor() {
26
26
  super();
27
- this.engine = null;
27
+ this.drm = void 0;
28
28
  const root = this.attachShadow({ mode: "open" });
29
29
  const slot = document.createElement("slot");
30
30
  slot.name = "icon";
@@ -74,17 +74,20 @@ var MbxDrmBadge = class extends Component {
74
74
  }
75
75
  attach(player) {
76
76
  this.follow(player, (engine) => {
77
- this.engine = engine;
77
+ var _player$player;
78
+ const eme = (_player$player = player.player) === null || _player$player === void 0 || (_player$player = _player$player.session) === null || _player$player === void 0 ? void 0 : _player$player.eme;
79
+ const source = engine !== null && engine !== void 0 ? engine : eme;
80
+ this.drm = engine === null ? eme === null || eme === void 0 ? void 0 : eme.drm : namespaces(engine).drm;
78
81
  this.render();
79
- if (engine === null || namespaces(engine).drm === void 0) return void 0;
82
+ if (source === void 0 || this.drm === void 0) return void 0;
80
83
  const tick = () => {
81
84
  this.render();
82
85
  };
83
86
  const offs = [
84
- engine.on("drm:keysystem", tick),
85
- engine.on("drm:keystatus", tick),
86
- engine.on("drm:encrypted", tick)
87
- ];
87
+ "drm:keysystem",
88
+ "drm:keystatus",
89
+ "drm:encrypted"
90
+ ].map((event) => source.on(event, tick));
88
91
  return () => {
89
92
  for (const off of offs) off();
90
93
  };
@@ -95,7 +98,7 @@ var MbxDrmBadge = class extends Component {
95
98
  }
96
99
  render() {
97
100
  var _drm$keySystem, _this$getAttribute4;
98
- const drm = this.engine === null ? void 0 : namespaces(this.engine).drm;
101
+ const drm = this.drm;
99
102
  const name = (_drm$keySystem = drm === null || drm === void 0 ? void 0 : drm.keySystem) !== null && _drm$keySystem !== void 0 ? _drm$keySystem : null;
100
103
  this.hidden = name === null;
101
104
  if (drm === void 0 || name === null) return;
@@ -4,7 +4,9 @@ import { TimeElement } from "./time-element.js";
4
4
  //#region src/elements/duration.ts
5
5
  /**
6
6
  * <mbx-duration>: the duration, "4:56", once the metadata is in. A live
7
- * stream has none, so the element hides while the stream is live.
7
+ * stream has none, so the element hides while the stream is live. On a
8
+ * compact player it shows the time left, "-3:12", in place of the current
9
+ * time, which hides there.
8
10
  */
9
11
  const TRAILING = ":host{text-align:right}";
10
12
  var MbxDuration = class extends TimeElement {
@@ -17,7 +19,9 @@ var MbxDuration = class extends TimeElement {
17
19
  const engine = player.engine;
18
20
  const on = live(engine) !== void 0;
19
21
  this.hidden = on;
20
- if (!on) this.text.data = format(span(player.video, engine).end);
22
+ if (on) return;
23
+ const end = span(player.video, engine).end;
24
+ this.text.data = this.getAttribute("layout") === "compact" ? `-${format(Math.max(0, end - player.video.currentTime))}` : format(end);
21
25
  }
22
26
  };
23
27
  //#endregion
@@ -2,7 +2,7 @@ import { el } from "../dom.js";
2
2
  import { Component } from "./component.js";
3
3
  import { style } from "./shared.js";
4
4
  //#region src/elements/error-screen.ts
5
- const STYLE = ":host{color:var(--mbx-text);font:400 15px / 1.4 var(--mbx-font);text-align:center;background:#000000bf;justify-content:center;align-items:center;padding:16px;display:flex;position:absolute;top:0;bottom:0;left:0;right:0}:host([hidden]){display:none}[part~=box]{flex-direction:column;align-items:center;display:flex}[part~=box]>:not([hidden])~:not([hidden]){margin-top:8px}[part~=title]{font-size:18px;font-weight:600}[part~=detail]{color:var(--mbx-error);font-family:monospace;font-size:13px}[part~=retry]{height:36px;font:inherit;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;background:0 0;border:1px solid;padding:0 16px;font-weight:600}[part~=retry]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=retry]:focus:not(:focus-visible){outline:none}";
5
+ const STYLE = ":host{color:var(--mbx-text);font:400 .9375em / 1.4 var(--mbx-font);text-align:center;background:#000000bf;justify-content:center;align-items:center;padding:1.0667em;display:flex;position:absolute;top:0;bottom:0;left:0;right:0}:host([hidden]){display:none}[part~=box]{flex-direction:column;align-items:center;display:flex}[part~=box]>:not([hidden])~:not([hidden]){margin-top:.5333em}[part~=title]{font-size:1.2em;font-weight:600}[part~=detail]{color:var(--mbx-error);font-family:monospace;font-size:.8667em}[part~=retry]{height:2.4em;font:inherit;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;background:0 0;border:1px solid;padding:0 1.0667em;font-weight:600}[part~=retry]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=retry]:focus:not(:focus-visible){outline:none}";
6
6
  var MbxErrorScreen = class extends Component {
7
7
  static get observedAttributes() {
8
8
  return ["label-title", "label-retry"];
@@ -16,7 +16,7 @@ import { live } from "../controls/session.js";
16
16
  * `text`, the name from `label-live` and `label-at-edge`. It sits in the
17
17
  * bar's seek row unless the page says otherwise.
18
18
  */
19
- const STYLE = ":host{display:inline-flex}:host([hidden]){display:none}[part~=button]{height:40px;font:inherit;letter-spacing:.06em;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;opacity:.9;background:0 0;border:0;align-items:center;padding:0 8px;font-size:12px;font-weight:700;display:inline-flex}[part~=button]:hover{opacity:1}[part~=button]:disabled{cursor:default;opacity:1}[part~=button]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=button]:focus:not(:focus-visible){outline:none}[part~=dot]{background:var(--mbx-muted);border-radius:50%;width:10px;height:10px;margin-right:6px;transition:background .2s}:host([at-edge]) [part~=dot]{background:var(--mbx-live);box-shadow:0 0 6px var(--mbx-live)}@media (prefers-reduced-motion:reduce){[part~=dot]{transition:none}}";
19
+ const STYLE = ":host{display:inline-flex}:host([hidden]){display:none}[part~=button]{height:2.5em;font:inherit;letter-spacing:.06em;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;opacity:.9;background:0 0;border:0;align-items:center;padding:0 .5em;font-size:.75em;font-weight:700;display:inline-flex}[part~=button]:hover{opacity:1}[part~=button]:disabled{cursor:default;opacity:1}[part~=button]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=button]:focus:not(:focus-visible){outline:none}[part~=dot]{background:var(--mbx-muted);border-radius:50%;width:.625em;height:.625em;margin-right:.375em;transition:background .2s}:host([at-edge]) [part~=dot]{background:var(--mbx-live);box-shadow:0 0 6px var(--mbx-live)}@media (prefers-reduced-motion:reduce){[part~=dot]{transition:none}}";
20
20
  var MbxLiveButton = class extends Component {
21
21
  static get observedAttributes() {
22
22
  return [
@@ -0,0 +1,96 @@
1
+ import { Component } from "./component.js";
2
+ import { BUTTON_STYLE, style } from "./shared.js";
3
+ //#region src/elements/marker-button.ts
4
+ const STYLE_CSS = ":host{right:calc(var(--mbx-pad,.5em) + .5em);bottom:calc(var(--mbx-marker-lift,3.5em) + .75em);z-index:1;transition:transform .3s;position:absolute}:host([idle]){transform:translateY(var(--mbx-marker-lift,3.5em))}:host([hidden]){display:none}[part~=button]{width:auto;height:2.5em;color:var(--mbx-text);font:inherit;white-space:nowrap;background:#0009;border:1px solid #ffffff80;padding:0 1.125em;font-weight:600}[part~=button]:hover{background:#000c}@media (prefers-reduced-motion:reduce){:host{transition:none}}";
5
+ const WORDS = {
6
+ "opening-credits": "Skip intro",
7
+ "closing-credits": "Skip credits"
8
+ };
9
+ var MbxMarkerButton = class extends Component {
10
+ static get observedAttributes() {
11
+ return [
12
+ "label-opening-credits",
13
+ "label-closing-credits",
14
+ "label-skip"
15
+ ];
16
+ }
17
+ constructor() {
18
+ super();
19
+ this.marker = null;
20
+ this.resizer = null;
21
+ const root = this.attachShadow({ mode: "open" });
22
+ this.button = document.createElement("button");
23
+ this.button.type = "button";
24
+ this.button.setAttribute("part", "button");
25
+ this.button.textContent = "Skip";
26
+ this.button.addEventListener("click", () => {
27
+ var _this$player;
28
+ const video = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.video;
29
+ if (video !== void 0 && this.marker !== null) video.currentTime = this.marker.end;
30
+ });
31
+ root.append(style(BUTTON_STYLE + STYLE_CSS), this.button);
32
+ }
33
+ connectedCallback() {
34
+ this.hidden = true;
35
+ super.connectedCallback();
36
+ }
37
+ attach(player) {
38
+ this.listen(player.video, [
39
+ "timeupdate",
40
+ "seeking",
41
+ "emptied"
42
+ ], () => {
43
+ this.render();
44
+ });
45
+ this.listen(player, ["markerschange"], () => {
46
+ this.render();
47
+ });
48
+ this.observe(player, ["upnext"], () => {
49
+ this.render();
50
+ });
51
+ const idle = () => {
52
+ this.toggleAttribute("idle", player.hasAttribute("idle"));
53
+ };
54
+ this.observe(player, ["idle"], idle);
55
+ idle();
56
+ if (typeof ResizeObserver !== "undefined") {
57
+ this.resizer = new ResizeObserver(() => {
58
+ this.fit(player);
59
+ });
60
+ this.resizer.observe(player);
61
+ const bar = player.querySelector("mbx-control-bar");
62
+ if (bar !== null) this.resizer.observe(bar);
63
+ }
64
+ this.fit(player);
65
+ this.render();
66
+ }
67
+ detach() {
68
+ var _this$resizer;
69
+ (_this$resizer = this.resizer) === null || _this$resizer === void 0 || _this$resizer.disconnect();
70
+ this.resizer = null;
71
+ }
72
+ /**
73
+ * Lifts the button above the bar's rows: the bar's box less the padding
74
+ * over them, its fade. The title sits on the other side, so the button
75
+ * stays where it is while the title shows.
76
+ */
77
+ fit(player) {
78
+ const bar = player.querySelector("mbx-control-bar");
79
+ const fade = bar === null ? 0 : Number.parseFloat(getComputedStyle(bar).paddingTop) || 0;
80
+ const lift = bar === null ? 0 : bar.getBoundingClientRect().height - fade;
81
+ this.style.setProperty("--mbx-marker-lift", `${Math.max(0, lift)}px`);
82
+ }
83
+ render() {
84
+ var _player$markers$withi, _this$marker, _this$getAttribute, _ref, _this$getAttribute2;
85
+ const player = this.player;
86
+ this.marker = (_player$markers$withi = player === null || player === void 0 ? void 0 : player.markers.within(player.video.currentTime).find((marker) => marker.kind !== "blocked")) !== null && _player$markers$withi !== void 0 ? _player$markers$withi : null;
87
+ if (((_this$marker = this.marker) === null || _this$marker === void 0 ? void 0 : _this$marker.kind) === "closing-credits" && (player === null || player === void 0 ? void 0 : player.hasAttribute("upnext")) === true) this.marker = null;
88
+ this.hidden = this.marker === null;
89
+ if (this.marker === null) return;
90
+ const kind = this.marker.kind;
91
+ const skip = (_this$getAttribute = this.getAttribute("label-skip")) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : "Skip";
92
+ this.button.textContent = (_ref = (_this$getAttribute2 = this.getAttribute(`label-${kind}`)) !== null && _this$getAttribute2 !== void 0 ? _this$getAttribute2 : WORDS[kind]) !== null && _ref !== void 0 ? _ref : this.marker.label === void 0 ? skip : `${skip} ${this.marker.label}`;
93
+ }
94
+ };
95
+ //#endregion
96
+ export { MbxMarkerButton };
@@ -1,11 +1,8 @@
1
1
  import { show } from "./shared.js";
2
2
  import { MenuElement, single } from "./menu-element.js";
3
+ import { qualityLabels, qualityNames } from "../controls/quality-names.js";
3
4
  //#region src/elements/quality-menu.ts
4
5
  const AUTO = "auto";
5
- function renditionLabel(rendition) {
6
- if (rendition.height !== void 0) return `${rendition.height}p`;
7
- return `${Math.round(rendition.bitrate / 1e3)} kbps`;
8
- }
9
6
  var MbxQualityMenu = class extends MenuElement {
10
7
  static get observedAttributes() {
11
8
  return [
@@ -15,8 +12,9 @@ var MbxQualityMenu = class extends MenuElement {
15
12
  ];
16
13
  }
17
14
  constructor() {
18
- super(...single("settings"));
15
+ super(...single("quality"));
19
16
  this.engine = null;
17
+ this.playing = void 0;
20
18
  show(this.slots, "default");
21
19
  }
22
20
  name() {
@@ -30,7 +28,12 @@ var MbxQualityMenu = class extends MenuElement {
30
28
  const tick = () => {
31
29
  this.render();
32
30
  };
31
+ const clock = () => {
32
+ if (this.playingName() !== this.playing) this.render();
33
+ };
34
+ player.video.addEventListener("timeupdate", clock);
33
35
  const offs = [
36
+ () => player.video.removeEventListener("timeupdate", clock),
34
37
  engine.on("tracks:changed", tick),
35
38
  engine.on("quality:constraints-unsatisfiable", tick),
36
39
  engine.on("quality:pin-unsatisfiable", tick)
@@ -49,8 +52,12 @@ var MbxQualityMenu = class extends MenuElement {
49
52
  return;
50
53
  }
51
54
  const quality = engine.quality;
52
- const items = [[AUTO, (_this$getAttribute = this.getAttribute("label-auto")) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : "Auto"]];
53
- for (const rendition of quality.renditions) items.push([rendition.id, renditionLabel(rendition)]);
55
+ this.playing = this.playingName();
56
+ const items = [[
57
+ AUTO,
58
+ (_this$getAttribute = this.getAttribute("label-auto")) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : "Auto",
59
+ this.playing
60
+ ], ...qualityNames(quality.selectable)];
54
61
  this.menu.fill([{
55
62
  name: "rendition",
56
63
  items,
@@ -61,7 +68,15 @@ var MbxQualityMenu = class extends MenuElement {
61
68
  this.render();
62
69
  }
63
70
  }]);
64
- this.hidden = quality.renditions.length === 0;
71
+ this.hidden = items.length === 1;
72
+ }
73
+ /** The name of the rendition that plays, under Auto only: a pin names itself by its tick. */
74
+ playingName() {
75
+ var _this$engine, _quality$playing, _qualityLabels$find;
76
+ const quality = (_this$engine = this.engine) === null || _this$engine === void 0 ? void 0 : _this$engine.quality;
77
+ if (quality === void 0 || quality.pinned !== null) return void 0;
78
+ const id = (_quality$playing = quality.playing) === null || _quality$playing === void 0 ? void 0 : _quality$playing.id;
79
+ return (_qualityLabels$find = qualityLabels(quality.selectable).find(([candidate]) => candidate === id)) === null || _qualityLabels$find === void 0 ? void 0 : _qualityLabels$find[1];
65
80
  }
66
81
  };
67
82
  //#endregion
@@ -19,7 +19,7 @@ import { optional } from "../controls/session.js";
19
19
  * `rate` part shows the rate, "8×". The name comes from `label`,
20
20
  * "Fast forward" or "Rewind".
21
21
  */
22
- const STYLE_CSS = "[part~=button]{position:relative}[part~=rate]{font-variant-numeric:tabular-nums;font-size:10px;font-weight:700;line-height:1;position:absolute;bottom:2px;right:0}[part~=rate][hidden]{display:none}";
22
+ const STYLE_CSS = "[part~=button]{position:relative}[part~=rate]{font-variant-numeric:tabular-nums;font-size:.625em;font-weight:700;line-height:1;position:absolute;bottom:.2em;right:0}[part~=rate][hidden]{display:none}";
23
23
  const RATES = [
24
24
  4,
25
25
  8,
@@ -2,13 +2,13 @@ import { el } from "../dom.js";
2
2
  import { Component } from "./component.js";
3
3
  import { SLIDER_STYLE, number, seekRow, style } from "./shared.js";
4
4
  import { fill } from "../labels.js";
5
- import { EMPTY, at, clip, fraction } from "../controls/ranges.js";
5
+ import { EMPTY, at, clip, fraction, spans } from "../controls/ranges.js";
6
6
  import { format } from "../controls/time.js";
7
7
  import { bufferGoal, live, optional, span, wall } from "../controls/session.js";
8
8
  import { chapterAt, chapters, followChapters } from "../controls/chapters.js";
9
9
  import { slider } from "../controls/slider.js";
10
10
  //#region src/elements/seek-bar.ts
11
- const STYLE_CSS = ":host,[part~=slider]{flex:1}[part~=thumb]{width:16px;height:16px;margin:-8px 0 0 -8px;box-shadow:0 1px 3px #0006}[part~=buffered]{position:absolute;top:0;bottom:0;left:0;right:0}[part~=buffered-range]{background:#ffffff4d;position:absolute;top:0;bottom:0}[part~=hover]{background:var(--mbx-text);width:2px;margin-left:-1px;position:absolute;top:0;bottom:0}[part~=edge]{background:var(--mbx-live);width:2px;margin-left:-1px;position:absolute;top:0;bottom:0}[part~=preview]{background:var(--mbx-surface);border-radius:var(--mbx-radius);font-variant-numeric:tabular-nums;white-space:nowrap;pointer-events:none;flex-direction:column;align-items:center;margin-bottom:4px;padding:2px;font-size:13px;display:flex;position:absolute;bottom:100%;transform:translate(-50%)}[part~=preview]>:not([hidden])~:not([hidden]){margin-top:2px}[part~=preview-image]{border-radius:2px;position:relative;overflow:hidden}[part~=preview-frame]{border-radius:2px;display:block}[part~=preview-tile]{transform-origin:0 0;background-repeat:no-repeat;position:absolute;top:0;left:0}[part~=preview-time]{padding:0 4px}[part~=preview-title]{text-overflow:ellipsis;max-width:240px;padding:0 4px;overflow:hidden}[hidden]{display:none}";
11
+ const STYLE_CSS = ":host,[part~=slider]{flex:1}[part~=thumb]{width:1em;height:1em;margin:-.5em 0 0 -.5em;box-shadow:0 1px 3px #0006}[part~=buffered]{position:absolute;top:0;bottom:0;left:0;right:0}[part~=blocked]{pointer-events:none;position:absolute;top:0;bottom:0;left:0;right:0}[part~=blocked-range]{background:var(--mbx-blocked,#000000bf);position:absolute;top:0;bottom:0}[part~=buffered-range]{background:#ffffff4d;position:absolute;top:0;bottom:0}[part~=hover]{background:var(--mbx-text);width:.125em;margin-left:-1px;position:absolute;top:0;bottom:0}[part~=edge]{background:var(--mbx-live);width:.125em;margin-left:-1px;position:absolute;top:0;bottom:0}[part~=preview]{background:var(--mbx-surface);border-radius:var(--mbx-radius);font-variant-numeric:tabular-nums;white-space:nowrap;pointer-events:none;flex-direction:column;align-items:center;margin-bottom:.3077em;padding:.1538em;font-size:.8125em;display:flex;position:absolute;bottom:100%;transform:translate(-50%)}[part~=preview]>:not([hidden])~:not([hidden]){margin-top:.125em}[part~=preview-image]{border-radius:2px;position:relative;overflow:hidden}[part~=preview-frame]{border-radius:2px;display:block}[part~=preview-tile]{transform-origin:0 0;background-repeat:no-repeat;position:absolute;top:0;left:0}[part~=preview-time]{padding:0 .3077em}[part~=preview-title]{text-overflow:ellipsis;max-width:18.4615em;padding:0 .3077em;overflow:hidden}[hidden]{display:none}";
12
12
  const STEP = 5;
13
13
  /** Under `key-mode="preview"`, a target seeks this long after the last key. */
14
14
  const KEY_COMMIT_MS = 1e3;
@@ -26,8 +26,8 @@ const CANCEL_KEYS = [
26
26
  ];
27
27
  const PAGE = 30;
28
28
  const LIVE_WINDOW = 3;
29
- /** What the tile scales down to when the page sets no `--mbx-preview-width`. */
30
- const PREVIEW_WIDTH = 160;
29
+ /** What the tile scales down to, in em, when the page sets no `--mbx-preview-width`. */
30
+ const PREVIEW_WIDTH = 10;
31
31
  /** The buffer goal assumed for a session that reports none. */
32
32
  const BUFFER_GOAL = 30;
33
33
  /** The gap cut at a chapter boundary, in pixels. */
@@ -46,13 +46,14 @@ function percent(part) {
46
46
  return `${part * 100}%`;
47
47
  }
48
48
  /**
49
- * A mask that cuts a gap at each boundary between chapters, as stops along
50
- * the track: opaque up to a boundary, clear for the gap, opaque after.
49
+ * A mask that cuts a gap at each chapter boundary, as stops along the
50
+ * track: opaque up to a boundary, clear for the gap, opaque after.
51
51
  */
52
- function gaps(list, span) {
52
+ function gaps(boundaries, span) {
53
+ if (boundaries.length === 0) return "";
53
54
  const stops = ["#000 0"];
54
- for (const chapter of list.slice(1)) {
55
- const at = percent(fraction(chapter.start, span));
55
+ for (const time of boundaries) {
56
+ const at = percent(fraction(time, span));
56
57
  const before = `calc(${at} - ${GAP / 2}px)`;
57
58
  const after = `calc(${at} + ${GAP / 2}px)`;
58
59
  stops.push(`#000 ${before}`, `transparent ${before}`, `transparent ${after}`, `#000 ${after}`);
@@ -66,6 +67,7 @@ var MbxSeekBar = class extends Component {
66
67
  "label",
67
68
  "label-of",
68
69
  "label-behind",
70
+ "label-blocked",
69
71
  "live-window",
70
72
  "chapters",
71
73
  "scrub",
@@ -104,12 +106,13 @@ var MbxSeekBar = class extends Component {
104
106
  }
105
107
  });
106
108
  this.buffered = el("div", "buffered");
109
+ this.blocked = el("div", "blocked");
107
110
  this.hover = el("div", "hover");
108
111
  this.edge = el("div", "edge");
109
112
  this.hover.hidden = true;
110
113
  this.edge.hidden = true;
111
114
  this.bar.track.prepend(this.buffered);
112
- this.bar.track.append(this.hover, this.edge);
115
+ this.bar.track.append(this.blocked, this.hover, this.edge);
113
116
  this.preview = el("div", "preview");
114
117
  this.image = el("div", "preview-image");
115
118
  this.tile = el("div", "preview-tile");
@@ -152,7 +155,7 @@ var MbxSeekBar = class extends Component {
152
155
  }
153
156
  /** The gaps at the chapter boundaries, on every layer of the track at once. */
154
157
  paintChapters() {
155
- const mask = this.chaptered("divided") && this.list.length > 1 ? gaps(this.list, this.range) : "";
158
+ const mask = gaps(this.chaptered("divided") && this.list.length > 1 ? this.list.slice(1).map((chapter) => chapter.start) : [], this.range);
156
159
  const key = `${mask}|${this.range.start}|${this.range.end}`;
157
160
  if (key === this.divided) return;
158
161
  this.divided = key;
@@ -318,7 +321,8 @@ var MbxSeekBar = class extends Component {
318
321
  /** The width the page asked for through the token, or the default. */
319
322
  previewWidth() {
320
323
  const set = Number.parseFloat(getComputedStyle(this.preview).getPropertyValue("--mbx-preview-width"));
321
- return Number.isFinite(set) && set > 0 ? set : PREVIEW_WIDTH;
324
+ if (Number.isFinite(set) && set > 0) return set;
325
+ return PREVIEW_WIDTH * (Number.parseFloat(getComputedStyle(this).fontSize) || 16);
322
326
  }
323
327
  /** The preview's picture sources from `preview`, in order of preference: frames then tiles by default. */
324
328
  sources() {
@@ -384,17 +388,19 @@ var MbxSeekBar = class extends Component {
384
388
  }, () => void 0);
385
389
  if (this.frameCanvas.hidden) this.paintTile(tile);
386
390
  }
387
- paintBuffered(video) {
388
- var _buffered$lastElement;
389
- const parts = clip(Array.from({ length: video.buffered.length }, (_, i) => ({
390
- start: video.buffered.start(i),
391
- end: video.buffered.end(i)
392
- })), this.range);
393
- const buffered = this.buffered;
394
- while (buffered.childElementCount > parts.length) (_buffered$lastElement = buffered.lastElementChild) === null || _buffered$lastElement === void 0 || _buffered$lastElement.remove();
395
- while (buffered.childElementCount < parts.length) buffered.append(el("div", "buffered-range"));
391
+ /** The ranges the page marked blocked. */
392
+ blockedRanges() {
393
+ var _this$player$markers$, _this$player13;
394
+ return ((_this$player$markers$ = (_this$player13 = this.player) === null || _this$player13 === void 0 ? void 0 : _this$player13.markers.list) !== null && _this$player$markers$ !== void 0 ? _this$player$markers$ : []).filter((marker) => marker.kind === "blocked");
395
+ }
396
+ /** One child of `layer` per range, each named `part`, placed along the track. */
397
+ paintRanges(layer, ranges, part) {
398
+ var _layer$lastElementChi;
399
+ const parts = clip(ranges, this.range);
400
+ while (layer.childElementCount > parts.length) (_layer$lastElementChi = layer.lastElementChild) === null || _layer$lastElementChi === void 0 || _layer$lastElementChi.remove();
401
+ while (layer.childElementCount < parts.length) layer.append(el("div", part));
396
402
  let i = 0;
397
- for (const child of buffered.children) {
403
+ for (const child of layer.children) {
398
404
  const part = parts[i];
399
405
  i += 1;
400
406
  if (part === void 0) break;
@@ -405,10 +411,10 @@ var MbxSeekBar = class extends Component {
405
411
  }
406
412
  /** Whether a live window is wide enough to be worth a bar. */
407
413
  worthSeeking() {
408
- var _bufferGoal, _this$player$engine7, _this$player13;
414
+ var _bufferGoal, _this$player$engine7, _this$player14;
409
415
  const goals = number(this, "live-window", LIVE_WINDOW);
410
416
  if (goals === 0) return true;
411
- const goal = (_bufferGoal = bufferGoal((_this$player$engine7 = (_this$player13 = this.player) === null || _this$player13 === void 0 ? void 0 : _this$player13.engine) !== null && _this$player$engine7 !== void 0 ? _this$player$engine7 : null)) !== null && _bufferGoal !== void 0 ? _bufferGoal : BUFFER_GOAL;
417
+ const goal = (_bufferGoal = bufferGoal((_this$player$engine7 = (_this$player14 = this.player) === null || _this$player14 === void 0 ? void 0 : _this$player14.engine) !== null && _this$player$engine7 !== void 0 ? _this$player$engine7 : null)) !== null && _bufferGoal !== void 0 ? _bufferGoal : BUFFER_GOAL;
412
418
  return this.range.end - this.range.start >= goals * goal;
413
419
  }
414
420
  /** The hover marker and the preview follow the pointer, clamped to the bar. */
@@ -422,16 +428,21 @@ var MbxSeekBar = class extends Component {
422
428
  }
423
429
  /** The preview over `part` of the bar: the time, the chapter, and the picture. */
424
430
  previewAt(part) {
425
- var _chapter$title;
431
+ var _this$player15, _ref, _blocked$label, _chapter$title;
426
432
  const rect = this.bar.rail.getBoundingClientRect();
427
433
  if (rect.width === 0 || this.range.end <= this.range.start) return;
428
434
  this.preview.hidden = false;
429
435
  const when = at(part, this.range);
430
436
  this.time.textContent = this.label(when);
431
437
  const chapter = this.chaptered("titles") ? this.list[chapterAt(this.list, when)] : void 0;
432
- this.caption.hidden = chapter === void 0 || chapter.title === "";
433
- this.caption.textContent = (_chapter$title = chapter === null || chapter === void 0 ? void 0 : chapter.title) !== null && _chapter$title !== void 0 ? _chapter$title : "";
434
- this.paintPicture(when);
438
+ const blocked = (_this$player15 = this.player) === null || _this$player15 === void 0 ? void 0 : _this$player15.markers.within(when).find((marker) => marker.kind === "blocked");
439
+ const title = blocked ? (_ref = (_blocked$label = blocked.label) !== null && _blocked$label !== void 0 ? _blocked$label : this.getAttribute("label-blocked")) !== null && _ref !== void 0 ? _ref : "Not available" : (_chapter$title = chapter === null || chapter === void 0 ? void 0 : chapter.title) !== null && _chapter$title !== void 0 ? _chapter$title : "";
440
+ this.caption.hidden = title === "";
441
+ this.caption.textContent = title;
442
+ if (blocked) {
443
+ this.image.hidden = true;
444
+ this.frameCanvas.hidden = true;
445
+ } else this.paintPicture(when);
435
446
  const whole = this.bar.root.getBoundingClientRect();
436
447
  const half = this.preview.offsetWidth / 2;
437
448
  const x = rect.left - whole.left + part * rect.width;
@@ -448,6 +459,7 @@ var MbxSeekBar = class extends Component {
448
459
  };
449
460
  this.listen(player.video, EVENTS, tick);
450
461
  this.keep(followChapters(player, tick));
462
+ this.listen(player, ["markerschange"], tick);
451
463
  this.listen(player, ["sourcechange"], () => {
452
464
  this.drag = "none";
453
465
  this.stopAiming();
@@ -492,7 +504,8 @@ var MbxSeekBar = class extends Component {
492
504
  this.list = chapters(video, engine);
493
505
  this.bar.label((_this$getAttribute3 = this.getAttribute("label")) !== null && _this$getAttribute3 !== void 0 ? _this$getAttribute3 : "Seek");
494
506
  this.bar.range(this.range.start, this.range.end);
495
- this.paintBuffered(video);
507
+ this.paintRanges(this.buffered, spans(video.buffered), "buffered-range");
508
+ this.paintRanges(this.blocked, this.blockedRanges(), "blocked-range");
496
509
  this.paintChapters();
497
510
  this.edge.hidden = !on;
498
511
  if (api !== void 0 && api.edge !== null) this.edge.style.left = percent(fraction(api.edge, this.range));
@@ -7,8 +7,8 @@
7
7
  *
8
8
  * Nothing carries `!important`: a page's `::part()` rule must win.
9
9
  */
10
- const BUTTON_STYLE_CSS = ":host{display:inline-flex}:host([hidden]){display:none}[part~=button]{width:40px;height:40px;font:inherit;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;opacity:.9;background:0 0;border:0;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}[part~=button]:hover{opacity:1}[part~=button]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=button]:focus:not(:focus-visible){outline:none}[part~=icon],::slotted(*){fill:currentColor;width:1.75em;height:1.75em}slot[hidden]{display:none}";
11
- const SLIDER_STYLE_CSS = ":host{display:block}:host([hidden]){display:none}[part~=slider]{border-radius:var(--mbx-radius);cursor:pointer;touch-action:none;height:40px;position:relative}[part~=slider]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=slider]:focus:not(:focus-visible){outline:none}[part~=rail]{position:absolute;top:0;bottom:0;left:8px;right:8px}[part~=track]{background:#ffffff59;border-radius:2px;height:4px;position:absolute;top:50%;left:0;right:0;overflow:hidden;transform:translateY(-50%)}[part~=fill]{background:var(--mbx-accent);position:absolute;top:0;bottom:0;left:0}[part~=thumb]{background:var(--mbx-text);pointer-events:none;border-radius:50%;width:12px;height:12px;margin:-6px 0 0 -6px;position:absolute;top:50%}";
10
+ const BUTTON_STYLE_CSS = ":host{display:inline-flex}:host([hidden]){display:none}[part~=button]{width:2.5em;height:2.5em;font:inherit;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;opacity:.9;background:0 0;border:0;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex;position:relative}[part~=button][aria-label]:after{content:attr(aria-label);display:var(--mbx-tooltip,block);background:var(--mbx-surface);border-radius:var(--mbx-radius);white-space:nowrap;pointer-events:none;opacity:0;margin-bottom:.4615em;padding:.3077em .6154em;font-size:.8125em;transition:opacity .1s;position:absolute;bottom:100%;left:50%;transform:translate(-50%)}[part~=button][aria-label]:focus:after{opacity:1;transition-delay:.4s}[part~=button][aria-label]:focus:not(:focus-visible):after{opacity:0;transition-delay:0s}@media (hover:hover){[part~=button][aria-label]:hover:after{opacity:1;transition-delay:.4s}}:host(:last-child) [part~=button][aria-label]:after{left:auto;right:0;transform:none}[part~=button]:hover{opacity:1}[part~=button]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=button]:focus:not(:focus-visible){outline:none}[part~=icon],::slotted(*){fill:currentColor;width:1.75em;height:1.75em}slot[hidden]{display:none}";
11
+ const SLIDER_STYLE_CSS = ":host{display:block}:host([hidden]){display:none}[part~=slider]{border-radius:var(--mbx-radius);cursor:pointer;touch-action:none;height:2.5em;position:relative}[part~=slider]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=slider]:focus:not(:focus-visible){outline:none}[part~=rail]{position:absolute;top:0;bottom:0;left:.5em;right:.5em}[part~=track]{background:#ffffff59;border-radius:2px;height:.25em;position:absolute;top:50%;left:0;right:0;overflow:hidden;transform:translateY(-50%)}[part~=fill]{background:var(--mbx-accent);position:absolute;top:0;bottom:0;left:0}[part~=thumb]{background:var(--mbx-text);pointer-events:none;border-radius:50%;width:.75em;height:.75em;margin:-.375em 0 0 -.375em;position:absolute;top:50%}";
12
12
  const BUTTON_STYLE = BUTTON_STYLE_CSS;
13
13
  /** The style of a slider: the rail, the track with its fill, and the thumb. */
14
14
  const SLIDER_STYLE = SLIDER_STYLE_CSS;
@@ -19,7 +19,7 @@ function number(node, name, fallback) {
19
19
  return Number.isFinite(value) && value >= 0 ? value : fallback;
20
20
  }
21
21
  /** The style of a menu: the button from BUTTON_STYLE, and the popup above it with its items. */
22
- const MENU_STYLE = ":host{display:inline-flex}:host([hidden]){display:none}[part~=button]{width:40px;height:40px;font:inherit;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;opacity:.9;background:0 0;border:0;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}[part~=button]:hover{opacity:1}[part~=button]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=button]:focus:not(:focus-visible){outline:none}[part~=icon],::slotted(*){fill:currentColor;width:1.75em;height:1.75em}slot[hidden]{display:none}:host{position:relative}[part~=popup]{overscroll-behavior:contain;border-radius:var(--mbx-radius);background:#101114f2;flex-direction:column;min-width:160px;margin-bottom:8px;padding:6px;font-size:14px;display:flex;position:absolute;bottom:100%;right:0;overflow-y:auto;box-shadow:0 4px 16px #00000080}[part~=popup][hidden]{display:none}[part~=section]{flex-direction:column;display:flex}[part~=section]+[part~=section]{border-top:1px solid #ffffff1f;margin-top:6px;padding-top:6px}[part~=section-label]{letter-spacing:.06em;text-transform:uppercase;color:var(--mbx-muted);padding:4px 12px 2px;font-size:11px;font-weight:600}[part~=item]{width:100%;font:inherit;color:inherit;text-align:left;white-space:nowrap;border-radius:var(--mbx-radius);cursor:pointer;background:0 0;border:0;align-items:center;padding:8px 12px 8px 28px;display:flex}[part~=item]:hover{background:#ffffff1f}[part~=item-text]{text-overflow:ellipsis;min-width:0;overflow:hidden}[part~=item-image]{object-fit:cover;background:#ffffff14;border-radius:2px;flex:none;width:64px;height:36px;margin-right:12px}[part~=item-detail]{color:var(--mbx-muted);font-variant-numeric:tabular-nums;margin-left:auto;padding-left:12px}[part~=item]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=item]:focus:not(:focus-visible){outline:none}[part~=page-item]{padding-right:28px;position:relative}[part~=page-item]:after{content:\"\";opacity:.7;border:1.5px solid;border-width:1.5px 1.5px 0 0;width:7px;height:7px;margin-top:-4px;position:absolute;top:50%;right:12px;transform:rotate(45deg)}[part~=back-item]{border-bottom:1px solid #ffffff1f;border-radius:0;margin-bottom:6px;font-weight:600;position:relative}[part~=back-item]:before{content:\"\";opacity:.7;border:0 solid;border-width:1.5px 0 0 1.5px;width:7px;height:7px;margin-top:-4px;position:absolute;top:50%;left:12px;transform:rotate(-45deg)}[part~=checked]{position:relative}[part~=checked]:before{content:\"\";background:var(--mbx-accent);border-radius:50%;width:6px;height:6px;margin-top:-3px;position:absolute;top:50%;left:12px}";
22
+ const MENU_STYLE = ":host{display:inline-flex}:host([hidden]){display:none}[part~=button]{width:2.5em;height:2.5em;font:inherit;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;opacity:.9;background:0 0;border:0;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex;position:relative}[part~=button][aria-label]:after{content:attr(aria-label);display:var(--mbx-tooltip,block);background:var(--mbx-surface);border-radius:var(--mbx-radius);white-space:nowrap;pointer-events:none;opacity:0;margin-bottom:.4615em;padding:.3077em .6154em;font-size:.8125em;transition:opacity .1s;position:absolute;bottom:100%;left:50%;transform:translate(-50%)}[part~=button][aria-label]:focus:after{opacity:1;transition-delay:.4s}[part~=button][aria-label]:focus:not(:focus-visible):after{opacity:0;transition-delay:0s}@media (hover:hover){[part~=button][aria-label]:hover:after{opacity:1;transition-delay:.4s}}:host(:last-child) [part~=button][aria-label]:after{left:auto;right:0;transform:none}[part~=button]:hover{opacity:1}[part~=button]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=button]:focus:not(:focus-visible){outline:none}[part~=icon],::slotted(*){fill:currentColor;width:1.75em;height:1.75em}slot[hidden]{display:none}:host{position:relative}[part~=popup]{box-sizing:border-box;overscroll-behavior:contain;border-radius:var(--mbx-radius);background:#1c1c20f2;flex-direction:column;min-width:16em;margin-bottom:.5714em;padding:.4286em;font-size:.875em;display:flex;position:absolute;bottom:100%;right:0;overflow-y:auto;box-shadow:0 4px 16px #00000080}[part~=popup][hidden]{display:none}[part~=popup][more]{-webkit-mask-image:linear-gradient(#000 calc(100% - 1.5em),#0000);mask-image:linear-gradient(#000 calc(100% - 1.5em),#0000)}[part~=title],[part~=back-item]{letter-spacing:.06em;text-transform:uppercase;color:var(--mbx-muted);font-size:.8125em;font-weight:600}[part~=title]{border-bottom:1px solid #ffffff1f;margin:-.5275em -.5275em .5275em;padding:.9231em 1.4066em}[part~=section]{flex-direction:column;display:flex}[part~=section]+[part~=section]{border-top:1px solid #ffffff1f;margin-top:.4286em;padding-top:.4286em}[part~=section-label]{letter-spacing:.06em;text-transform:uppercase;color:var(--mbx-muted);padding:.3636em 1.0909em .1818em;font-size:.7857em;font-weight:600}[part~=glyph-item]{padding-left:1em}[part~=glyph-item]>svg{margin-right:.75em}[part~=item]{width:100%;font:inherit;color:inherit;text-align:left;white-space:nowrap;border-radius:var(--mbx-radius);cursor:pointer;background:0 0;border:0;align-items:center;padding:.7857em 1em .7857em 2.2857em;display:flex}[part~=item]:hover{background:#ffffff1f}[part~=item-text]{white-space:normal;-webkit-line-clamp:2;-webkit-box-orient:vertical;min-width:0;max-width:16em;display:-webkit-box;overflow:hidden}[part~=item-image]{object-fit:cover;background:#ffffff14;border-radius:2px;flex:none;width:4.5714em;height:2.5714em;margin-right:.8571em}[part~=item-badge]{border:1px solid;border-radius:2px;flex:none;margin-left:auto;padding:0 .381em;font-size:.75em;font-weight:600;line-height:1.5}[part~=item-glyph]{border:0;padding:0;font-size:1em;display:inline-flex}[part~=item-glyph] svg,[part~=glyph-item]>svg{fill:currentColor;flex:none;width:1.5em;height:1.5em}[part~=badge-text]{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}[part~=item-detail]{color:var(--mbx-muted);font-variant-numeric:tabular-nums;margin-left:auto;padding-left:.8571em}[part~=item-badge]~[part~=item-badge],[part~=item-badge]~[part~=item-detail]{margin-left:.7619em}[part~=item]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=item]:focus:not(:focus-visible){outline:none}[part~=page-item]{padding-right:2em;position:relative}[part~=page-item]:after{content:\"\";opacity:.7;border:1.5px solid;border-width:1.5px 1.5px 0 0;width:.5em;height:.5em;margin-top:-.2857em;position:absolute;top:50%;right:.8571em;transform:rotate(45deg)}[part~=back-item]{border-bottom:1px solid #ffffff1f;border-radius:0;margin-bottom:.5275em;padding:.9231em 1.2308em .9231em 2.4615em;position:relative}[part~=back-item]:before{content:\"\";opacity:.7;border:0 solid;border-width:1.5px 0 0 1.5px;width:.5em;height:.5em;margin-top:-.2857em;position:absolute;top:50%;left:1em;transform:rotate(-45deg)}[part~=checked]{background:#ffffff14;position:relative}[part~=checked]:before{content:\"\";background:var(--mbx-accent);border-radius:50%;width:.4286em;height:.4286em;margin-top:-.2143em;position:absolute;top:50%;left:1em}:host([layout=compact]) [part~=popup]{z-index:1000;max-height:70vh;padding-bottom:calc(.4286em + env(safe-area-inset-bottom,0px));background:#1c1c20;border-radius:.75em .75em 0 0;margin:0;font-size:1em;position:fixed;bottom:0;left:0;right:0;box-shadow:0 0 0 100vmax #00000080}";
23
23
  /** Puts a control in the bar's seek row when it is in a bar, unless the page wrote a `slot` of its own. */
24
24
  function seekRow(node) {
25
25
  var _node$parentElement;
@@ -5,10 +5,10 @@ import { BUTTON_STYLE, style } from "./shared.js";
5
5
  import { fill } from "../labels.js";
6
6
  //#region src/elements/skip-button.ts
7
7
  const SECONDS = 10;
8
- /** The glyph for a skip amount: the set draws 10 and 30, and a plain arrow says the rest. */
8
+ /** The glyph for a skip amount: the set draws 5, 10, 15 and 30, and a plain arrow says the rest. */
9
9
  function glyphFor(back, amount) {
10
10
  const side = back ? "seek-backward" : "seek-forward";
11
- if (amount === 10 || amount === 30) return `${side}-${amount}`;
11
+ if (amount === 5 || amount === 10 || amount === 15 || amount === 30) return `${side}-${amount}`;
12
12
  return side;
13
13
  }
14
14
  var MbxSkipButton = class extends Component {
@@ -1,7 +1,7 @@
1
1
  import { Component } from "./component.js";
2
2
  import { style } from "./shared.js";
3
3
  //#region src/elements/spinner.ts
4
- const STYLE = ":host{pointer-events:none;width:44px;height:44px;color:var(--mbx-text);filter:drop-shadow(0 1px 3px #00000080);margin:-22px 0 0 -22px;display:none;position:absolute;top:50%;left:50%}:host([waiting]){display:block}:host([hidden]){display:none}[part~=ring]{box-sizing:border-box;border:3px solid #ffffff38;border-top-color:currentColor;border-radius:50%;width:100%;height:100%;animation:.8s linear infinite mbx-turn}[part~=ring][hidden],slot[hidden]{display:none}::slotted(*){width:100%;height:100%}@keyframes mbx-turn{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){[part~=ring]{animation:none}}";
4
+ const STYLE = ":host{pointer-events:none;width:2.75em;height:2.75em;color:var(--mbx-text);filter:drop-shadow(0 1px 3px #00000080);margin:-1.375em 0 0 -1.375em;display:none;position:absolute;top:50%;left:50%}:host([waiting]){display:block}:host([hidden]){display:none}[part~=ring]{box-sizing:border-box;border:3px solid #ffffff38;border-top-color:currentColor;border-radius:50%;width:100%;height:100%;animation:.8s linear infinite mbx-turn}[part~=ring][hidden],slot[hidden]{display:none}::slotted(*){width:100%;height:100%}@keyframes mbx-turn{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){[part~=ring]{animation:none}}";
5
5
  /** What the video fires as it waits and as it goes on. */
6
6
  const EVENTS = [
7
7
  "waiting",