@mattebox/player 0.6.0 → 0.8.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 (290) hide show
  1. package/dist/cdn/mattebox-player.min.js +3 -435
  2. package/dist/controls/airplay.js +28 -44
  3. package/dist/controls/airplay.js.map +1 -1
  4. package/dist/controls/chapters.d.ts +22 -11
  5. package/dist/controls/chapters.d.ts.map +1 -1
  6. package/dist/controls/chapters.js +87 -73
  7. package/dist/controls/chapters.js.map +1 -1
  8. package/dist/controls/cues.d.ts +0 -22
  9. package/dist/controls/cues.d.ts.map +1 -1
  10. package/dist/controls/cues.js +161 -191
  11. package/dist/controls/cues.js.map +1 -1
  12. package/dist/controls/fullscreen.js +52 -70
  13. package/dist/controls/fullscreen.js.map +1 -1
  14. package/dist/controls/icons.d.ts +4 -2
  15. package/dist/controls/icons.d.ts.map +1 -1
  16. package/dist/controls/icons.js +46 -70
  17. package/dist/controls/icons.js.map +1 -1
  18. package/dist/controls/markers.d.ts +39 -0
  19. package/dist/controls/markers.d.ts.map +1 -0
  20. package/dist/controls/markers.js +38 -0
  21. package/dist/controls/markers.js.map +1 -0
  22. package/dist/controls/menu.d.ts +8 -4
  23. package/dist/controls/menu.d.ts.map +1 -1
  24. package/dist/controls/menu.js +261 -223
  25. package/dist/controls/menu.js.map +1 -1
  26. package/dist/controls/native-tracks.d.ts +28 -0
  27. package/dist/controls/native-tracks.d.ts.map +1 -0
  28. package/dist/controls/native-tracks.js +30 -0
  29. package/dist/controls/native-tracks.js.map +1 -0
  30. package/dist/controls/pip.js +35 -49
  31. package/dist/controls/pip.js.map +1 -1
  32. package/dist/controls/quality-names.d.ts +15 -0
  33. package/dist/controls/quality-names.d.ts.map +1 -0
  34. package/dist/controls/quality-names.js +62 -0
  35. package/dist/controls/quality-names.js.map +1 -0
  36. package/dist/controls/ranges.js +42 -37
  37. package/dist/controls/ranges.js.map +1 -1
  38. package/dist/controls/session.d.ts +6 -1
  39. package/dist/controls/session.d.ts.map +1 -1
  40. package/dist/controls/session.js +41 -26
  41. package/dist/controls/session.js.map +1 -1
  42. package/dist/controls/slider.d.ts +2 -2
  43. package/dist/controls/slider.d.ts.map +1 -1
  44. package/dist/controls/slider.js +151 -159
  45. package/dist/controls/slider.js.map +1 -1
  46. package/dist/controls/time.js +17 -17
  47. package/dist/controls/time.js.map +1 -1
  48. package/dist/controls/track-names.d.ts +40 -0
  49. package/dist/controls/track-names.d.ts.map +1 -0
  50. package/dist/controls/track-names.js +59 -0
  51. package/dist/controls/track-names.js.map +1 -0
  52. package/dist/dom.d.ts +6 -0
  53. package/dist/dom.d.ts.map +1 -1
  54. package/dist/dom.js +28 -19
  55. package/dist/dom.js.map +1 -1
  56. package/dist/element-entry.js +9 -6
  57. package/dist/element-entry.js.map +1 -1
  58. package/dist/element.d.ts +28 -2
  59. package/dist/element.d.ts.map +1 -1
  60. package/dist/element.js +426 -442
  61. package/dist/element.js.map +1 -1
  62. package/dist/elements/airplay-button.js +51 -53
  63. package/dist/elements/airplay-button.js.map +1 -1
  64. package/dist/elements/audio-menu.d.ts +19 -8
  65. package/dist/elements/audio-menu.d.ts.map +1 -1
  66. package/dist/elements/audio-menu.js +103 -65
  67. package/dist/elements/audio-menu.js.map +1 -1
  68. package/dist/elements/chapters-menu.d.ts.map +1 -1
  69. package/dist/elements/chapters-menu.js +75 -65
  70. package/dist/elements/chapters-menu.js.map +1 -1
  71. package/dist/elements/component.d.ts +1 -1
  72. package/dist/elements/component.d.ts.map +1 -1
  73. package/dist/elements/component.js +86 -89
  74. package/dist/elements/component.js.map +1 -1
  75. package/dist/elements/control-bar.d.ts +18 -5
  76. package/dist/elements/control-bar.d.ts.map +1 -1
  77. package/dist/elements/control-bar.js +282 -319
  78. package/dist/elements/control-bar.js.map +1 -1
  79. package/dist/elements/current-time.js +26 -25
  80. package/dist/elements/current-time.js.map +1 -1
  81. package/dist/elements/drm-badge.d.ts +3 -2
  82. package/dist/elements/drm-badge.d.ts.map +1 -1
  83. package/dist/elements/drm-badge.js +109 -141
  84. package/dist/elements/drm-badge.js.map +1 -1
  85. package/dist/elements/duration.d.ts.map +1 -1
  86. package/dist/elements/duration.js +24 -21
  87. package/dist/elements/duration.js.map +1 -1
  88. package/dist/elements/error-screen.d.ts.map +1 -1
  89. package/dist/elements/error-screen.js +68 -102
  90. package/dist/elements/error-screen.js.map +1 -1
  91. package/dist/elements/fullscreen-button.js +48 -54
  92. package/dist/elements/fullscreen-button.js.map +1 -1
  93. package/dist/elements/live-button.d.ts.map +1 -1
  94. package/dist/elements/live-button.js +67 -94
  95. package/dist/elements/live-button.js.map +1 -1
  96. package/dist/elements/marker-button.d.ts +22 -0
  97. package/dist/elements/marker-button.d.ts.map +1 -0
  98. package/dist/elements/marker-button.js +99 -0
  99. package/dist/elements/marker-button.js.map +1 -0
  100. package/dist/elements/menu-element.js +31 -28
  101. package/dist/elements/menu-element.js.map +1 -1
  102. package/dist/elements/mute-button.js +58 -59
  103. package/dist/elements/mute-button.js.map +1 -1
  104. package/dist/elements/pip-button.js +54 -54
  105. package/dist/elements/pip-button.js.map +1 -1
  106. package/dist/elements/play-button.d.ts.map +1 -1
  107. package/dist/elements/play-button.js +73 -58
  108. package/dist/elements/play-button.js.map +1 -1
  109. package/dist/elements/quality-menu.d.ts +4 -0
  110. package/dist/elements/quality-menu.d.ts.map +1 -1
  111. package/dist/elements/quality-menu.js +82 -71
  112. package/dist/elements/quality-menu.js.map +1 -1
  113. package/dist/elements/remaining-time.d.ts.map +1 -1
  114. package/dist/elements/remaining-time.js +27 -24
  115. package/dist/elements/remaining-time.js.map +1 -1
  116. package/dist/elements/scan-button.d.ts +17 -0
  117. package/dist/elements/scan-button.d.ts.map +1 -0
  118. package/dist/elements/scan-button.js +117 -0
  119. package/dist/elements/scan-button.js.map +1 -0
  120. package/dist/elements/seek-bar.d.ts +99 -15
  121. package/dist/elements/seek-bar.d.ts.map +1 -1
  122. package/dist/elements/seek-bar.js +487 -336
  123. package/dist/elements/seek-bar.js.map +1 -1
  124. package/dist/elements/shared.d.ts +3 -11
  125. package/dist/elements/shared.d.ts.map +1 -1
  126. package/dist/elements/shared.js +44 -144
  127. package/dist/elements/shared.js.map +1 -1
  128. package/dist/elements/skip-button.d.ts.map +1 -1
  129. package/dist/elements/skip-button.js +54 -55
  130. package/dist/elements/skip-button.js.map +1 -1
  131. package/dist/elements/spacer.d.ts.map +1 -1
  132. package/dist/elements/spacer.js +12 -7
  133. package/dist/elements/spacer.js.map +1 -1
  134. package/dist/elements/speed-menu.js +60 -55
  135. package/dist/elements/speed-menu.js.map +1 -1
  136. package/dist/elements/spinner.d.ts.map +1 -1
  137. package/dist/elements/spinner.js +52 -78
  138. package/dist/elements/spinner.js.map +1 -1
  139. package/dist/elements/start-button.d.ts.map +1 -1
  140. package/dist/elements/start-button.js +107 -120
  141. package/dist/elements/start-button.js.map +1 -1
  142. package/dist/elements/subtitles-menu.d.ts +2 -0
  143. package/dist/elements/subtitles-menu.d.ts.map +1 -1
  144. package/dist/elements/subtitles-menu.js +119 -103
  145. package/dist/elements/subtitles-menu.js.map +1 -1
  146. package/dist/elements/time-element.d.ts.map +1 -1
  147. package/dist/elements/time-element.js +36 -28
  148. package/dist/elements/time-element.js.map +1 -1
  149. package/dist/elements/title.d.ts.map +1 -1
  150. package/dist/elements/title.js +105 -137
  151. package/dist/elements/title.js.map +1 -1
  152. package/dist/elements/volume-slider.d.ts.map +1 -1
  153. package/dist/elements/volume-slider.js +47 -45
  154. package/dist/elements/volume-slider.js.map +1 -1
  155. package/dist/elements/volume.d.ts.map +1 -1
  156. package/dist/elements/volume.js +42 -50
  157. package/dist/elements/volume.js.map +1 -1
  158. package/dist/entries/airplay-button.js +7 -7
  159. package/dist/entries/airplay-button.js.map +1 -1
  160. package/dist/entries/audio-menu.js +7 -6
  161. package/dist/entries/audio-menu.js.map +1 -1
  162. package/dist/entries/chapters-menu.js +7 -7
  163. package/dist/entries/chapters-menu.js.map +1 -1
  164. package/dist/entries/control-bar.js +7 -6
  165. package/dist/entries/control-bar.js.map +1 -1
  166. package/dist/entries/current-time.js +7 -6
  167. package/dist/entries/current-time.js.map +1 -1
  168. package/dist/entries/drm-badge.js +7 -6
  169. package/dist/entries/drm-badge.js.map +1 -1
  170. package/dist/entries/duration.js +7 -6
  171. package/dist/entries/duration.js.map +1 -1
  172. package/dist/entries/error-screen.js +7 -6
  173. package/dist/entries/error-screen.js.map +1 -1
  174. package/dist/entries/fullscreen-button.js +7 -6
  175. package/dist/entries/fullscreen-button.js.map +1 -1
  176. package/dist/entries/live-button.js +7 -6
  177. package/dist/entries/live-button.js.map +1 -1
  178. package/dist/entries/marker-button.d.ts +5 -0
  179. package/dist/entries/marker-button.d.ts.map +1 -0
  180. package/dist/entries/marker-button.js +9 -0
  181. package/dist/entries/marker-button.js.map +1 -0
  182. package/dist/entries/mute-button.js +7 -6
  183. package/dist/entries/mute-button.js.map +1 -1
  184. package/dist/entries/pip-button.js +7 -6
  185. package/dist/entries/pip-button.js.map +1 -1
  186. package/dist/entries/play-button.js +7 -6
  187. package/dist/entries/play-button.js.map +1 -1
  188. package/dist/entries/quality-menu.js +7 -6
  189. package/dist/entries/quality-menu.js.map +1 -1
  190. package/dist/entries/remaining-time.js +7 -7
  191. package/dist/entries/remaining-time.js.map +1 -1
  192. package/dist/entries/scan-button.d.ts +5 -0
  193. package/dist/entries/scan-button.d.ts.map +1 -0
  194. package/dist/entries/scan-button.js +9 -0
  195. package/dist/entries/scan-button.js.map +1 -0
  196. package/dist/entries/seek-bar.js +7 -6
  197. package/dist/entries/seek-bar.js.map +1 -1
  198. package/dist/entries/skip-button.js +7 -6
  199. package/dist/entries/skip-button.js.map +1 -1
  200. package/dist/entries/spacer.js +7 -6
  201. package/dist/entries/spacer.js.map +1 -1
  202. package/dist/entries/speed-menu.js +7 -6
  203. package/dist/entries/speed-menu.js.map +1 -1
  204. package/dist/entries/spinner.js +7 -7
  205. package/dist/entries/spinner.js.map +1 -1
  206. package/dist/entries/start-button.js +7 -6
  207. package/dist/entries/start-button.js.map +1 -1
  208. package/dist/entries/subtitles-menu.js +7 -6
  209. package/dist/entries/subtitles-menu.js.map +1 -1
  210. package/dist/entries/title.js +7 -7
  211. package/dist/entries/title.js.map +1 -1
  212. package/dist/entries/volume-slider.js +7 -6
  213. package/dist/entries/volume-slider.js.map +1 -1
  214. package/dist/entries/volume.js +9 -8
  215. package/dist/entries/volume.js.map +1 -1
  216. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/asyncToGenerator.js +1 -1
  217. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/defineProperty.js +1 -1
  218. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/objectSpread2.js +1 -1
  219. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/toPrimitive.js +1 -1
  220. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/toPropertyKey.js +1 -1
  221. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/typeof.js +1 -1
  222. package/dist/es2015/controls/chapters.js +40 -7
  223. package/dist/es2015/controls/cues.js +1 -8
  224. package/dist/es2015/controls/icons.js +27 -25
  225. package/dist/es2015/controls/markers.js +36 -0
  226. package/dist/es2015/controls/menu.js +49 -10
  227. package/dist/es2015/controls/native-tracks.js +29 -0
  228. package/dist/es2015/controls/quality-names.js +67 -0
  229. package/dist/es2015/controls/session.js +16 -4
  230. package/dist/es2015/controls/slider.js +5 -4
  231. package/dist/es2015/controls/track-names.js +57 -0
  232. package/dist/es2015/dom.js +10 -1
  233. package/dist/es2015/element.js +71 -13
  234. package/dist/es2015/elements/audio-menu.js +62 -19
  235. package/dist/es2015/elements/chapters-menu.js +18 -10
  236. package/dist/es2015/elements/control-bar.js +41 -35
  237. package/dist/es2015/elements/drm-badge.js +12 -33
  238. package/dist/es2015/elements/duration.js +2 -1
  239. package/dist/es2015/elements/error-screen.js +1 -30
  240. package/dist/es2015/elements/live-button.js +1 -29
  241. package/dist/es2015/elements/marker-button.js +100 -0
  242. package/dist/es2015/elements/menu-element.js +2 -2
  243. package/dist/es2015/elements/play-button.js +10 -3
  244. package/dist/es2015/elements/quality-menu.js +22 -7
  245. package/dist/es2015/elements/remaining-time.js +2 -1
  246. package/dist/es2015/elements/scan-button.js +118 -0
  247. package/dist/es2015/elements/seek-bar.js +295 -90
  248. package/dist/es2015/elements/shared.js +5 -106
  249. package/dist/es2015/elements/skip-button.js +2 -1
  250. package/dist/es2015/elements/spacer.js +2 -1
  251. package/dist/es2015/elements/spinner.js +1 -32
  252. package/dist/es2015/elements/start-button.js +8 -26
  253. package/dist/es2015/elements/subtitles-menu.js +39 -11
  254. package/dist/es2015/elements/time-element.js +1 -4
  255. package/dist/es2015/elements/title.js +1 -45
  256. package/dist/es2015/elements/volume-slider.js +2 -1
  257. package/dist/es2015/elements/volume.js +1 -11
  258. package/dist/es2015/entries/marker-button.js +7 -0
  259. package/dist/es2015/entries/scan-button.js +7 -0
  260. package/dist/es2015/index.js +5 -1
  261. package/dist/es2015/presets.js +1 -1
  262. package/dist/es2015/style.js +1 -101
  263. package/dist/es2015/tags.js +3 -1
  264. package/dist/host.d.ts +3 -0
  265. package/dist/host.d.ts.map +1 -1
  266. package/dist/host.js +19 -17
  267. package/dist/host.js.map +1 -1
  268. package/dist/index.d.ts +7 -0
  269. package/dist/index.d.ts.map +1 -1
  270. package/dist/index.js +57 -27
  271. package/dist/labels.js +13 -9
  272. package/dist/labels.js.map +1 -1
  273. package/dist/namespaces.d.ts +9 -26
  274. package/dist/namespaces.d.ts.map +1 -1
  275. package/dist/namespaces.js +6 -2
  276. package/dist/namespaces.js.map +1 -1
  277. package/dist/presets.js +33 -28
  278. package/dist/presets.js.map +1 -1
  279. package/dist/style.d.ts +1 -20
  280. package/dist/style.d.ts.map +1 -1
  281. package/dist/style.js +4 -100
  282. package/dist/style.js.map +1 -1
  283. package/dist/surface.js +25 -21
  284. package/dist/surface.js.map +1 -1
  285. package/dist/tags.d.ts +2 -0
  286. package/dist/tags.d.ts.map +1 -1
  287. package/dist/tags.js +32 -26
  288. package/dist/tags.js.map +1 -1
  289. package/package.json +4 -4
  290. package/dist/index.js.map +0 -1
@@ -64,7 +64,7 @@ function slider(options) {
64
64
  try {
65
65
  root.setPointerCapture(event.pointerId);
66
66
  } catch (_unused) {}
67
- onInput(at(event.clientX));
67
+ onInput(at(event.clientX), false);
68
68
  }
69
69
  function move(event) {
70
70
  if (!held) return;
@@ -72,17 +72,18 @@ function slider(options) {
72
72
  up(event);
73
73
  return;
74
74
  }
75
- onInput(at(event.clientX));
75
+ onInput(at(event.clientX), false);
76
76
  }
77
77
  function up(event) {
78
78
  if (!held) return;
79
79
  hold(false);
80
- onInput(at(event.clientX));
80
+ onInput(at(event.clientX), false);
81
81
  }
82
82
  function cancel() {
83
83
  if (held) hold(false);
84
84
  }
85
85
  function key(event) {
86
+ if (event.defaultPrevented) return;
86
87
  let next;
87
88
  switch (event.key) {
88
89
  case "ArrowRight":
@@ -108,7 +109,7 @@ function slider(options) {
108
109
  default: return;
109
110
  }
110
111
  event.preventDefault();
111
- onInput(clamp(next, min, max));
112
+ onInput(clamp(next, min, max), true);
112
113
  }
113
114
  root.addEventListener("pointerdown", down);
114
115
  root.addEventListener("pointermove", move);
@@ -0,0 +1,57 @@
1
+ //#region src/controls/track-names.ts
2
+ /**
3
+ * The language's name in `locale`, with a capital first letter as the
4
+ * browsers' own menus show it: French gives "anglais", the menu shows
5
+ * "Anglais". Undefined without `Intl.DisplayNames` (Chromium 81, so not on
6
+ * Tizen 6 or webOS 6), for a code it does not know, and for a locale or a
7
+ * code it rejects.
8
+ */
9
+ function languageName(lang, locale) {
10
+ try {
11
+ const name = new Intl.DisplayNames(locale, {
12
+ type: "language",
13
+ fallback: "none"
14
+ }).of(lang);
15
+ return name.charAt(0).toUpperCase() + name.slice(1);
16
+ } catch (_unused) {
17
+ return;
18
+ }
19
+ }
20
+ const LAYOUTS = {
21
+ 1: "Mono",
22
+ 2: "Stereo",
23
+ 6: "5.1",
24
+ 8: "7.1"
25
+ };
26
+ /**
27
+ * The audio layout of an HLS CHANNELS value (RFC 8216bis §4.4.6.1): "2"
28
+ * reads Stereo, "6" reads 5.1, a "/JOC" suffix reads Dolby Atmos. Any
29
+ * other count reads as written.
30
+ */
31
+ function layout(channels) {
32
+ return channels && (/\/JOC$/.test(channels) ? "Dolby Atmos" : LAYOUTS[channels] || channels);
33
+ }
34
+ /**
35
+ * The entries as menu items. Each reads as its name, else its language's
36
+ * name, else its language code, else `word` ("Track") and its place. An
37
+ * entry that would read like another, badges included, takes in
38
+ * parentheses its first hint that differs from the other's, and at last
39
+ * its place.
40
+ */
41
+ function trackNames(entries, word, locale = document.documentElement.lang || navigator.language) {
42
+ let texts = entries.map(([, name, lang], index) => name || lang && (languageName(lang, locale) || lang) || `${word || "Track"} ${index + 1}`);
43
+ for (let round = 0; round < 3; round++) {
44
+ const keys = texts.map((text, index) => text + entries[index][3]);
45
+ const hint = (index) => round < 2 ? entries[index][4][round] : String(index + 1);
46
+ texts = texts.map((text, index) => hint(index) && keys.some((key, other) => other !== index && key === keys[index] && hint(other) !== hint(index)) ? `${text} (${hint(index)})` : text);
47
+ }
48
+ return entries.map(([value, , , badges], index) => [
49
+ value,
50
+ texts[index],
51
+ void 0,
52
+ void 0,
53
+ badges
54
+ ]);
55
+ }
56
+ //#endregion
57
+ export { languageName, layout, trackNames };
@@ -6,6 +6,15 @@
6
6
  * cannot descend: an element without a name of its own is unreachable from
7
7
  * the page's stylesheet. Names are public API.
8
8
  */
9
+ /**
10
+ * Replaces the children of `node`: the ones it has go, then `children` come.
11
+ * `replaceChildren` does this in one call, from Chromium 86 (AGENTS.md,
12
+ * rule 9).
13
+ */
14
+ function setChildren(node, ...children) {
15
+ while (node.firstChild !== null) node.firstChild.remove();
16
+ node.append(...children);
17
+ }
9
18
  /** An element with its part names, and its text when it has any. */
10
19
  function el(tag, part, text) {
11
20
  const node = document.createElement(tag);
@@ -20,4 +29,4 @@ function state(node, base, on) {
20
29
  node.setAttribute("part", names.join(" "));
21
30
  }
22
31
  //#endregion
23
- export { el, state };
32
+ export { el, setChildren, state };
@@ -1,12 +1,19 @@
1
+ import { createMarkers } from "./controls/markers.js";
1
2
  import { namespaces } from "./namespaces.js";
2
- import _asyncToGenerator from "./_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/asyncToGenerator.js";
3
+ import _asyncToGenerator from "./_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/asyncToGenerator.js";
3
4
  import { drmGuard, resolvePreset } from "./presets.js";
4
5
  import { STYLE } from "./style.js";
5
6
  import { errorSurface } from "./surface.js";
6
7
  import { PLAYER } from "./tags.js";
7
- import _objectSpread2 from "./_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/objectSpread2.js";
8
- import { createPlayer, inferType, matteboxHandler, nativeHandler } from "@mattebox/player-core";
8
+ import _objectSpread2 from "./_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
9
+ import { createPlayer, inferType, matteboxHandler, nativeHandler, preferNativeHls } from "@mattebox/player-core";
9
10
  //#region src/element.ts
11
+ /**
12
+ * `off` keeps HLS on the engine in Safari. Anything else lets Safari play
13
+ * HLS itself: FairPlay, AirPlay, Low-Latency HLS and the platform's
14
+ * fullscreen then work as Apple built them. Changing it reloads.
15
+ */
16
+ const NATIVE_HLS = "native-hls";
10
17
  /** Attributes forwarded onto the video as attributes, never as properties. */
11
18
  const FORWARDED = [
12
19
  "autoplay",
@@ -20,14 +27,17 @@ const OWN = [
20
27
  "type",
21
28
  "preset",
22
29
  "license-url",
23
- "thumbnails"
30
+ "certificate-url",
31
+ "thumbnails",
32
+ NATIVE_HLS
24
33
  ];
25
34
  /**
26
- * The chapters track URL. A `<track kind="chapters">` on the video, hidden
27
- * so its cues load and nothing is drawn: chapters are the browser's own
28
- * text track, which the seek bar and the chapters menu read, and which a
29
- * page can also put there itself. Changing it swaps the track and never
30
- * reloads the source.
35
+ * The chapters file URL. A session with the engine's `chapters` namespace
36
+ * loads it there: through the engine's transport, so request hooks apply,
37
+ * and in every format the engine reads. Any other session gets a
38
+ * `<track kind="chapters">` on the video, hidden so its cues load and
39
+ * nothing is drawn. The seek bar and the chapters menu read either.
40
+ * Changing it never reloads the source.
31
41
  */
32
42
  const CHAPTERS = "chapters";
33
43
  /**
@@ -50,6 +60,7 @@ const STATE_EVENTS = [
50
60
  "play",
51
61
  "pause",
52
62
  "ended",
63
+ "seeked",
53
64
  "emptied",
54
65
  "volumechange",
55
66
  "loadedmetadata",
@@ -59,6 +70,8 @@ const STATE_EVENTS = [
59
70
  "stalled",
60
71
  "canplay"
61
72
  ];
73
+ /** The stages that register a key system, which a native session's DRM offers. */
74
+ const KEY_SYSTEMS = ["eme-fairplay", "eme-cenc"];
62
75
  /** Every stage the engine ships. A narrower preset is optimization. */
63
76
  const DEFAULT_PRESET = "full";
64
77
  /**
@@ -98,6 +111,7 @@ var MatteboxPlayerElement = class MatteboxPlayerElement extends HTMLElement {
98
111
  this.options = options !== null && options !== void 0 ? options : defaults;
99
112
  this.focusable = false;
100
113
  this.track = null;
114
+ this.given = null;
101
115
  this.core = null;
102
116
  this.current = null;
103
117
  this.failure = null;
@@ -117,6 +131,7 @@ var MatteboxPlayerElement = class MatteboxPlayerElement extends HTMLElement {
117
131
  this.media.addEventListener("playing", () => {
118
132
  this.failure = null;
119
133
  });
134
+ this.marks = createMarkers(this.media, (name, detail) => this.emit(name, detail));
120
135
  this.stage = document.createElement("div");
121
136
  this.stage.setAttribute("part", "stage");
122
137
  this.stage.append(document.createElement("slot"));
@@ -132,6 +147,10 @@ var MatteboxPlayerElement = class MatteboxPlayerElement extends HTMLElement {
132
147
  get video() {
133
148
  return this.media;
134
149
  }
150
+ /** The ranges the page named in this source: credits to skip, parts that must not play. */
151
+ get markers() {
152
+ return this.marks;
153
+ }
135
154
  /** The core, or null until the first source has been set up: resolving a preset is asynchronous. */
136
155
  get player() {
137
156
  return this.core;
@@ -218,6 +237,7 @@ var MatteboxPlayerElement = class MatteboxPlayerElement extends HTMLElement {
218
237
  }
219
238
  if (name === "preset") this.enqueue(() => this.discard());
220
239
  if (name === "src" || name === "type") this.toggleAttribute("audio", this.audio());
240
+ if (name === "src" && this.marks.list.length > 0) this.marks.set([]);
221
241
  this.reload();
222
242
  }
223
243
  /**
@@ -238,13 +258,26 @@ var MatteboxPlayerElement = class MatteboxPlayerElement extends HTMLElement {
238
258
  this.focusable = true;
239
259
  }
240
260
  }
241
- /** Keeps a hidden chapters track on the video for the `chapters` attribute, or none. */
261
+ /** Hands the `chapters` attribute to the engine, or keeps a hidden chapters track on the video for it. */
242
262
  chapters() {
263
+ var _this$current$engine2, _this$current2;
243
264
  const url = this.getAttribute(CHAPTERS);
244
- if (url === null) {
265
+ const engine = (_this$current$engine2 = (_this$current2 = this.current) === null || _this$current2 === void 0 ? void 0 : _this$current2.engine) !== null && _this$current$engine2 !== void 0 ? _this$current$engine2 : null;
266
+ const api = engine === null ? void 0 : namespaces(engine).chapters;
267
+ if (api !== void 0) {
245
268
  var _this$track;
246
269
  (_this$track = this.track) === null || _this$track === void 0 || _this$track.remove();
247
270
  this.track = null;
271
+ if (url === this.given) return;
272
+ this.given = url;
273
+ if (url === null) api.set([]);
274
+ else api.load(url).catch(() => void 0);
275
+ return;
276
+ }
277
+ if (url === null) {
278
+ var _this$track2;
279
+ (_this$track2 = this.track) === null || _this$track2 === void 0 || _this$track2.remove();
280
+ this.track = null;
248
281
  return;
249
282
  }
250
283
  const held = this.track;
@@ -319,6 +352,7 @@ var MatteboxPlayerElement = class MatteboxPlayerElement extends HTMLElement {
319
352
  return;
320
353
  }
321
354
  _this.current = session;
355
+ _this.given = null;
322
356
  _this.configure(session);
323
357
  _this.chapters();
324
358
  })();
@@ -344,7 +378,14 @@ var MatteboxPlayerElement = class MatteboxPlayerElement extends HTMLElement {
344
378
  var _this$getAttribute2;
345
379
  if (_this3.options.handlers !== void 0) return _this3.options.handlers;
346
380
  const config = _this3.options.config === void 0 ? {} : { config: _this3.options.config };
347
- if (_this3.options.stages !== void 0) return [matteboxHandler(_objectSpread2({ stages: _this3.options.stages }, config)), nativeHandler()];
381
+ const native = (stages) => nativeHandler({
382
+ prefer: (source, env) => _this3.getAttribute(NATIVE_HLS) !== "off" && preferNativeHls(source, env),
383
+ drm: () => _this3.drm(stages)
384
+ });
385
+ if (_this3.options.stages !== void 0) return [matteboxHandler(_objectSpread2({ stages: _this3.options.stages }, config)), native(() => {
386
+ var _this$options$stages;
387
+ return (_this$options$stages = _this3.options.stages) !== null && _this$options$stages !== void 0 ? _this$options$stages : [];
388
+ })];
348
389
  const name = (_this$getAttribute2 = _this3.getAttribute("preset")) !== null && _this$getAttribute2 !== void 0 ? _this$getAttribute2 : DEFAULT_PRESET;
349
390
  const preset = yield resolvePreset(name);
350
391
  if (preset === null) {
@@ -358,16 +399,33 @@ var MatteboxPlayerElement = class MatteboxPlayerElement extends HTMLElement {
358
399
  });
359
400
  return [nativeHandler()];
360
401
  }
361
- return [matteboxHandler(_objectSpread2(_objectSpread2({ preset }, config), drmGuard())), nativeHandler()];
402
+ return [matteboxHandler(_objectSpread2(_objectSpread2({ preset }, config), drmGuard())), native(() => preset.stages())];
362
403
  })();
363
404
  }
405
+ /**
406
+ * The DRM a native session attaches: the page's `drm` option, the
407
+ * key-system stages of the engine's stack, and the `license-url`
408
+ * attribute. None on a browser without EME, as for the engine.
409
+ */
410
+ drm(stages) {
411
+ if (drmGuard().without !== void 0) return void 0;
412
+ const keySystems = stages().filter((stage) => KEY_SYSTEMS.includes(stage.name));
413
+ const license = this.getAttribute("license-url");
414
+ const certificate = this.getAttribute("certificate-url");
415
+ const page = this.options.drm;
416
+ if (keySystems.length === 0 && license === null && page === void 0) return void 0;
417
+ return _objectSpread2(_objectSpread2(_objectSpread2({ keySystems }, page), license === null ? {} : { licenseUrl: license }), certificate === null ? {} : { certificateUrl: certificate });
418
+ }
364
419
  /** What the attributes ask of the session's namespaces, once there is one. */
365
420
  configure(session) {
421
+ var _optional$drm;
366
422
  const engine = session.engine;
367
423
  if (engine === null) return;
368
424
  const optional = namespaces(engine);
369
425
  const license = this.getAttribute("license-url");
370
426
  if (license !== null && optional.drm !== void 0) optional.drm.setLicenseUrl(license);
427
+ const certificate = this.getAttribute("certificate-url");
428
+ if (certificate !== null) (_optional$drm = optional.drm) === null || _optional$drm === void 0 || _optional$drm.setCertificateUrl(certificate);
371
429
  const track = this.getAttribute("thumbnails");
372
430
  if (track !== null && optional.thumbnails !== void 0) optional.thumbnails.load(track).catch(() => void 0);
373
431
  }
@@ -1,19 +1,33 @@
1
1
  import { show } from "./shared.js";
2
+ import { nativeTracks, onNativeTracks } from "../controls/native-tracks.js";
3
+ import { layout, trackNames } from "../controls/track-names.js";
2
4
  import { MenuElement, single } from "./menu-element.js";
5
+ import { isAudioDescription, isOriginal } from "mattebox";
3
6
  //#region src/elements/audio-menu.ts
4
- /** The language, then the role, then the id: whichever the manifest gave. */
5
- function trackLabel(track) {
6
- const parts = [track.lang, track.role].filter((part) => part !== void 0);
7
- return parts.length === 0 ? track.id : parts.join(" · ");
7
+ /** A track's channel layout, from its first rendition: `audioObjects` `JOC` is Dolby Atmos. */
8
+ function channels(track) {
9
+ const first = track.renditions[0];
10
+ return (first === null || first === void 0 ? void 0 : first.channels) === void 0 ? void 0 : layout(`${first.channels}${first.audioObjects ? `/${first.audioObjects}` : ""}`);
8
11
  }
9
- /** The tracks of one content type as menu items, with the active one's id. */
10
- function trackItems(engine, contentType) {
11
- var _tracks$active$id, _tracks$active;
12
+ /**
13
+ * The tracks of one content type that the engine can play and `listed`
14
+ * keeps, as entries with their badges, and the active one's id when it
15
+ * is listed. A track the browser cannot decode, or that no stage plays,
16
+ * stays out (guide chapter 06).
17
+ */
18
+ function trackItems(engine, contentType, badges = () => [], listed = () => true) {
19
+ var _tracks$active;
12
20
  const tracks = engine.tracks;
13
- const available = tracks.available.filter((track) => track.contentType === contentType);
14
- const items = [];
15
- for (const track of available) items.push([track.id, trackLabel(track)]);
16
- return [items, (_tracks$active$id = (_tracks$active = tracks.active(contentType)) === null || _tracks$active === void 0 ? void 0 : _tracks$active.id) !== null && _tracks$active$id !== void 0 ? _tracks$active$id : null];
21
+ const available = tracks.available.filter((track) => track.contentType === contentType && tracks.selectable(track.id) && listed(track));
22
+ const entries = available.map((track) => [
23
+ track.id,
24
+ track.name,
25
+ track.lang,
26
+ badges(track),
27
+ [channels(track), track.role === "main" ? void 0 : track.role]
28
+ ]);
29
+ const active = (_tracks$active = tracks.active(contentType)) === null || _tracks$active === void 0 ? void 0 : _tracks$active.id;
30
+ return [entries, available.some((track) => track.id === active) ? active : null];
17
31
  }
18
32
  /** Subscribes `tick` to the track events, and answers the unsubscribe. */
19
33
  function onTracks(engine, tick) {
@@ -24,7 +38,13 @@ function onTracks(engine, tick) {
24
38
  }
25
39
  var MbxAudioMenu = class extends MenuElement {
26
40
  static get observedAttributes() {
27
- return ["label", "label-back"];
41
+ return [
42
+ "label",
43
+ "label-back",
44
+ "label-ad",
45
+ "label-original",
46
+ "label-track"
47
+ ];
28
48
  }
29
49
  constructor() {
30
50
  super(...single("music"));
@@ -38,26 +58,49 @@ var MbxAudioMenu = class extends MenuElement {
38
58
  this.follow(player, (engine) => {
39
59
  this.engine = engine;
40
60
  this.render();
41
- if (engine === null) return void 0;
42
- return onTracks(engine, () => {
61
+ const tick = () => {
43
62
  this.render();
44
- });
63
+ };
64
+ return engine === null ? onNativeTracks(player.video, "audioTracks", tick) : onTracks(engine, tick);
45
65
  });
46
66
  }
67
+ /** The native session's audio tracks as entries, and the enabled one's. */
68
+ native(tracks) {
69
+ var _this$getAttribute;
70
+ const ad = (_this$getAttribute = this.getAttribute("label-ad")) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : "AD";
71
+ const entries = tracks.map((track, index) => [
72
+ String(index),
73
+ track.label,
74
+ track.language,
75
+ track.kind === "description" || track.kind === "main-desc" ? [ad] : [],
76
+ []
77
+ ]);
78
+ const on = tracks.findIndex((track) => track.enabled);
79
+ return [entries, on === -1 ? null : String(on)];
80
+ }
47
81
  render() {
48
82
  super.render();
49
83
  const engine = this.engine;
50
- if (engine === null) {
84
+ const player = this.player;
85
+ const tracks = engine === null && player !== null ? nativeTracks(player, "audioTracks") : void 0;
86
+ if (engine === null && tracks === void 0) {
51
87
  this.hidden = true;
52
88
  return;
53
89
  }
54
- const [items, active] = trackItems(engine, "audio");
90
+ const [entries, active] = tracks !== void 0 ? this.native(tracks) : trackItems(engine, "audio", (track) => {
91
+ var _this$getAttribute2, _this$getAttribute3;
92
+ return [...isAudioDescription(track) ? [(_this$getAttribute2 = this.getAttribute("label-ad")) !== null && _this$getAttribute2 !== void 0 ? _this$getAttribute2 : "AD"] : [], ...isOriginal(track) ? [(_this$getAttribute3 = this.getAttribute("label-original")) !== null && _this$getAttribute3 !== void 0 ? _this$getAttribute3 : "Original"] : []];
93
+ });
94
+ const items = trackNames(entries, this.getAttribute("label-track"));
55
95
  this.menu.fill([{
56
96
  name: "track",
57
97
  items,
58
98
  value: active !== null && active !== void 0 ? active : "",
59
99
  onSelect: (value) => {
60
- engine.tracks.select(value);
100
+ if (tracks !== void 0) tracks.forEach((track, index) => {
101
+ track.enabled = String(index) === value;
102
+ });
103
+ else engine === null || engine === void 0 || engine.tracks.select(value);
61
104
  this.render();
62
105
  }
63
106
  }]);
@@ -65,4 +108,4 @@ var MbxAudioMenu = class extends MenuElement {
65
108
  }
66
109
  };
67
110
  //#endregion
68
- export { MbxAudioMenu, onTracks, trackItems, trackLabel };
111
+ export { MbxAudioMenu, onTracks, trackItems };
@@ -1,15 +1,17 @@
1
1
  import { show } from "./shared.js";
2
2
  import { MenuElement, single } from "./menu-element.js";
3
- import { chapterAt, chapters, followChapters } from "../controls/chapters.js";
4
3
  import { format } from "../controls/time.js";
4
+ import { chapterAt, chapters, followChapters } from "../controls/chapters.js";
5
5
  //#region src/elements/chapters-menu.ts
6
6
  /**
7
7
  * <mbx-chapters-menu>: the chapters of the video as a list, each with its
8
8
  * start time, the one the playhead is in checked; choosing one seeks to its
9
- * start. The chapters are the video's own chapters text track, from the
10
- * player's `chapters` attribute or a `<track>` the page put there, so the
11
- * menu works for every session, native included, and hides while the
12
- * video has none. The name comes from `label`.
9
+ * start. The chapters are the engine's when the session holds some, and
10
+ * the video's own chapters text track otherwise, see `controls/chapters.ts`,
11
+ * so the menu works for every session, native included, and hides while
12
+ * there are none. Each item shows the chapter's picture when every chapter
13
+ * has one: a list where some rows have a picture and some do not reads as
14
+ * broken. The name comes from `label`.
13
15
  */
14
16
  var MbxChaptersMenu = class extends MenuElement {
15
17
  static get observedAttributes() {
@@ -27,7 +29,7 @@ var MbxChaptersMenu = class extends MenuElement {
27
29
  const tick = () => {
28
30
  this.render();
29
31
  };
30
- this.keep(followChapters(player.video, tick));
32
+ this.keep(followChapters(player, tick));
31
33
  this.listen(player.video, [
32
34
  "timeupdate",
33
35
  "seeked",
@@ -38,19 +40,25 @@ var MbxChaptersMenu = class extends MenuElement {
38
40
  this.render();
39
41
  }
40
42
  render() {
41
- var _this$player;
43
+ var _this$player, _this$player$engine, _this$player2;
42
44
  super.render();
43
45
  const video = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.video;
44
46
  if (video === void 0) return;
45
- const list = chapters(video);
47
+ const list = chapters(video, (_this$player$engine = (_this$player2 = this.player) === null || _this$player2 === void 0 ? void 0 : _this$player2.engine) !== null && _this$player$engine !== void 0 ? _this$player$engine : null);
46
48
  this.hidden = list.length === 0;
47
49
  const current = String(chapterAt(list, video.currentTime));
48
- const items = list.map((chapter, i) => [
50
+ const pictured = list.every((chapter) => chapter.image !== void 0);
51
+ const items = list.map((chapter, i) => pictured && chapter.image !== void 0 ? [
52
+ String(i),
53
+ chapter.title,
54
+ format(chapter.start),
55
+ chapter.image
56
+ ] : [
49
57
  String(i),
50
58
  chapter.title,
51
59
  format(chapter.start)
52
60
  ]);
53
- const key = `${current}|${items.map(([, title, start]) => `${start} ${title}`).join("\n")}`;
61
+ const key = `${current}|${items.map((item) => item.slice(1).join(" ")).join("\n")}`;
54
62
  if (key === this.drawn) return;
55
63
  this.drawn = key;
56
64
  this.menu.fill([{
@@ -1,21 +1,24 @@
1
- import { AIRPLAY_BUTTON, AUDIO_MENU, CHAPTERS_MENU, DRM_BADGE, MUTE_BUTTON, PIP_BUTTON, QUALITY_MENU, SKIP_BUTTON, SPEED_MENU, SUBTITLES_MENU, VOLUME, VOLUME_SLIDER } from "../tags.js";
1
+ import { AIRPLAY_BUTTON, AUDIO_MENU, CHAPTERS_MENU, DRM_BADGE, MUTE_BUTTON, PIP_BUTTON, QUALITY_MENU, SCAN_BUTTON, SKIP_BUTTON, SPEED_MENU, SUBTITLES_MENU, VOLUME, VOLUME_SLIDER } from "../tags.js";
2
2
  import { Component } from "./component.js";
3
3
  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
8
  const IDLE_MS = 3e3;
8
9
  const SEEK_STEP = 5;
9
10
  /**
10
- * What goes first when the row is too narrow, by tag: the slider, which
11
- * takes the most room for the least; then the diagnostics, the lock and
12
- * the menus a viewer rarely opens; then the menus for the picture and the
11
+ * What goes first when the row is too narrow, by tag: the scans, which
12
+ * suit a TV remote more than a small screen; then the slider, which takes
13
+ * the most room for the least; then the diagnostics, the lock and the
14
+ * menus a viewer rarely opens; then the menus for the picture and the
13
15
  * sound; then the skips; then the mute and the subtitles. The subtitles
14
16
  * menu goes last of the menus because it is the one a viewer may need.
15
17
  * The diagnostics is another package's, named here as a string. A
16
18
  * `priority` attribute on the control replaces its default.
17
19
  */
18
20
  const PRIORITY = {
21
+ [SCAN_BUTTON]: 6,
19
22
  [VOLUME_SLIDER]: 5,
20
23
  "mbx-diagnostics": 4,
21
24
  [DRM_BADGE]: 4,
@@ -51,28 +54,6 @@ function priority(child) {
51
54
  }
52
55
  return (_PRIORITY$child$local = PRIORITY[child.localName]) !== null && _PRIORITY$child$local !== void 0 ? _PRIORITY$child$local : 0;
53
56
  }
54
- const STYLE = `
55
- :host {
56
- position: absolute;
57
- inset: auto 0 0 0;
58
- box-sizing: border-box;
59
- display: flex;
60
- flex-direction: column;
61
- gap: 4px;
62
- padding: 40px 16px 12px;
63
- color: var(--mbx-text);
64
- background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
65
- font: 500 16px/1.2 var(--mbx-font);
66
- transition: opacity 0.2s;
67
- }
68
- :host([idle]) { opacity: 0; pointer-events: none; }
69
- [part~="row"] { display: flex; align-items: center; gap: 8px; }
70
- [part~="seek-row"] { gap: 16px; }
71
- ::slotted([collapsed]) { display: none; }
72
- @media (prefers-reduced-motion: reduce) {
73
- :host { transition: none; }
74
- }
75
- `;
76
57
  function end(video) {
77
58
  if (Number.isFinite(video.duration)) return video.duration;
78
59
  const ranges = video.seekable;
@@ -106,23 +87,22 @@ var MbxControlBar = class extends Component {
106
87
  root.append(style(STYLE), this.seekRow, this.buttonsRow);
107
88
  }
108
89
  /**
109
- * What the buttons need: their widths and the gaps between them, the
110
- * spacer aside since it takes what is left, and a folded slider at the
111
- * width it unfolds to. The row's own width says nothing, because the
90
+ * What the buttons need: their widths and their margins, which are the
91
+ * gaps between them, the spacer aside since it takes what is left, and a
92
+ * folded slider at the width it unfolds to. The row's own width says nothing, because the
112
93
  * spacer fills it whatever the buttons take.
113
94
  */
114
95
  needed(children) {
115
- const gap = Number.parseFloat(getComputedStyle(this.buttonsRow).columnGap) || 0;
116
96
  let sum = 0;
117
- let count = 0;
118
97
  for (const child of children) {
119
98
  if (child.localName === "mbx-spacer" || !shown(child)) continue;
99
+ const margins = getComputedStyle(child);
120
100
  sum += child.getBoundingClientRect().width;
121
- count += 1;
101
+ sum += Number.parseFloat(margins.marginLeft) + Number.parseFloat(margins.marginRight);
122
102
  const folded = slider(child);
123
103
  if (folded !== null && shown(folded)) sum += Math.max(0, SLIDER_WIDTH - folded.getBoundingClientRect().width);
124
104
  }
125
- return sum + gap * Math.max(0, count - 1);
105
+ return sum;
126
106
  }
127
107
  /**
128
108
  * Collapses the buttons row to its width. Everything is shown first, so
@@ -191,6 +171,20 @@ var MbxControlBar = class extends Component {
191
171
  this.idle(player, false);
192
172
  this.timer = setTimeout(() => this.sleep(player), number(this, "idle-ms", IDLE_MS));
193
173
  }
174
+ /**
175
+ * A seeking key: `seekkey` on the player first, cancellable, with the
176
+ * seconds in `detail.by`. A seek bar under `key-mode="preview"` takes it
177
+ * to aim instead. Nobody took it: the playhead moves now.
178
+ */
179
+ seekBy(player, by) {
180
+ const asked = new CustomEvent("seekkey", {
181
+ detail: { by },
182
+ cancelable: true
183
+ });
184
+ if (!player.dispatchEvent(asked)) return;
185
+ const video = player.video;
186
+ video.currentTime = Math.min(end(video), Math.max(0, video.currentTime + by));
187
+ }
194
188
  key(player, event) {
195
189
  this.keyboard = true;
196
190
  this.wake(player);
@@ -215,11 +209,23 @@ var MbxControlBar = class extends Component {
215
209
  var _this$screen;
216
210
  (_this$screen = this.screen) === null || _this$screen === void 0 || _this$screen.toggle();
217
211
  break;
212
+ case "MediaPlayPause":
213
+ toggle(video);
214
+ break;
215
+ case "MediaPlay":
216
+ video.play().catch(() => void 0);
217
+ break;
218
+ case "MediaPause":
219
+ case "MediaStop":
220
+ video.pause();
221
+ break;
218
222
  case "ArrowLeft":
219
- video.currentTime = Math.max(0, video.currentTime - number(this, "seek-step", SEEK_STEP));
223
+ case "MediaRewind":
224
+ this.seekBy(player, -number(this, "seek-step", SEEK_STEP));
220
225
  break;
221
226
  case "ArrowRight":
222
- video.currentTime = Math.min(end(video), video.currentTime + number(this, "seek-step", SEEK_STEP));
227
+ case "MediaFastForward":
228
+ this.seekBy(player, number(this, "seek-step", SEEK_STEP));
223
229
  break;
224
230
  default: return;
225
231
  }