@mattebox/player 0.14.0 → 0.16.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.
- package/dist/cdn/mattebox-player.min.js +3 -3
- package/dist/controls/chapters.d.ts +2 -8
- package/dist/controls/chapters.d.ts.map +1 -1
- package/dist/controls/chapters.js +1 -1
- package/dist/controls/chapters.js.map +1 -1
- package/dist/controls/cues.d.ts.map +1 -1
- package/dist/controls/cues.js +2 -2
- package/dist/controls/cues.js.map +1 -1
- package/dist/controls/icons.d.ts +1 -1
- package/dist/controls/icons.d.ts.map +1 -1
- package/dist/controls/icons.js +2 -0
- package/dist/controls/icons.js.map +1 -1
- package/dist/controls/native-tracks.js +1 -1
- package/dist/controls/native-tracks.js.map +1 -1
- package/dist/element-entry.d.ts +1 -0
- package/dist/element-entry.d.ts.map +1 -1
- package/dist/element-entry.js.map +1 -1
- package/dist/element.d.ts +68 -5
- package/dist/element.d.ts.map +1 -1
- package/dist/element.js +242 -42
- package/dist/element.js.map +1 -1
- package/dist/elements/airplay-button.js +1 -1
- package/dist/elements/airplay-button.js.map +1 -1
- package/dist/elements/audio-menu.d.ts.map +1 -1
- package/dist/elements/audio-menu.js +4 -3
- package/dist/elements/audio-menu.js.map +1 -1
- package/dist/elements/casting.d.ts +15 -0
- package/dist/elements/casting.d.ts.map +1 -0
- package/dist/elements/casting.js +55 -0
- package/dist/elements/casting.js.map +1 -0
- package/dist/elements/chapters-menu.js +5 -5
- package/dist/elements/chapters-menu.js.map +1 -1
- package/dist/elements/component.d.ts +13 -0
- package/dist/elements/component.d.ts.map +1 -1
- package/dist/elements/component.js +21 -3
- package/dist/elements/component.js.map +1 -1
- package/dist/elements/control-bar.d.ts +16 -2
- package/dist/elements/control-bar.d.ts.map +1 -1
- package/dist/elements/control-bar.js +29 -7
- package/dist/elements/control-bar.js.map +1 -1
- package/dist/elements/current-time.js +2 -2
- package/dist/elements/current-time.js.map +1 -1
- package/dist/elements/drm-badge.js +2 -2
- package/dist/elements/drm-badge.js.map +1 -1
- package/dist/elements/duration.js +3 -3
- package/dist/elements/duration.js.map +1 -1
- package/dist/elements/error-screen.js +2 -2
- package/dist/elements/error-screen.js.map +1 -1
- package/dist/elements/fullscreen-button.d.ts.map +1 -1
- package/dist/elements/fullscreen-button.js +3 -2
- package/dist/elements/fullscreen-button.js.map +1 -1
- package/dist/elements/live-button.js +3 -3
- package/dist/elements/live-button.js.map +1 -1
- package/dist/elements/marker-button.js +3 -3
- package/dist/elements/marker-button.js.map +1 -1
- package/dist/elements/menu-element.js +3 -3
- package/dist/elements/menu-element.js.map +1 -1
- package/dist/elements/mute-button.js +3 -3
- package/dist/elements/mute-button.js.map +1 -1
- package/dist/elements/pip-button.d.ts.map +1 -1
- package/dist/elements/pip-button.js +6 -2
- package/dist/elements/pip-button.js.map +1 -1
- package/dist/elements/play-button.js +3 -3
- package/dist/elements/play-button.js.map +1 -1
- package/dist/elements/quality-menu.d.ts.map +1 -1
- package/dist/elements/quality-menu.js +5 -4
- package/dist/elements/quality-menu.js.map +1 -1
- package/dist/elements/remaining-time.js +2 -2
- package/dist/elements/remaining-time.js.map +1 -1
- package/dist/elements/scan-button.d.ts.map +1 -1
- package/dist/elements/scan-button.js +4 -3
- package/dist/elements/scan-button.js.map +1 -1
- package/dist/elements/seek-bar.d.ts.map +1 -1
- package/dist/elements/seek-bar.js +20 -16
- package/dist/elements/seek-bar.js.map +1 -1
- package/dist/elements/shared.js +4 -4
- package/dist/elements/shared.js.map +1 -1
- package/dist/elements/skip-button.js +2 -2
- package/dist/elements/skip-button.js.map +1 -1
- package/dist/elements/spacer.js.map +1 -1
- package/dist/elements/speed-menu.d.ts.map +1 -1
- package/dist/elements/speed-menu.js +4 -3
- package/dist/elements/speed-menu.js.map +1 -1
- package/dist/elements/spinner.js +1 -1
- package/dist/elements/spinner.js.map +1 -1
- package/dist/elements/start-button.js +3 -3
- package/dist/elements/start-button.js.map +1 -1
- package/dist/elements/subtitles-menu.d.ts.map +1 -1
- package/dist/elements/subtitles-menu.js +34 -10
- package/dist/elements/subtitles-menu.js.map +1 -1
- package/dist/elements/time-element.js +1 -1
- package/dist/elements/time-element.js.map +1 -1
- package/dist/elements/title.js +1 -1
- package/dist/elements/title.js.map +1 -1
- package/dist/elements/video-menu.d.ts.map +1 -1
- package/dist/elements/video-menu.js +5 -4
- package/dist/elements/video-menu.js.map +1 -1
- package/dist/elements/volume-slider.js +4 -4
- package/dist/elements/volume-slider.js.map +1 -1
- package/dist/elements/volume.js.map +1 -1
- package/dist/entries/airplay-button.js +1 -1
- package/dist/entries/audio-menu.js +1 -1
- package/dist/entries/casting.d.ts +5 -0
- package/dist/entries/casting.d.ts.map +1 -0
- package/dist/entries/casting.js +8 -0
- package/dist/entries/casting.js.map +1 -0
- package/dist/entries/chapters-menu.js +1 -1
- package/dist/entries/control-bar.js +1 -1
- package/dist/entries/current-time.js +1 -1
- package/dist/entries/drm-badge.js +1 -1
- package/dist/entries/duration.js +1 -1
- package/dist/entries/error-screen.js +1 -1
- package/dist/entries/fullscreen-button.js +1 -1
- package/dist/entries/live-button.js +1 -1
- package/dist/entries/marker-button.js +1 -1
- package/dist/entries/mute-button.js +1 -1
- package/dist/entries/pip-button.js +1 -1
- package/dist/entries/play-button.js +1 -1
- package/dist/entries/quality-menu.js +1 -1
- package/dist/entries/remaining-time.js +1 -1
- package/dist/entries/scan-button.js +1 -1
- package/dist/entries/seek-bar.js +1 -1
- package/dist/entries/skip-button.js +1 -1
- package/dist/entries/spacer.js +1 -1
- package/dist/entries/speed-menu.js +1 -1
- package/dist/entries/spinner.js +1 -1
- package/dist/entries/start-button.js +1 -1
- package/dist/entries/subtitles-menu.js +1 -1
- package/dist/entries/title.js +1 -1
- package/dist/entries/video-menu.js +1 -1
- package/dist/entries/volume-slider.js +1 -1
- package/dist/entries/volume.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.155.0 → _@oxc-project_runtime@0.158.0}/helpers/esm/asyncToGenerator.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.155.0 → _@oxc-project_runtime@0.158.0}/helpers/esm/defineProperty.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.155.0 → _@oxc-project_runtime@0.158.0}/helpers/esm/objectSpread2.js +1 -1
- package/dist/es2015/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPrimitive.js +13 -0
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.155.0 → _@oxc-project_runtime@0.158.0}/helpers/esm/toPropertyKey.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.155.0 → _@oxc-project_runtime@0.158.0}/helpers/esm/typeof.js +1 -1
- package/dist/es2015/controls/chapters.js +2 -2
- package/dist/es2015/controls/cues.js +2 -2
- package/dist/es2015/controls/icons.js +2 -0
- package/dist/es2015/controls/menu.js +1 -1
- package/dist/es2015/controls/native-tracks.js +1 -1
- package/dist/es2015/element.js +262 -55
- package/dist/es2015/elements/airplay-button.js +1 -1
- package/dist/es2015/elements/audio-menu.js +4 -3
- package/dist/es2015/elements/casting.js +55 -0
- package/dist/es2015/elements/chapters-menu.js +5 -5
- package/dist/es2015/elements/component.js +26 -7
- package/dist/es2015/elements/control-bar.js +29 -7
- package/dist/es2015/elements/current-time.js +2 -2
- package/dist/es2015/elements/drm-badge.js +2 -2
- package/dist/es2015/elements/duration.js +3 -3
- package/dist/es2015/elements/error-screen.js +2 -2
- package/dist/es2015/elements/fullscreen-button.js +3 -2
- package/dist/es2015/elements/live-button.js +3 -3
- package/dist/es2015/elements/marker-button.js +3 -3
- package/dist/es2015/elements/menu-element.js +4 -4
- package/dist/es2015/elements/mute-button.js +3 -3
- package/dist/es2015/elements/pip-button.js +6 -2
- package/dist/es2015/elements/play-button.js +3 -3
- package/dist/es2015/elements/quality-menu.js +5 -4
- package/dist/es2015/elements/remaining-time.js +2 -2
- package/dist/es2015/elements/scan-button.js +4 -3
- package/dist/es2015/elements/seek-bar.js +20 -16
- package/dist/es2015/elements/shared.js +4 -4
- package/dist/es2015/elements/skip-button.js +2 -2
- package/dist/es2015/elements/speed-menu.js +4 -3
- package/dist/es2015/elements/spinner.js +1 -1
- package/dist/es2015/elements/start-button.js +3 -3
- package/dist/es2015/elements/subtitles-menu.js +34 -10
- package/dist/es2015/elements/time-element.js +1 -1
- package/dist/es2015/elements/title.js +1 -1
- package/dist/es2015/elements/video-menu.js +5 -4
- package/dist/es2015/elements/volume-slider.js +4 -4
- package/dist/es2015/entries/airplay-button.js +1 -1
- package/dist/es2015/entries/audio-menu.js +1 -1
- package/dist/es2015/entries/casting.js +6 -0
- package/dist/es2015/entries/chapters-menu.js +1 -1
- package/dist/es2015/entries/control-bar.js +1 -1
- package/dist/es2015/entries/current-time.js +1 -1
- package/dist/es2015/entries/drm-badge.js +1 -1
- package/dist/es2015/entries/duration.js +1 -1
- package/dist/es2015/entries/error-screen.js +1 -1
- package/dist/es2015/entries/fullscreen-button.js +1 -1
- package/dist/es2015/entries/live-button.js +1 -1
- package/dist/es2015/entries/marker-button.js +1 -1
- package/dist/es2015/entries/mute-button.js +1 -1
- package/dist/es2015/entries/pip-button.js +1 -1
- package/dist/es2015/entries/play-button.js +1 -1
- package/dist/es2015/entries/quality-menu.js +1 -1
- package/dist/es2015/entries/remaining-time.js +1 -1
- package/dist/es2015/entries/scan-button.js +1 -1
- package/dist/es2015/entries/seek-bar.js +1 -1
- package/dist/es2015/entries/skip-button.js +1 -1
- package/dist/es2015/entries/spacer.js +1 -1
- package/dist/es2015/entries/speed-menu.js +1 -1
- package/dist/es2015/entries/spinner.js +1 -1
- package/dist/es2015/entries/start-button.js +1 -1
- package/dist/es2015/entries/subtitles-menu.js +1 -1
- package/dist/es2015/entries/title.js +1 -1
- package/dist/es2015/entries/video-menu.js +1 -1
- package/dist/es2015/entries/volume-slider.js +1 -1
- package/dist/es2015/entries/volume.js +1 -1
- package/dist/es2015/host.js +9 -1
- package/dist/es2015/index.js +5 -3
- package/dist/es2015/locales/ar.js +4 -1
- package/dist/es2015/locales/ca.js +4 -1
- package/dist/es2015/locales/de.js +4 -1
- package/dist/es2015/locales/es.js +4 -1
- package/dist/es2015/locales/fr.js +4 -1
- package/dist/es2015/locales/hi.js +4 -1
- package/dist/es2015/locales/it.js +4 -1
- package/dist/es2015/locales/ja.js +4 -1
- package/dist/es2015/locales/ko.js +4 -1
- package/dist/es2015/locales/pt.js +4 -1
- package/dist/es2015/locales/zh.js +4 -1
- package/dist/es2015/locales.js +1 -1
- package/dist/es2015/media.js +136 -0
- package/dist/es2015/presets.js +3 -2
- package/dist/es2015/style.js +1 -1
- package/dist/es2015/tags.js +2 -1
- package/dist/es2015/video-sources.js +1 -1
- package/dist/host.d.ts +32 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +9 -1
- package/dist/host.js.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/locales/ar.d.ts +3 -0
- package/dist/locales/ar.d.ts.map +1 -1
- package/dist/locales/ar.js +4 -1
- package/dist/locales/ar.js.map +1 -1
- package/dist/locales/ca.d.ts +3 -0
- package/dist/locales/ca.d.ts.map +1 -1
- package/dist/locales/ca.js +4 -1
- package/dist/locales/ca.js.map +1 -1
- package/dist/locales/de.d.ts +3 -0
- package/dist/locales/de.d.ts.map +1 -1
- package/dist/locales/de.js +4 -1
- package/dist/locales/de.js.map +1 -1
- package/dist/locales/es.d.ts +3 -0
- package/dist/locales/es.d.ts.map +1 -1
- package/dist/locales/es.js +4 -1
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/fr.d.ts +3 -0
- package/dist/locales/fr.d.ts.map +1 -1
- package/dist/locales/fr.js +4 -1
- package/dist/locales/fr.js.map +1 -1
- package/dist/locales/hi.d.ts +3 -0
- package/dist/locales/hi.d.ts.map +1 -1
- package/dist/locales/hi.js +4 -1
- package/dist/locales/hi.js.map +1 -1
- package/dist/locales/it.d.ts +3 -0
- package/dist/locales/it.d.ts.map +1 -1
- package/dist/locales/it.js +4 -1
- package/dist/locales/it.js.map +1 -1
- package/dist/locales/ja.d.ts +3 -0
- package/dist/locales/ja.d.ts.map +1 -1
- package/dist/locales/ja.js +4 -1
- package/dist/locales/ja.js.map +1 -1
- package/dist/locales/ko.d.ts +3 -0
- package/dist/locales/ko.d.ts.map +1 -1
- package/dist/locales/ko.js +4 -1
- package/dist/locales/ko.js.map +1 -1
- package/dist/locales/pt.d.ts +3 -0
- package/dist/locales/pt.d.ts.map +1 -1
- package/dist/locales/pt.js +4 -1
- package/dist/locales/pt.js.map +1 -1
- package/dist/locales/zh.d.ts +3 -0
- package/dist/locales/zh.d.ts.map +1 -1
- package/dist/locales/zh.js +4 -1
- package/dist/locales/zh.js.map +1 -1
- package/dist/media.d.ts +22 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +136 -0
- package/dist/media.js.map +1 -0
- package/dist/messages.d.ts +6 -0
- package/dist/messages.d.ts.map +1 -1
- package/dist/presets.js +2 -1
- package/dist/presets.js.map +1 -1
- package/dist/remote.d.ts +80 -0
- package/dist/remote.d.ts.map +1 -0
- package/dist/style.js +1 -1
- package/dist/style.js.map +1 -1
- package/dist/tags.d.ts +1 -0
- package/dist/tags.d.ts.map +1 -1
- package/dist/tags.js +2 -1
- package/dist/tags.js.map +1 -1
- package/package.json +3 -3
- package/dist/es2015/_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/toPrimitive.js +0 -13
|
@@ -16,14 +16,8 @@
|
|
|
16
16
|
* hidden draws nothing, and the cues arrive.
|
|
17
17
|
*/
|
|
18
18
|
import type { Mattebox } from 'mattebox';
|
|
19
|
-
import type { PlayerHost } from '../host.js';
|
|
20
|
-
export
|
|
21
|
-
readonly start: number;
|
|
22
|
-
readonly end: number;
|
|
23
|
-
readonly title: string;
|
|
24
|
-
/** The URL of the chapter's picture. Only the engine's chapters carry one. */
|
|
25
|
-
readonly image?: string;
|
|
26
|
-
}
|
|
19
|
+
import type { Chapter, PlayerHost } from '../host.js';
|
|
20
|
+
export type { Chapter };
|
|
27
21
|
/** The first chapters track on the video, or null. */
|
|
28
22
|
export declare function chapterTrack(video: HTMLVideoElement): TextTrack | null;
|
|
29
23
|
/** The chapters of the session: the engine's when it holds some, else the video's track. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chapters.d.ts","sourceRoot":"","sources":["../../src/controls/chapters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"chapters.d.ts","sourceRoot":"","sources":["../../src/controls/chapters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGtD,YAAY,EAAE,OAAO,EAAE,CAAC;AAExB,sDAAsD;AACtD,wBAAgB,YAAY,CAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,GAAG,IAAI,CAGtE;AA0BD,4FAA4F;AAC5F,wBAAgB,QAAQ,CAAC,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI,GAAG,OAAO,EAAE,CAGpF;AAED,8FAA8F;AAC9F,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAIxE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CA0C7E"}
|
|
@@ -49,7 +49,7 @@ function chapterAt(list, time) {
|
|
|
49
49
|
* Every chapters track found is set hidden, so its cues load.
|
|
50
50
|
*/
|
|
51
51
|
function followChapters(player, fn) {
|
|
52
|
-
const video = player.
|
|
52
|
+
const video = player.media;
|
|
53
53
|
const listen = (target, name, handler) => {
|
|
54
54
|
target.addEventListener(name, handler);
|
|
55
55
|
return () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chapters.js","names":[],"sources":["../../src/controls/chapters.ts"],"sourcesContent":["/**\n * Chapters come from one of two places, read through these helpers so the\n * seek bar and the chapters menu agree without knowing each other.\n *\n * - The engine's `chapters` namespace, when the session has one and it\n * holds chapters: a file the player's `chapters` attribute loaded, the\n * manifest's own, or chapters the page set. See the engine guide's\n * chapters chapter.\n * - Otherwise the browser's own: a text track of kind `chapters` on the\n * video, from a `<track>` the page or the player's `chapters` attribute\n * put there, or from `addTextTrack`. A native session has chapters this\n * way.\n *\n * A track from a `<track>` element loads its cues only while its mode is\n * `hidden` or `showing`, so a disabled chapters track is set hidden here:\n * hidden draws nothing, and the cues arrive.\n */\nimport type { Mattebox } from 'mattebox';\nimport type { PlayerHost } from '../host.js';\nimport { optional } from './session.js';\n\nexport
|
|
1
|
+
{"version":3,"file":"chapters.js","names":[],"sources":["../../src/controls/chapters.ts"],"sourcesContent":["/**\n * Chapters come from one of two places, read through these helpers so the\n * seek bar and the chapters menu agree without knowing each other.\n *\n * - The engine's `chapters` namespace, when the session has one and it\n * holds chapters: a file the player's `chapters` attribute loaded, the\n * manifest's own, or chapters the page set. See the engine guide's\n * chapters chapter.\n * - Otherwise the browser's own: a text track of kind `chapters` on the\n * video, from a `<track>` the page or the player's `chapters` attribute\n * put there, or from `addTextTrack`. A native session has chapters this\n * way.\n *\n * A track from a `<track>` element loads its cues only while its mode is\n * `hidden` or `showing`, so a disabled chapters track is set hidden here:\n * hidden draws nothing, and the cues arrive.\n */\nimport type { Mattebox } from 'mattebox';\nimport type { Chapter, PlayerHost } from '../host.js';\nimport { optional } from './session.js';\n\nexport type { Chapter };\n\n/** The first chapters track on the video, or null. */\nexport function chapterTrack(video: HTMLVideoElement): TextTrack | null {\n for (const track of video.textTracks) if (track.kind === 'chapters') return track;\n return null;\n}\n\n/** The engine's chapters, already in order, or none. */\nfunction engineChapters(engine: Mattebox | null): Chapter[] {\n const api = optional(engine).chapters;\n if (api === undefined) return [];\n return api.all.map((chapter) => ({\n start: chapter.start,\n end: chapter.end,\n title: chapter.title,\n ...(chapter.image === undefined ? {} : { image: chapter.image.url }),\n }));\n}\n\n/** The cues of the video's chapters track, in order, or none. */\nfunction trackChapters(video: HTMLVideoElement): Chapter[] {\n const track = chapterTrack(video);\n if (track === null || track.cues === null) return [];\n const out: Chapter[] = [];\n for (const cue of track.cues) {\n const text = cue instanceof VTTCue ? cue.text : '';\n out.push({ start: cue.startTime, end: cue.endTime, title: text.trim() });\n }\n return out.sort((a, b) => a.start - b.start);\n}\n\n/** The chapters of the session: the engine's when it holds some, else the video's track. */\nexport function chapters(video: HTMLVideoElement, engine: Mattebox | null): Chapter[] {\n const own = engineChapters(engine);\n return own.length > 0 ? own : trackChapters(video);\n}\n\n/** The index of the chapter `time` falls in, the last one started, or -1 before the first. */\nexport function chapterAt(list: readonly Chapter[], time: number): number {\n let found = -1;\n for (const [i, chapter] of list.entries()) if (chapter.start <= time) found = i;\n return found;\n}\n\n/**\n * Runs `fn` whenever the chapters may have changed: the engine reported a\n * change, a session came in, a track was added or removed, the cues of a\n * `<track>` arrived, or the active cue moved on. Returns the unsubscribe.\n * Every chapters track found is set hidden, so its cues load.\n */\nexport function followChapters(player: PlayerHost, fn: () => void): () => void {\n const video = player.media;\n const listen = (target: EventTarget, name: string, handler: () => void): (() => void) => {\n target.addEventListener(name, handler);\n return () => {\n target.removeEventListener(name, handler);\n };\n };\n /** The listeners on the tracks of the moment, replaced when the list changes. */\n let inner: Array<() => void> = [];\n /** The listener on the engine of the moment, replaced when the session changes. */\n let own: () => void = () => undefined;\n const wire = (): void => {\n for (const off of inner) off();\n inner = [];\n for (const track of video.textTracks) {\n if (track.kind !== 'chapters') continue;\n if (track.mode === 'disabled') track.mode = 'hidden';\n inner.push(listen(track, 'cuechange', fn));\n }\n for (const node of video.querySelectorAll('track')) {\n if (node.kind === 'chapters') inner.push(listen(node, 'load', fn));\n }\n fn();\n };\n const session = (): void => {\n own();\n own = player.engine?.on('chapters:changed', fn) ?? (() => undefined);\n fn();\n };\n const outer = [\n listen(video.textTracks, 'addtrack', wire),\n listen(video.textTracks, 'removetrack', wire),\n listen(player, 'sourcechange', session),\n ];\n wire();\n session();\n return () => {\n for (const off of [...outer, ...inner]) off();\n own();\n inner = [];\n };\n}\n"],"mappings":";;;AAwBA,SAAgB,aAAa,OAA2C;CACtE,KAAK,MAAM,SAAS,MAAM,YAAY,IAAI,MAAM,SAAS,YAAY,OAAO;CAC5E,OAAO;AACT;;AAGA,SAAS,eAAe,QAAoC;CAC1D,MAAM,MAAM,SAAS,MAAM,CAAC,CAAC;CAC7B,IAAI,QAAQ,KAAA,GAAW,OAAO,CAAC;CAC/B,OAAO,IAAI,IAAI,KAAK,aAAa;EAC/B,OAAO,QAAQ;EACf,KAAK,QAAQ;EACb,OAAO,QAAQ;EACf,GAAI,QAAQ,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO,QAAQ,MAAM,IAAI;CACpE,EAAE;AACJ;;AAGA,SAAS,cAAc,OAAoC;CACzD,MAAM,QAAQ,aAAa,KAAK;CAChC,IAAI,UAAU,QAAQ,MAAM,SAAS,MAAM,OAAO,CAAC;CACnD,MAAM,MAAiB,CAAC;CACxB,KAAK,MAAM,OAAO,MAAM,MAAM;EAC5B,MAAM,OAAO,eAAe,SAAS,IAAI,OAAO;EAChD,IAAI,KAAK;GAAE,OAAO,IAAI;GAAW,KAAK,IAAI;GAAS,OAAO,KAAK,KAAK;EAAE,CAAC;CACzE;CACA,OAAO,IAAI,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK;AAC7C;;AAGA,SAAgB,SAAS,OAAyB,QAAoC;CACpF,MAAM,MAAM,eAAe,MAAM;CACjC,OAAO,IAAI,SAAS,IAAI,MAAM,cAAc,KAAK;AACn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oot":"","sources":["../../src/controls/cues.ts"],"names":[],"mappings":"AAwBA,mFAAmF;AACnF,eAAO,MAAM,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAKnD,CAAC;AAqBF,gDAAgD;AAChD,wBAAgB,QAAQ,IAAI,IAAI,
|
|
1
|
+
{"version":3,"file":"cues.d.ts","sourceRoot":"","sources":["../../src/controls/cues.ts"],"names":[],"mappings":"AAwBA,mFAAmF;AACnF,eAAO,MAAM,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAKnD,CAAC;AAqBF,gDAAgD;AAChD,wBAAgB,QAAQ,IAAI,IAAI,CAO/B;AASD,MAAM,WAAW,OAAO;IACtB,qEAAqE;IACrE,MAAM,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAAC;IAC1B,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,4GAA4G;AAC5G,MAAM,MAAM,OAAO,GAAG,MAAM;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9E,wBAAgB,OAAO,CAAC,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAmJ7F"}
|
package/dist/controls/cues.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* already follows the video's height, in the page and in fullscreen alike.
|
|
23
23
|
* A page that wants more writes its own `mattebox-player > video::cue`.
|
|
24
24
|
*/
|
|
25
|
-
const CUE_RULES = "mattebox-player[subtitle-size=small]>video::cue{font-size:75%}mattebox-player[subtitle-size=large]>video::cue{font-size:150%}mattebox-player[subtitle-size=xlarge]>video::cue{font-size:200%}mattebox-player[subtitle-background=none]>video::cue{background-color:#0000}mattebox-player[subtitle-background=solid]>video::cue{background-color:#000}mattebox-player[subtitle-background=none]>video::-webkit-media-text-track-display-backdrop{background-color:#0000}mattebox-player[subtitle-background=solid]>video::-webkit-media-text-track-display-backdrop{background-color:#000}";
|
|
25
|
+
const CUE_RULES = "mattebox-player>video::cue{background-color:#0009}mattebox-player>video::-webkit-media-text-track-display-backdrop{background-color:#0000}mattebox-player[subtitle-size=small]>video::cue{font-size:75%}mattebox-player[subtitle-size=large]>video::cue{font-size:150%}mattebox-player[subtitle-size=xlarge]>video::cue{font-size:200%}mattebox-player[subtitle-background=none]>video::cue{background-color:#0000}mattebox-player[subtitle-background=solid]>video::cue{background-color:#000}mattebox-player[subtitle-background=none]>video::-webkit-media-text-track-display-backdrop{background-color:#0000}mattebox-player[subtitle-background=solid]>video::-webkit-media-text-track-display-backdrop{background-color:#000}";
|
|
26
26
|
/** How the sizes scale the browser's own cue size; the lift counts lines by it. */
|
|
27
27
|
const SCALES = {
|
|
28
28
|
small: .75,
|
|
@@ -52,7 +52,7 @@ function cueStyle() {
|
|
|
52
52
|
const style = document.createElement("style");
|
|
53
53
|
style.setAttribute(MARK, "");
|
|
54
54
|
style.textContent = CUE_RULES;
|
|
55
|
-
document.head.
|
|
55
|
+
document.head.prepend(style);
|
|
56
56
|
}
|
|
57
57
|
function cueLift(video, host, covered) {
|
|
58
58
|
/** The cues moved, with what they were, so they and only they are put back. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cues.js","names":[],"sources":["../../src/controls/cues.ts"],"sourcesContent":["/**\n * Subtitles and the bar. Two things.\n *\n * The lift: the browser draws native cues on the bottom edge of the video,\n * and under the bar. Every active cue the author left unpositioned is\n * moved up: above the bar while it shows, and one line off the edge while\n * it is hidden, so the text never sits on the picture's border. The\n * position is a negative line count, the one form every browser wraps at\n * the video's width; a percentage does not wrap in Chromium. Chromium\n * anchors the box's top on the count and Gecko its bottom, and their\n * overlap avoidance pushes in opposite directions, so nothing is left to\n * them: subtitles often show two cues at once, and the cues stack by their\n * own measured heights, wrapping included, clear under both readings. A\n * cue with a position of its own is the author's and is not touched.\n *\n * The look: `::cue` can only be styled from the document that holds the\n * video, which is the page and not the shadow root, and it takes no custom\n * properties. So a small sheet goes into the document, once, with one rule\n * per look the host's `subtitle-size` and `subtitle-background` attributes\n * can take. Sizes are percentages of the browser's own cue size, which\n * already follows the video's height, in the page and in fullscreen alike.\n * A page that wants more writes its own `mattebox-player > video::cue`.\n */\nimport CUE_RULES from './cues.css?inline';\n/** How the sizes scale the browser's own cue size; the lift counts lines by it. */\nexport const SCALES: Readonly<Record<string, number>> = {\n small: 0.75,\n medium: 1,\n large: 1.5,\n xlarge: 2,\n};\n\n/**\n * The sheet in the document. `mattebox-player` is the element's tag. The\n * background goes on `::cue` and on the backdrop pseudo-element Chromium\n * and WebKit have, both: which of the two paints it differs by browser and\n * version, and a selector a browser does not know only voids its own rule.\n */\n\nconst MARK = 'data-mattebox-cue';\n\n/** The browser's cue size against the video's height, per WebVTT, and its line against the size. */\nconst CUE_SIZE = 0.05;\nconst LINE_HEIGHT = 1.2;\n/** What a cue box spans of the video's width by default, so wrapping is measured against it. */\nconst CUE_WIDTH = 0.96;\n/** Pixels of air between the bar and the cue above it, before rounding up to a line. */\nconst AIR = 6;\n/** Lines of air under a cue while the bar is hidden. */\nconst REST = 1;\n\n/** Puts the cue rules in the document, once. */\nexport function cueStyle(): void {\n if (document.head.querySelector(`style[${MARK}]`) !== null) return;\n const style = document.createElement('style');\n style.setAttribute(MARK, '');\n style.textContent = CUE_RULES;\n document.head.append(style);\n}\n\n/** What a lifted cue looked like before, to put back. */\ninterface Placed {\n readonly line: number | 'auto';\n readonly snapToLines: boolean;\n readonly lineAlign: LineAlignSetting;\n}\n\nexport interface CueLift {\n /** Whether the bar is showing, so the cues move above it or back. */\n lifted(on: boolean): void;\n dispose(): void;\n}\n\n/** What the bar covers of the picture: from its first row's top, not its gradient run-in, to its bottom. */\nexport type Covered = () => { readonly top: number; readonly bottom: number };\n\nexport function cueLift(video: HTMLVideoElement, host: HTMLElement, covered: Covered): CueLift {\n /** The cues moved, with what they were, so they and only they are put back. */\n const lifted = new Map<VTTCue, Placed>();\n let on = false;\n /** False once disposed: the cues go back to where the author left them. */\n let live = true;\n let canvas: CanvasRenderingContext2D | null | undefined;\n\n function showing(): TextTrack[] {\n const out: TextTrack[] = [];\n for (const track of video.textTracks) if (track.mode === 'showing') out.push(track);\n return out;\n }\n\n /** The browser's cue font size, in pixels, from the video's height and the host's scale. */\n function fontSize(height: number): number {\n const scale = SCALES[host.getAttribute('subtitle-size') ?? ''] ?? 1;\n return height * CUE_SIZE * scale;\n }\n\n /** Measures text the way the browser draws cues, to count the lines a cue wraps into. */\n function measure(): CanvasRenderingContext2D | null {\n if (canvas === undefined) canvas = document.createElement('canvas').getContext('2d');\n return canvas;\n }\n\n /**\n * A cue's text without its tags, for measuring: `<b>`, `<c.name>`, the\n * timestamps and their closers. Brackets are counted, so a tag inside\n * another's brackets goes with it.\n */\n function plain(text: string): string {\n let out = '';\n let depth = 0;\n for (const char of text) {\n if (char === '<') depth += 1;\n else if (char === '>') depth = Math.max(0, depth - 1);\n else if (depth === 0) out += char;\n }\n return out;\n }\n\n /** The lines a cue takes: its own, each wrapped at the cue box's width. */\n function lines(cue: VTTCue, font: number, width: number): number {\n const context = measure();\n let total = 0;\n for (const line of plain(cue.text).split('\\n')) {\n if (context === null) {\n total += 1;\n continue;\n }\n context.font = `${font}px sans-serif`;\n total += Math.max(1, Math.ceil(context.measureText(line).width / (width * CUE_WIDTH)));\n }\n return total;\n }\n\n function apply(): void {\n const box = video.getBoundingClientRect();\n const height = box.height;\n const span = covered();\n const pixels = span.bottom - span.top;\n const lift = live && height > 0;\n const font = fontSize(height);\n const unit = font * LINE_HEIGHT;\n // The lines the bar covers, with a little air, rounded up to whole\n // lines. With the bar hidden, the cue rests a line off the edge.\n const barred = on && pixels > 0 && pixels < height;\n const base = barred ? Math.ceil((pixels + AIR) / unit) : REST;\n for (const track of showing()) {\n // Earliest first, the order the browser stacks them in, so the first\n // sits lowest and the rest climb.\n const active = [...(track.activeCues ?? [])]\n .filter((cue): cue is VTTCue => cue instanceof VTTCue)\n .sort((a, b) => a.startTime - b.startTime);\n let previous: { line: number; height: number } | null = null;\n let changed = false;\n for (const cue of active) {\n const was = lifted.get(cue);\n if (!lift) {\n if (was === undefined) continue;\n cue.line = was.line;\n cue.snapToLines = was.snapToLines;\n cue.lineAlign = was.lineAlign;\n lifted.delete(cue);\n changed = true;\n continue;\n }\n // The author's own placement is the author's.\n if (was === undefined && cue.line !== 'auto') continue;\n if (was === undefined) {\n lifted.set(cue, {\n line: cue.line,\n snapToLines: cue.snapToLines,\n lineAlign: cue.lineAlign,\n });\n }\n // A negative line count, which every browser wraps at the video's\n // width, unlike a percentage. Chromium anchors the box's top on it\n // and Gecko its bottom, so the count clears the bar and the cue\n // below under both readings, with a little air to spare in one.\n const own = lines(cue, font, box.width);\n const line: number =\n previous === null ? base + own : previous.line + Math.max(own, previous.height);\n if (cue.line !== -line || !cue.snapToLines) changed = true;\n cue.snapToLines = true;\n cue.line = -line;\n previous = { line, height: own };\n }\n // Chromium lays a changed line out again only when the track's display\n // is rebuilt, which neither time nor a seek does for a cue already\n // showing; the mode flipped off and on in one task rebuilds it with no\n // paint in between. Only on a change, so the change event this fires\n // finds nothing to do and the loop ends there.\n if (changed) {\n track.mode = 'hidden';\n track.mode = 'showing';\n }\n }\n }\n\n function watch(): void {\n for (const track of video.textTracks) {\n track.removeEventListener('cuechange', apply);\n track.addEventListener('cuechange', apply);\n }\n apply();\n }\n\n video.textTracks.addEventListener('change', watch);\n video.textTracks.addEventListener('addtrack', watch);\n watch();\n\n return {\n lifted(next: boolean): void {\n on = next;\n apply();\n },\n dispose(): void {\n on = false;\n live = false;\n apply();\n video.textTracks.removeEventListener('change', watch);\n video.textTracks.removeEventListener('addtrack', watch);\n for (const track of video.textTracks) track.removeEventListener('cuechange', apply);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAA,YAAA;;AAEA,MAAA,SAAA;CACA,OA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;IACA,IAAA,OAAA,CAAA;IACA,WAAA;KAAA;KAAA,QAAA;IAAA;GACA;GAMA,IAAA,SAAA;IACA,MAAA,OAAA;IACA,MAAA,OAAA;GACA;EACA;CACA;CAEA,SAAA,QAAA;EACA,KAAA,MAAA,SAAA,MAAA,YAAA;GACA,MAAA,oBAAA,aAAA,KAAA;GACA,MAAA,iBAAA,aAAA,KAAA;EACA;EACA,MAAA;CACA;CAEA,MAAA,WAAA,iBAAA,UAAA,KAAA;CACA,MAAA,WAAA,iBAAA,YAAA,KAAA;CACA,MAAA;CAEA,OAAA;EACA,OAAA,MAAA;GACA,KAAA;GACA,MAAA;EACA;EACA,UAAA;GACA,KAAA;GACA,OAAA;GACA,MAAA;GACA,MAAA,WAAA,oBAAA,UAAA,KAAA;GACA,MAAA,WAAA,oBAAA,YAAA,KAAA;GACA,KAAA,MAAA,SAAA,MAAA,YAAA,MAAA,oBAAA,aAAA,KAAA;EACA;CACA;AACA"}
|
|
1
|
+
{"version":3,"file":"cues.js","names":[],"sources":["../../src/controls/cues.ts"],"sourcesContent":["/**\n * Subtitles and the bar. Two things.\n *\n * The lift: the browser draws native cues on the bottom edge of the video,\n * and under the bar. Every active cue the author left unpositioned is\n * moved up: above the bar while it shows, and one line off the edge while\n * it is hidden, so the text never sits on the picture's border. The\n * position is a negative line count, the one form every browser wraps at\n * the video's width; a percentage does not wrap in Chromium. Chromium\n * anchors the box's top on the count and Gecko its bottom, and their\n * overlap avoidance pushes in opposite directions, so nothing is left to\n * them: subtitles often show two cues at once, and the cues stack by their\n * own measured heights, wrapping included, clear under both readings. A\n * cue with a position of its own is the author's and is not touched.\n *\n * The look: `::cue` can only be styled from the document that holds the\n * video, which is the page and not the shadow root, and it takes no custom\n * properties. So a small sheet goes into the document, once, with one rule\n * per look the host's `subtitle-size` and `subtitle-background` attributes\n * can take. Sizes are percentages of the browser's own cue size, which\n * already follows the video's height, in the page and in fullscreen alike.\n * A page that wants more writes its own `mattebox-player > video::cue`.\n */\nimport CUE_RULES from './cues.css?inline';\n/** How the sizes scale the browser's own cue size; the lift counts lines by it. */\nexport const SCALES: Readonly<Record<string, number>> = {\n small: 0.75,\n medium: 1,\n large: 1.5,\n xlarge: 2,\n};\n\n/**\n * The sheet in the document. `mattebox-player` is the element's tag. The\n * background goes on `::cue` and on the backdrop pseudo-element Chromium\n * and WebKit have, both: which of the two paints it differs by browser and\n * version, and a selector a browser does not know only voids its own rule.\n */\n\nconst MARK = 'data-mattebox-cue';\n\n/** The browser's cue size against the video's height, per WebVTT, and its line against the size. */\nconst CUE_SIZE = 0.05;\nconst LINE_HEIGHT = 1.2;\n/** What a cue box spans of the video's width by default, so wrapping is measured against it. */\nconst CUE_WIDTH = 0.96;\n/** Pixels of air between the bar and the cue above it, before rounding up to a line. */\nconst AIR = 6;\n/** Lines of air under a cue while the bar is hidden. */\nconst REST = 1;\n\n/** Puts the cue rules in the document, once. */\nexport function cueStyle(): void {\n if (document.head.querySelector(`style[${MARK}]`) !== null) return;\n const style = document.createElement('style');\n style.setAttribute(MARK, '');\n style.textContent = CUE_RULES;\n // First in the head: a page's own rule of the same weight comes later and wins.\n document.head.prepend(style);\n}\n\n/** What a lifted cue looked like before, to put back. */\ninterface Placed {\n readonly line: number | 'auto';\n readonly snapToLines: boolean;\n readonly lineAlign: LineAlignSetting;\n}\n\nexport interface CueLift {\n /** Whether the bar is showing, so the cues move above it or back. */\n lifted(on: boolean): void;\n dispose(): void;\n}\n\n/** What the bar covers of the picture: from its first row's top, not its gradient run-in, to its bottom. */\nexport type Covered = () => { readonly top: number; readonly bottom: number };\n\nexport function cueLift(video: HTMLVideoElement, host: HTMLElement, covered: Covered): CueLift {\n /** The cues moved, with what they were, so they and only they are put back. */\n const lifted = new Map<VTTCue, Placed>();\n let on = false;\n /** False once disposed: the cues go back to where the author left them. */\n let live = true;\n let canvas: CanvasRenderingContext2D | null | undefined;\n\n function showing(): TextTrack[] {\n const out: TextTrack[] = [];\n for (const track of video.textTracks) if (track.mode === 'showing') out.push(track);\n return out;\n }\n\n /** The browser's cue font size, in pixels, from the video's height and the host's scale. */\n function fontSize(height: number): number {\n const scale = SCALES[host.getAttribute('subtitle-size') ?? ''] ?? 1;\n return height * CUE_SIZE * scale;\n }\n\n /** Measures text the way the browser draws cues, to count the lines a cue wraps into. */\n function measure(): CanvasRenderingContext2D | null {\n if (canvas === undefined) canvas = document.createElement('canvas').getContext('2d');\n return canvas;\n }\n\n /**\n * A cue's text without its tags, for measuring: `<b>`, `<c.name>`, the\n * timestamps and their closers. Brackets are counted, so a tag inside\n * another's brackets goes with it.\n */\n function plain(text: string): string {\n let out = '';\n let depth = 0;\n for (const char of text) {\n if (char === '<') depth += 1;\n else if (char === '>') depth = Math.max(0, depth - 1);\n else if (depth === 0) out += char;\n }\n return out;\n }\n\n /** The lines a cue takes: its own, each wrapped at the cue box's width. */\n function lines(cue: VTTCue, font: number, width: number): number {\n const context = measure();\n let total = 0;\n for (const line of plain(cue.text).split('\\n')) {\n if (context === null) {\n total += 1;\n continue;\n }\n context.font = `${font}px sans-serif`;\n total += Math.max(1, Math.ceil(context.measureText(line).width / (width * CUE_WIDTH)));\n }\n return total;\n }\n\n function apply(): void {\n const box = video.getBoundingClientRect();\n const height = box.height;\n const span = covered();\n const pixels = span.bottom - span.top;\n const lift = live && height > 0;\n const font = fontSize(height);\n const unit = font * LINE_HEIGHT;\n // The lines the bar covers, with a little air, rounded up to whole\n // lines. With the bar hidden, the cue rests a line off the edge.\n const barred = on && pixels > 0 && pixels < height;\n const base = barred ? Math.ceil((pixels + AIR) / unit) : REST;\n for (const track of showing()) {\n // Earliest first, the order the browser stacks them in, so the first\n // sits lowest and the rest climb.\n const active = [...(track.activeCues ?? [])]\n .filter((cue): cue is VTTCue => cue instanceof VTTCue)\n .sort((a, b) => a.startTime - b.startTime);\n let previous: { line: number; height: number } | null = null;\n let changed = false;\n for (const cue of active) {\n const was = lifted.get(cue);\n if (!lift) {\n if (was === undefined) continue;\n cue.line = was.line;\n cue.snapToLines = was.snapToLines;\n cue.lineAlign = was.lineAlign;\n lifted.delete(cue);\n changed = true;\n continue;\n }\n // The author's own placement is the author's.\n if (was === undefined && cue.line !== 'auto') continue;\n if (was === undefined) {\n lifted.set(cue, {\n line: cue.line,\n snapToLines: cue.snapToLines,\n lineAlign: cue.lineAlign,\n });\n }\n // A negative line count, which every browser wraps at the video's\n // width, unlike a percentage. Chromium anchors the box's top on it\n // and Gecko its bottom, so the count clears the bar and the cue\n // below under both readings, with a little air to spare in one.\n const own = lines(cue, font, box.width);\n const line: number =\n previous === null ? base + own : previous.line + Math.max(own, previous.height);\n if (cue.line !== -line || !cue.snapToLines) changed = true;\n cue.snapToLines = true;\n cue.line = -line;\n previous = { line, height: own };\n }\n // Chromium lays a changed line out again only when the track's display\n // is rebuilt, which neither time nor a seek does for a cue already\n // showing; the mode flipped off and on in one task rebuilds it with no\n // paint in between. Only on a change, so the change event this fires\n // finds nothing to do and the loop ends there.\n if (changed) {\n track.mode = 'hidden';\n track.mode = 'showing';\n }\n }\n }\n\n function watch(): void {\n for (const track of video.textTracks) {\n track.removeEventListener('cuechange', apply);\n track.addEventListener('cuechange', apply);\n }\n apply();\n }\n\n video.textTracks.addEventListener('change', watch);\n video.textTracks.addEventListener('addtrack', watch);\n watch();\n\n return {\n lifted(next: boolean): void {\n on = next;\n apply();\n },\n dispose(): void {\n on = false;\n live = false;\n apply();\n video.textTracks.removeEventListener('change', watch);\n video.textTracks.removeEventListener('addtrack', watch);\n for (const track of video.textTracks) track.removeEventListener('cuechange', apply);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAA,YAAA;;AAEA,MAAa,SAA2C;CACtD,OAAO;CACP,QAAQ;CACR,OAAO;CACP,QAAQ;AACV;;;;;;;AASA,MAAM,OAAO;;AAGb,MAAM,WAAW;AACjB,MAAM,cAAc;;AAEpB,MAAM,YAAY;;AAElB,MAAM,MAAM;;AAEZ,MAAM,OAAO;;AAGb,SAAgB,WAAiB;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;KAAM,QAAQ;IAAI;GACjC;GAMA,IAAI,SAAS;IACX,MAAM,OAAO;IACb,MAAM,OAAO;GACf;EACF;CACF;CAEA,SAAS,QAAc;EACrB,KAAK,MAAM,SAAS,MAAM,YAAY;GACpC,MAAM,oBAAoB,aAAa,KAAK;GAC5C,MAAM,iBAAiB,aAAa,KAAK;EAC3C;EACA,MAAM;CACR;CAEA,MAAM,WAAW,iBAAiB,UAAU,KAAK;CACjD,MAAM,WAAW,iBAAiB,YAAY,KAAK;CACnD,MAAM;CAEN,OAAO;EACL,OAAO,MAAqB;GAC1B,KAAK;GACL,MAAM;EACR;EACA,UAAgB;GACd,KAAK;GACL,OAAO;GACP,MAAM;GACN,MAAM,WAAW,oBAAoB,UAAU,KAAK;GACpD,MAAM,WAAW,oBAAoB,YAAY,KAAK;GACtD,KAAK,MAAM,SAAS,MAAM,YAAY,MAAM,oBAAoB,aAAa,KAAK;EACpF;CACF;AACF"}
|
package/dist/controls/icons.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* like the panels of the mark. Each is one path, so a glyph scales to any
|
|
5
5
|
* size and takes the text colour.
|
|
6
6
|
*/
|
|
7
|
-
export type IconName = 'play' | 'pause' | 'replay' | 'mute' | 'volume-low' | 'volume-high' | 'fullscreen' | 'fullscreen-exit' | 'quality' | 'audio' | 'video' | 'subtitles' | 'subtitles-on' | 'lock-closed' | 'seek-backward' | 'seek-forward' | 'seek-backward-5' | 'seek-forward-5' | 'seek-backward-10' | 'seek-forward-10' | 'seek-backward-15' | 'seek-forward-15' | 'seek-backward-30' | 'seek-forward-30' | 'playback-speed' | 'picture-in-picture' | 'picture-in-picture-exit' | 'airplay' | 'airplay-active' | 'chapters' | 'fast-forward' | 'fast-backward' | 'audio-description' | 'sdh' | 'closed-captions' | 'text-size' | 'text-background';
|
|
7
|
+
export type IconName = 'play' | 'pause' | 'replay' | 'mute' | 'volume-low' | 'volume-high' | 'fullscreen' | 'fullscreen-exit' | 'quality' | 'audio' | 'video' | 'subtitles' | 'subtitles-on' | 'lock-closed' | 'seek-backward' | 'seek-forward' | 'seek-backward-5' | 'seek-forward-5' | 'seek-backward-10' | 'seek-forward-10' | 'seek-backward-15' | 'seek-forward-15' | 'seek-backward-30' | 'seek-forward-30' | 'playback-speed' | 'picture-in-picture' | 'picture-in-picture-exit' | 'airplay' | 'airplay-active' | 'cast' | 'chapters' | 'fast-forward' | 'fast-backward' | 'audio-description' | 'sdh' | 'closed-captions' | 'generated' | 'text-size' | 'text-background';
|
|
8
8
|
/** A glyph, hidden from the accessibility tree: the button it sits in carries the name. */
|
|
9
9
|
export declare function icon(name: IconName): SVGSVGElement;
|
|
10
10
|
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/controls/icons.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,OAAO,GACP,QAAQ,GACR,MAAM,GACN,YAAY,GACZ,aAAa,GACb,YAAY,GACZ,iBAAiB,GACjB,SAAS,GACT,OAAO,GACP,OAAO,GACP,WAAW,GACX,cAAc,GACd,aAAa,GACb,eAAe,GACf,cAAc,GACd,iBAAiB,GACjB,gBAAgB,GAChB,kBAAkB,GAClB,iBAAiB,GACjB,kBAAkB,GAClB,iBAAiB,GACjB,kBAAkB,GAClB,iBAAiB,GACjB,gBAAgB,GAChB,oBAAoB,GACpB,yBAAyB,GACzB,SAAS,GACT,gBAAgB,GAChB,UAAU,GACV,cAAc,GACd,eAAe,GACf,mBAAmB,GACnB,KAAK,GACL,iBAAiB,GACjB,WAAW,GACX,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/controls/icons.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,OAAO,GACP,QAAQ,GACR,MAAM,GACN,YAAY,GACZ,aAAa,GACb,YAAY,GACZ,iBAAiB,GACjB,SAAS,GACT,OAAO,GACP,OAAO,GACP,WAAW,GACX,cAAc,GACd,aAAa,GACb,eAAe,GACf,cAAc,GACd,iBAAiB,GACjB,gBAAgB,GAChB,kBAAkB,GAClB,iBAAiB,GACjB,kBAAkB,GAClB,iBAAiB,GACjB,kBAAkB,GAClB,iBAAiB,GACjB,gBAAgB,GAChB,oBAAoB,GACpB,yBAAyB,GACzB,SAAS,GACT,gBAAgB,GAChB,MAAM,GACN,UAAU,GACV,cAAc,GACd,eAAe,GACf,mBAAmB,GACnB,KAAK,GACL,iBAAiB,GACjB,WAAW,GACX,WAAW,GACX,iBAAiB,CAAC;AAkFtB,2FAA2F;AAC3F,wBAAgB,IAAI,CAAC,IAAI,EAAE,QAAQ,GAAG,aAAa,CAUlD"}
|
package/dist/controls/icons.js
CHANGED
|
@@ -34,12 +34,14 @@ const PATHS = {
|
|
|
34
34
|
"picture-in-picture-exit": "M4 6h24v20H4zM6.5 8.5v15h19v-15zM9.5 11.5L16 11.5L9.5 18zM13.63 13.87L19.29 19.52L17.52 21.29L11.87 15.63z",
|
|
35
35
|
airplay: "M4 6H28V23.25H23V20.75H25.5V8.5H6.5V20.75H9V23.25H4zM16 17.5L23.5 27L8.5 27z",
|
|
36
36
|
"airplay-active": "M4 6H28V23.25H22.1L16 15.5L9.9 23.25H4zM16 17.5L23.5 27L8.5 27z",
|
|
37
|
+
cast: "M4 6H28V26H17.5V23.5H25.5V8.5H6.5V12H4zM4 22.5A3.5 3.5 0 0 1 7.5 26H4zM4 16A10 10 0 0 1 14 26H11.5A7.5 7.5 0 0 0 4 18.5z",
|
|
37
38
|
chapters: "M5 6.5h4v4h-4zM12 7.25h15v2.5h-15zM5 14h4v4h-4zM12 14.75h15v2.5h-15zM5 21.5h4v4h-4zM12 22.25h15v2.5h-15z",
|
|
38
39
|
"fast-forward": "M4 7L15 16L4 25zM16 7L27 16L16 25z",
|
|
39
40
|
"fast-backward": "M28 7L17 16L28 25zM16 7L5 16L16 25z",
|
|
40
41
|
"audio-description": "M1.5 23L4.8 9h2.6L10.7 23H8.4l-.75-3.2H4.55L3.8 23zM5.1 17.4h2L6.1 12.9zM12.2 9h2.8a7 7 0 0 1 0 14h-2.8zM14.6 11.4v9.2h.4a4.6 4.6 0 0 0 0-9.2zM24.2 9.96A9.4 9.4 0 0 1 24.2 22.04L22.82 20.89A7.6 7.6 0 0 0 22.82 11.11zM27.11 7.52A13.2 13.2 0 0 1 27.11 24.48L25.73 23.33A11.4 11.4 0 0 0 25.73 8.67z",
|
|
41
42
|
sdh: "M9.7 13.2L10.3 10.4L11.6 8.5L13.6 7.2L16 6.8L18.7 7.3L20.8 8.6L22.2 10.6L22.7 13L22.5 14.9L21.8 16.3L20.8 17.5L19.6 18.7L18.5 19.9L17.9 21.3L17.5 22.5L17.1 23.5L16.7 24.5L16 25.2L15.2 25.6L14.3 25.7L13.3 25.6L12.6 25.1L12 24.4L11.7 23.4L9.3 24.2L9.8 25.7L10.9 27L12.5 27.9L14.3 28.3L16 28L17.6 27.2L18.7 26L19.5 24.5L19.8 23.3L20.2 22.2L20.6 21.3L21.4 20.3L22.6 19.2L23.9 17.7L24.9 15.7L25.3 13L24.6 9.5L22.6 6.7L19.6 4.9L16 4.2L12.7 4.9L9.9 6.6L7.9 9.4L7.3 12.8zM13.7 13.2L13.9 12.1L14.4 11.4L15.1 10.9L16 10.8L16.9 10.9L17.6 11.4L18.1 12.1L18.3 13.2L20.7 12.8L20.4 11.1L19.4 9.6L17.9 8.6L16 8.2L14.1 8.6L12.6 9.6L11.6 11.1L11.3 12.8z",
|
|
42
43
|
"closed-captions": "M14.24 20.24A6 6 0 1 1 14.24 11.76L12.47 13.53A3.5 3.5 0 1 0 12.47 18.47zM26.24 20.24A6 6 0 1 1 26.24 11.76L24.47 13.53A3.5 3.5 0 1 0 24.47 18.47z",
|
|
44
|
+
generated: "M13 6Q13.8 15.2 23 16Q13.8 16.8 13 26Q12.2 16.8 3 16Q12.2 15.2 13 6zM24 2Q24.4 6.6 29 7Q24.4 7.4 24 12Q23.6 7.4 19 7Q23.6 6.6 24 2z",
|
|
43
45
|
"text-size": "M2.5 23L5.9 13L8.1 13L11.5 23zM7 16.53L7.64 18.4L6.36 18.4zM5.65 20.5L8.35 20.5L9.2 23L4.8 23zM12.5 23L19.5 6L22.5 6L29.5 23zM21 9.64L23.45 15.6L18.55 15.6zM17.48 18.2L24.52 18.2L26.5 23L15.5 23z",
|
|
44
46
|
"text-background": "M4 6h24v20h-24zM9 22.5L14.6 9.5L17.4 9.5L23 22.5zM16 12.75L17.66 16.6L14.34 16.6zM13.35 18.9L18.65 18.9L20.2 22.5L11.8 22.5z"
|
|
45
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.js","names":[],"sources":["../../src/controls/icons.ts"],"sourcesContent":["/**\n * The glyphs, Mattebox's own drawings: filled paths on a 32-unit viewBox,\n * one visual weight across the set, with hard corners and 45 degree cuts\n * like the panels of the mark. Each is one path, so a glyph scales to any\n * size and takes the text colour.\n */\n\nexport type IconName =\n | 'play'\n | 'pause'\n | 'replay'\n | 'mute'\n | 'volume-low'\n | 'volume-high'\n | 'fullscreen'\n | 'fullscreen-exit'\n | 'quality'\n | 'audio'\n | 'video'\n | 'subtitles'\n | 'subtitles-on'\n | 'lock-closed'\n | 'seek-backward'\n | 'seek-forward'\n | 'seek-backward-5'\n | 'seek-forward-5'\n | 'seek-backward-10'\n | 'seek-forward-10'\n | 'seek-backward-15'\n | 'seek-forward-15'\n | 'seek-backward-30'\n | 'seek-forward-30'\n | 'playback-speed'\n | 'picture-in-picture'\n | 'picture-in-picture-exit'\n | 'airplay'\n | 'airplay-active'\n | 'chapters'\n | 'fast-forward'\n | 'fast-backward'\n | 'audio-description'\n | 'sdh'\n | 'closed-captions'\n | 'text-size'\n | 'text-background';\n\n/**\n * Each glyph's subpaths joined into one `d`. The path is drawn even-odd:\n * a frame, a ring or a letter cuts its hole with a nested subpath, and no\n * two filled subpaths overlap.\n */\nconst PATHS: Readonly<Record<IconName, string>> = {\n play: 'M9 5L26 16L9 27z',\n pause: 'M8 6h5.5v20h-5.5zM18.5 6h5.5v20h-5.5z',\n replay:\n 'M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8z',\n mute: 'M4 12L9 12L16 6L16 26L9 20L4 20zM24 17.77L20.99 20.77L19.23 19.01L22.23 16L19.23 12.99L20.99 11.23L24 14.23L27.01 11.23L28.77 12.99L25.77 16L28.77 19.01L27.01 20.77z',\n 'volume-low':\n 'M4 12L9 12L16 6L16 26L9 20L4 20zM21.13 10.87A7.25 7.25 0 0 1 21.13 21.13L19.36 19.36A4.75 4.75 0 0 0 19.36 12.64z',\n 'volume-high':\n 'M4 12L9 12L16 6L16 26L9 20L4 20zM21.13 10.87A7.25 7.25 0 0 1 21.13 21.13L19.36 19.36A4.75 4.75 0 0 0 19.36 12.64zM24.31 7.69A11.75 11.75 0 0 1 24.31 24.31L22.54 22.54A9.25 9.25 0 0 0 22.54 9.46z',\n fullscreen:\n 'M5 5L14 5L11 8L8 8L8 11L5 14zM18 5L27 5L27 14L24 11L24 8L21 8zM5 18L8 21L8 24L11 24L14 27L5 27zM27 18L27 27L18 27L21 24L24 24L24 21z',\n 'fullscreen-exit':\n 'M13 4L13 13L4 13L7 10L10 10L10 7zM19 4L22 7L22 10L25 10L28 13L19 13zM4 19L13 19L13 28L10 25L10 22L7 22zM19 19L28 19L25 22L22 22L22 25L19 28z',\n quality:\n 'M5 22L10 18.1L10 27L5 27zM13.5 15.4L18.5 11.6L18.5 27L13.5 27zM22 8.9L27 5L27 27L22 27z',\n audio:\n 'M4.75 13h2.5v6h-2.5zM9.75 9h2.5v14h-2.5zM14.75 5h2.5v22h-2.5zM19.75 10.5h2.5v11h-2.5zM24.75 13.5h2.5v5h-2.5z',\n // A camera: the body as a frame, the lens solid.\n video: 'M4 9h16v14H4zM6.5 11.5h11v9h-11zM21 14l7-4v12l-7-4z',\n subtitles:\n 'M4 6h20l4 4v16H4zM6.5 8.5H22.96L25.5 11.04V23.5H6.5zM9 14h8v2.5h-8zM19 14h4v2.5h-4zM9 18.5h4v2.5h-4zM15 18.5h8v2.5h-8z',\n 'subtitles-on':\n 'M4 6h20l4 4v16H4zM9 14h8v2.5h-8zM19 14h4v2.5h-4zM9 18.5h4v2.5h-4zM15 18.5h8v2.5h-8z',\n 'lock-closed':\n 'M7 14h18v13H7zM14.75 18.5v4.5h2.5v-4.5zM9.75 14V11A6.25 6.25 0 0 1 22.25 11V14H19.75V11A3.75 3.75 0 0 0 12.25 11V14z',\n 'seek-backward':\n 'M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8z',\n 'seek-forward':\n 'M24.88 11.88A10.25 10.25 0 1 1 16 6.75L16 9.25A7.75 7.75 0 1 0 22.71 13.12zM16 3.5L22 8L16 12.5z',\n 'seek-backward-5':\n 'M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8zM13 13.5h6v2h-6zM13 15.5h2v0.5h-2zM13 16h6v2h-6zM17 18h2v0.5h-2zM13 18.5h6v2h-6z',\n 'seek-forward-5':\n 'M24.88 11.88A10.25 10.25 0 1 1 16 6.75L16 9.25A7.75 7.75 0 1 0 22.71 13.12zM16 3.5L22 8L16 12.5zM13 13.5h6v2h-6zM13 15.5h2v0.5h-2zM13 16h6v2h-6zM17 18h2v0.5h-2zM13 18.5h6v2h-6z',\n 'seek-backward-10':\n 'M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8zM11.5 13.5h2.2v7h-2.2zM15.5 13.5h5.5v7h-5.5zM17.6 15.6v2.8h1.3v-2.8z',\n 'seek-forward-10':\n 'M24.88 11.88A10.25 10.25 0 1 1 16 6.75L16 9.25A7.75 7.75 0 1 0 22.71 13.12zM16 3.5L22 8L16 12.5zM11.5 13.5h2.2v7h-2.2zM15.5 13.5h5.5v7h-5.5zM17.6 15.6v2.8h1.3v-2.8z',\n 'seek-backward-15':\n 'M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8zM10.5 13.5h2.2v7h-2.2zM14.7 13.5h5.8v2h-5.8zM14.7 15.5h2v0.5h-2zM14.7 16h5.8v2h-5.8zM18.5 18h2v0.5h-2zM14.7 18.5h5.8v2h-5.8z',\n 'seek-forward-15':\n 'M24.88 11.88A10.25 10.25 0 1 1 16 6.75L16 9.25A7.75 7.75 0 1 0 22.71 13.12zM16 3.5L22 8L16 12.5zM10.5 13.5h2.2v7h-2.2zM14.7 13.5h5.8v2h-5.8zM14.7 15.5h2v0.5h-2zM14.7 16h5.8v2h-5.8zM18.5 18h2v0.5h-2zM14.7 18.5h5.8v2h-5.8z',\n 'seek-backward-30':\n 'M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8zM13 13.5h2v7h-2zM10 13.5h3v2h-3zM11 16h2v2h-2zM10 18.5h3v2h-3zM16.5 13.5h5.5v7h-5.5zM18.6 15.6v2.8h1.3v-2.8z',\n 'seek-forward-30':\n 'M24.88 11.88A10.25 10.25 0 1 1 16 6.75L16 9.25A7.75 7.75 0 1 0 22.71 13.12zM16 3.5L22 8L16 12.5zM13 13.5h2v7h-2zM10 13.5h3v2h-3zM11 16h2v2h-2zM10 18.5h3v2h-3zM16.5 13.5h5.5v7h-5.5zM18.6 15.6v2.8h1.3v-2.8z',\n 'playback-speed':\n 'M7.69 26.31A11.75 11.75 0 1 1 24.31 26.31L22.54 24.54A9.25 9.25 0 1 0 9.46 24.54zM16.41 20.31L21.14 11.87L13.66 17.99z',\n 'picture-in-picture': 'M4 6h24v20H4zM6.5 8.5v15h19v-15zM15 15h8v6h-8z',\n 'picture-in-picture-exit':\n 'M4 6h24v20H4zM6.5 8.5v15h19v-15zM9.5 11.5L16 11.5L9.5 18zM13.63 13.87L19.29 19.52L17.52 21.29L11.87 15.63z',\n airplay: 'M4 6H28V23.25H23V20.75H25.5V8.5H6.5V20.75H9V23.25H4zM16 17.5L23.5 27L8.5 27z',\n 'airplay-active': 'M4 6H28V23.25H22.1L16 15.5L9.9 23.25H4zM16 17.5L23.5 27L8.5 27z',\n chapters:\n 'M5 6.5h4v4h-4zM12 7.25h15v2.5h-15zM5 14h4v4h-4zM12 14.75h15v2.5h-15zM5 21.5h4v4h-4zM12 22.25h15v2.5h-15z',\n 'fast-forward': 'M4 7L15 16L4 25zM16 7L27 16L16 25z',\n 'fast-backward': 'M28 7L17 16L28 25zM16 7L5 16L16 25z',\n 'audio-description':\n 'M1.5 23L4.8 9h2.6L10.7 23H8.4l-.75-3.2H4.55L3.8 23zM5.1 17.4h2L6.1 12.9zM12.2 9h2.8a7 7 0 0 1 0 14h-2.8zM14.6 11.4v9.2h.4a4.6 4.6 0 0 0 0-9.2zM24.2 9.96A9.4 9.4 0 0 1 24.2 22.04L22.82 20.89A7.6 7.6 0 0 0 22.82 11.11zM27.11 7.52A13.2 13.2 0 0 1 27.11 24.48L25.73 23.33A11.4 11.4 0 0 0 25.73 8.67z',\n sdh: 'M9.7 13.2L10.3 10.4L11.6 8.5L13.6 7.2L16 6.8L18.7 7.3L20.8 8.6L22.2 10.6L22.7 13L22.5 14.9L21.8 16.3L20.8 17.5L19.6 18.7L18.5 19.9L17.9 21.3L17.5 22.5L17.1 23.5L16.7 24.5L16 25.2L15.2 25.6L14.3 25.7L13.3 25.6L12.6 25.1L12 24.4L11.7 23.4L9.3 24.2L9.8 25.7L10.9 27L12.5 27.9L14.3 28.3L16 28L17.6 27.2L18.7 26L19.5 24.5L19.8 23.3L20.2 22.2L20.6 21.3L21.4 20.3L22.6 19.2L23.9 17.7L24.9 15.7L25.3 13L24.6 9.5L22.6 6.7L19.6 4.9L16 4.2L12.7 4.9L9.9 6.6L7.9 9.4L7.3 12.8zM13.7 13.2L13.9 12.1L14.4 11.4L15.1 10.9L16 10.8L16.9 10.9L17.6 11.4L18.1 12.1L18.3 13.2L20.7 12.8L20.4 11.1L19.4 9.6L17.9 8.6L16 8.2L14.1 8.6L12.6 9.6L11.6 11.1L11.3 12.8z',\n 'closed-captions':\n 'M14.24 20.24A6 6 0 1 1 14.24 11.76L12.47 13.53A3.5 3.5 0 1 0 12.47 18.47zM26.24 20.24A6 6 0 1 1 26.24 11.76L24.47 13.53A3.5 3.5 0 1 0 24.47 18.47z',\n 'text-size':\n 'M2.5 23L5.9 13L8.1 13L11.5 23zM7 16.53L7.64 18.4L6.36 18.4zM5.65 20.5L8.35 20.5L9.2 23L4.8 23zM12.5 23L19.5 6L22.5 6L29.5 23zM21 9.64L23.45 15.6L18.55 15.6zM17.48 18.2L24.52 18.2L26.5 23L15.5 23z',\n 'text-background':\n 'M4 6h24v20h-24zM9 22.5L14.6 9.5L17.4 9.5L23 22.5zM16 12.75L17.66 16.6L14.34 16.6zM13.35 18.9L18.65 18.9L20.2 22.5L11.8 22.5z',\n};\n\nconst SVG = 'http://www.w3.org/2000/svg';\n\n/** A glyph, hidden from the accessibility tree: the button it sits in carries the name. */\nexport function icon(name: IconName): SVGSVGElement {\n const svg = document.createElementNS(SVG, 'svg');\n svg.setAttribute('viewBox', '0 0 32 32');\n svg.setAttribute('aria-hidden', 'true');\n svg.setAttribute('part', 'icon');\n const path = document.createElementNS(SVG, 'path');\n path.setAttribute('fill-rule', 'evenodd');\n path.setAttribute('d', PATHS[name]);\n svg.append(path);\n return svg;\n}\n"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"icons.js","names":[],"sources":["../../src/controls/icons.ts"],"sourcesContent":["/**\n * The glyphs, Mattebox's own drawings: filled paths on a 32-unit viewBox,\n * one visual weight across the set, with hard corners and 45 degree cuts\n * like the panels of the mark. Each is one path, so a glyph scales to any\n * size and takes the text colour.\n */\n\nexport type IconName =\n | 'play'\n | 'pause'\n | 'replay'\n | 'mute'\n | 'volume-low'\n | 'volume-high'\n | 'fullscreen'\n | 'fullscreen-exit'\n | 'quality'\n | 'audio'\n | 'video'\n | 'subtitles'\n | 'subtitles-on'\n | 'lock-closed'\n | 'seek-backward'\n | 'seek-forward'\n | 'seek-backward-5'\n | 'seek-forward-5'\n | 'seek-backward-10'\n | 'seek-forward-10'\n | 'seek-backward-15'\n | 'seek-forward-15'\n | 'seek-backward-30'\n | 'seek-forward-30'\n | 'playback-speed'\n | 'picture-in-picture'\n | 'picture-in-picture-exit'\n | 'airplay'\n | 'airplay-active'\n | 'cast'\n | 'chapters'\n | 'fast-forward'\n | 'fast-backward'\n | 'audio-description'\n | 'sdh'\n | 'closed-captions'\n | 'generated'\n | 'text-size'\n | 'text-background';\n\n/**\n * Each glyph's subpaths joined into one `d`. The path is drawn even-odd:\n * a frame, a ring or a letter cuts its hole with a nested subpath, and no\n * two filled subpaths overlap.\n */\nconst PATHS: Readonly<Record<IconName, string>> = {\n play: 'M9 5L26 16L9 27z',\n pause: 'M8 6h5.5v20h-5.5zM18.5 6h5.5v20h-5.5z',\n replay:\n 'M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8z',\n mute: 'M4 12L9 12L16 6L16 26L9 20L4 20zM24 17.77L20.99 20.77L19.23 19.01L22.23 16L19.23 12.99L20.99 11.23L24 14.23L27.01 11.23L28.77 12.99L25.77 16L28.77 19.01L27.01 20.77z',\n 'volume-low':\n 'M4 12L9 12L16 6L16 26L9 20L4 20zM21.13 10.87A7.25 7.25 0 0 1 21.13 21.13L19.36 19.36A4.75 4.75 0 0 0 19.36 12.64z',\n 'volume-high':\n 'M4 12L9 12L16 6L16 26L9 20L4 20zM21.13 10.87A7.25 7.25 0 0 1 21.13 21.13L19.36 19.36A4.75 4.75 0 0 0 19.36 12.64zM24.31 7.69A11.75 11.75 0 0 1 24.31 24.31L22.54 22.54A9.25 9.25 0 0 0 22.54 9.46z',\n fullscreen:\n 'M5 5L14 5L11 8L8 8L8 11L5 14zM18 5L27 5L27 14L24 11L24 8L21 8zM5 18L8 21L8 24L11 24L14 27L5 27zM27 18L27 27L18 27L21 24L24 24L24 21z',\n 'fullscreen-exit':\n 'M13 4L13 13L4 13L7 10L10 10L10 7zM19 4L22 7L22 10L25 10L28 13L19 13zM4 19L13 19L13 28L10 25L10 22L7 22zM19 19L28 19L25 22L22 22L22 25L19 28z',\n quality:\n 'M5 22L10 18.1L10 27L5 27zM13.5 15.4L18.5 11.6L18.5 27L13.5 27zM22 8.9L27 5L27 27L22 27z',\n audio:\n 'M4.75 13h2.5v6h-2.5zM9.75 9h2.5v14h-2.5zM14.75 5h2.5v22h-2.5zM19.75 10.5h2.5v11h-2.5zM24.75 13.5h2.5v5h-2.5z',\n // A camera: the body as a frame, the lens solid.\n video: 'M4 9h16v14H4zM6.5 11.5h11v9h-11zM21 14l7-4v12l-7-4z',\n subtitles:\n 'M4 6h20l4 4v16H4zM6.5 8.5H22.96L25.5 11.04V23.5H6.5zM9 14h8v2.5h-8zM19 14h4v2.5h-4zM9 18.5h4v2.5h-4zM15 18.5h8v2.5h-8z',\n 'subtitles-on':\n 'M4 6h20l4 4v16H4zM9 14h8v2.5h-8zM19 14h4v2.5h-4zM9 18.5h4v2.5h-4zM15 18.5h8v2.5h-8z',\n 'lock-closed':\n 'M7 14h18v13H7zM14.75 18.5v4.5h2.5v-4.5zM9.75 14V11A6.25 6.25 0 0 1 22.25 11V14H19.75V11A3.75 3.75 0 0 0 12.25 11V14z',\n 'seek-backward':\n 'M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8z',\n 'seek-forward':\n 'M24.88 11.88A10.25 10.25 0 1 1 16 6.75L16 9.25A7.75 7.75 0 1 0 22.71 13.12zM16 3.5L22 8L16 12.5z',\n 'seek-backward-5':\n 'M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8zM13 13.5h6v2h-6zM13 15.5h2v0.5h-2zM13 16h6v2h-6zM17 18h2v0.5h-2zM13 18.5h6v2h-6z',\n 'seek-forward-5':\n 'M24.88 11.88A10.25 10.25 0 1 1 16 6.75L16 9.25A7.75 7.75 0 1 0 22.71 13.12zM16 3.5L22 8L16 12.5zM13 13.5h6v2h-6zM13 15.5h2v0.5h-2zM13 16h6v2h-6zM17 18h2v0.5h-2zM13 18.5h6v2h-6z',\n 'seek-backward-10':\n 'M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8zM11.5 13.5h2.2v7h-2.2zM15.5 13.5h5.5v7h-5.5zM17.6 15.6v2.8h1.3v-2.8z',\n 'seek-forward-10':\n 'M24.88 11.88A10.25 10.25 0 1 1 16 6.75L16 9.25A7.75 7.75 0 1 0 22.71 13.12zM16 3.5L22 8L16 12.5zM11.5 13.5h2.2v7h-2.2zM15.5 13.5h5.5v7h-5.5zM17.6 15.6v2.8h1.3v-2.8z',\n 'seek-backward-15':\n 'M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8zM10.5 13.5h2.2v7h-2.2zM14.7 13.5h5.8v2h-5.8zM14.7 15.5h2v0.5h-2zM14.7 16h5.8v2h-5.8zM18.5 18h2v0.5h-2zM14.7 18.5h5.8v2h-5.8z',\n 'seek-forward-15':\n 'M24.88 11.88A10.25 10.25 0 1 1 16 6.75L16 9.25A7.75 7.75 0 1 0 22.71 13.12zM16 3.5L22 8L16 12.5zM10.5 13.5h2.2v7h-2.2zM14.7 13.5h5.8v2h-5.8zM14.7 15.5h2v0.5h-2zM14.7 16h5.8v2h-5.8zM18.5 18h2v0.5h-2zM14.7 18.5h5.8v2h-5.8z',\n 'seek-backward-30':\n 'M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8zM13 13.5h2v7h-2zM10 13.5h3v2h-3zM11 16h2v2h-2zM10 18.5h3v2h-3zM16.5 13.5h5.5v7h-5.5zM18.6 15.6v2.8h1.3v-2.8z',\n 'seek-forward-30':\n 'M24.88 11.88A10.25 10.25 0 1 1 16 6.75L16 9.25A7.75 7.75 0 1 0 22.71 13.12zM16 3.5L22 8L16 12.5zM13 13.5h2v7h-2zM10 13.5h3v2h-3zM11 16h2v2h-2zM10 18.5h3v2h-3zM16.5 13.5h5.5v7h-5.5zM18.6 15.6v2.8h1.3v-2.8z',\n 'playback-speed':\n 'M7.69 26.31A11.75 11.75 0 1 1 24.31 26.31L22.54 24.54A9.25 9.25 0 1 0 9.46 24.54zM16.41 20.31L21.14 11.87L13.66 17.99z',\n 'picture-in-picture': 'M4 6h24v20H4zM6.5 8.5v15h19v-15zM15 15h8v6h-8z',\n 'picture-in-picture-exit':\n 'M4 6h24v20H4zM6.5 8.5v15h19v-15zM9.5 11.5L16 11.5L9.5 18zM13.63 13.87L19.29 19.52L17.52 21.29L11.87 15.63z',\n airplay: 'M4 6H28V23.25H23V20.75H25.5V8.5H6.5V20.75H9V23.25H4zM16 17.5L23.5 27L8.5 27z',\n 'airplay-active': 'M4 6H28V23.25H22.1L16 15.5L9.9 23.25H4zM16 17.5L23.5 27L8.5 27z',\n // A screen with the cast waves in its corner: what a Chromecast plays on.\n cast: 'M4 6H28V26H17.5V23.5H25.5V8.5H6.5V12H4zM4 22.5A3.5 3.5 0 0 1 7.5 26H4zM4 16A10 10 0 0 1 14 26H11.5A7.5 7.5 0 0 0 4 18.5z',\n chapters:\n 'M5 6.5h4v4h-4zM12 7.25h15v2.5h-15zM5 14h4v4h-4zM12 14.75h15v2.5h-15zM5 21.5h4v4h-4zM12 22.25h15v2.5h-15z',\n 'fast-forward': 'M4 7L15 16L4 25zM16 7L27 16L16 25z',\n 'fast-backward': 'M28 7L17 16L28 25zM16 7L5 16L16 25z',\n 'audio-description':\n 'M1.5 23L4.8 9h2.6L10.7 23H8.4l-.75-3.2H4.55L3.8 23zM5.1 17.4h2L6.1 12.9zM12.2 9h2.8a7 7 0 0 1 0 14h-2.8zM14.6 11.4v9.2h.4a4.6 4.6 0 0 0 0-9.2zM24.2 9.96A9.4 9.4 0 0 1 24.2 22.04L22.82 20.89A7.6 7.6 0 0 0 22.82 11.11zM27.11 7.52A13.2 13.2 0 0 1 27.11 24.48L25.73 23.33A11.4 11.4 0 0 0 25.73 8.67z',\n sdh: 'M9.7 13.2L10.3 10.4L11.6 8.5L13.6 7.2L16 6.8L18.7 7.3L20.8 8.6L22.2 10.6L22.7 13L22.5 14.9L21.8 16.3L20.8 17.5L19.6 18.7L18.5 19.9L17.9 21.3L17.5 22.5L17.1 23.5L16.7 24.5L16 25.2L15.2 25.6L14.3 25.7L13.3 25.6L12.6 25.1L12 24.4L11.7 23.4L9.3 24.2L9.8 25.7L10.9 27L12.5 27.9L14.3 28.3L16 28L17.6 27.2L18.7 26L19.5 24.5L19.8 23.3L20.2 22.2L20.6 21.3L21.4 20.3L22.6 19.2L23.9 17.7L24.9 15.7L25.3 13L24.6 9.5L22.6 6.7L19.6 4.9L16 4.2L12.7 4.9L9.9 6.6L7.9 9.4L7.3 12.8zM13.7 13.2L13.9 12.1L14.4 11.4L15.1 10.9L16 10.8L16.9 10.9L17.6 11.4L18.1 12.1L18.3 13.2L20.7 12.8L20.4 11.1L19.4 9.6L17.9 8.6L16 8.2L14.1 8.6L12.6 9.6L11.6 11.1L11.3 12.8z',\n 'closed-captions':\n 'M14.24 20.24A6 6 0 1 1 14.24 11.76L12.47 13.53A3.5 3.5 0 1 0 12.47 18.47zM26.24 20.24A6 6 0 1 1 26.24 11.76L24.47 13.53A3.5 3.5 0 1 0 24.47 18.47z',\n // Sparkles: words a machine made, not a person.\n generated:\n 'M13 6Q13.8 15.2 23 16Q13.8 16.8 13 26Q12.2 16.8 3 16Q12.2 15.2 13 6zM24 2Q24.4 6.6 29 7Q24.4 7.4 24 12Q23.6 7.4 19 7Q23.6 6.6 24 2z',\n 'text-size':\n 'M2.5 23L5.9 13L8.1 13L11.5 23zM7 16.53L7.64 18.4L6.36 18.4zM5.65 20.5L8.35 20.5L9.2 23L4.8 23zM12.5 23L19.5 6L22.5 6L29.5 23zM21 9.64L23.45 15.6L18.55 15.6zM17.48 18.2L24.52 18.2L26.5 23L15.5 23z',\n 'text-background':\n 'M4 6h24v20h-24zM9 22.5L14.6 9.5L17.4 9.5L23 22.5zM16 12.75L17.66 16.6L14.34 16.6zM13.35 18.9L18.65 18.9L20.2 22.5L11.8 22.5z',\n};\n\nconst SVG = 'http://www.w3.org/2000/svg';\n\n/** A glyph, hidden from the accessibility tree: the button it sits in carries the name. */\nexport function icon(name: IconName): SVGSVGElement {\n const svg = document.createElementNS(SVG, 'svg');\n svg.setAttribute('viewBox', '0 0 32 32');\n svg.setAttribute('aria-hidden', 'true');\n svg.setAttribute('part', 'icon');\n const path = document.createElementNS(SVG, 'path');\n path.setAttribute('fill-rule', 'evenodd');\n path.setAttribute('d', PATHS[name]);\n svg.append(path);\n return svg;\n}\n"],"mappings":";;;;;;AAqDA,MAAM,QAA4C;CAChD,MAAM;CACN,OAAO;CACP,QACE;CACF,MAAM;CACN,cACE;CACF,eACE;CACF,YACE;CACF,mBACE;CACF,SACE;CACF,OACE;CAEF,OAAO;CACP,WACE;CACF,gBACE;CACF,eACE;CACF,iBACE;CACF,gBACE;CACF,mBACE;CACF,kBACE;CACF,oBACE;CACF,mBACE;CACF,oBACE;CACF,mBACE;CACF,oBACE;CACF,mBACE;CACF,kBACE;CACF,sBAAsB;CACtB,2BACE;CACF,SAAS;CACT,kBAAkB;CAElB,MAAM;CACN,UACE;CACF,gBAAgB;CAChB,iBAAiB;CACjB,qBACE;CACF,KAAK;CACL,mBACE;CAEF,WACE;CACF,aACE;CACF,mBACE;AACJ;AAEA,MAAM,MAAM;;AAGZ,SAAgB,KAAK,MAA+B;CAClD,MAAM,MAAM,SAAS,gBAAgB,KAAK,KAAK;CAC/C,IAAI,aAAa,WAAW,WAAW;CACvC,IAAI,aAAa,eAAe,MAAM;CACtC,IAAI,aAAa,QAAQ,MAAM;CAC/B,MAAM,OAAO,SAAS,gBAAgB,KAAK,MAAM;CACjD,KAAK,aAAa,aAAa,SAAS;CACxC,KAAK,aAAa,KAAK,MAAM,KAAK;CAClC,IAAI,OAAO,IAAI;CACf,OAAO;AACT"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
function nativeTracks(player, name) {
|
|
8
8
|
const session = player.player?.session;
|
|
9
9
|
if (session == null || session.engine !== null) return void 0;
|
|
10
|
-
const list = player.
|
|
10
|
+
const list = player.media[name];
|
|
11
11
|
return list === void 0 ? void 0 : Array.from(list);
|
|
12
12
|
}
|
|
13
13
|
/** Calls `tick` when the video's list of `name` changes, and answers the unsubscribe. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-tracks.js","names":[],"sources":["../../src/controls/native-tracks.ts"],"sourcesContent":["/**\n * The element's own track lists, for the audio, subtitles and video menus\n * of a native session. Safari lists the renditions of an HLS stream it\n * plays itself in `audioTracks`, `textTracks` and `videoTracks`. No\n * engine-shaped object goes over them: the menus read the lists and write\n * `enabled`, `mode` and `selected`.\n * Each list is feature-tested, so a browser without it keeps the menu hidden.\n */\nimport type { PlayerHost } from '../host.js';\n\n/** What the menus read of an `AudioTrack`, a `TextTrack` or a `VideoTrack`. */\nexport interface NativeTrack {\n readonly kind: string;\n readonly label: string;\n readonly language: string;\n}\n\n/** An `AudioTrackList` or a `TextTrackList`. lib.dom has no `AudioTrackList`. */\nexport interface NativeTrackList<T extends NativeTrack> extends EventTarget {\n readonly length: number;\n readonly [index: number]: T;\n}\n\n/**\n * The video's `audioTracks` or `textTracks` during a native session, or\n * undefined: an engine session has its own tracks, and Chromium has no\n * `audioTracks` without a flag.\n */\nexport function nativeTracks<T extends NativeTrack>(\n player: PlayerHost,\n name: 'audioTracks' | 'textTracks' | 'videoTracks',\n): T[] | undefined {\n const session = player.player?.session;\n if (session == null || session.engine !== null) return undefined;\n const list = (player.
|
|
1
|
+
{"version":3,"file":"native-tracks.js","names":[],"sources":["../../src/controls/native-tracks.ts"],"sourcesContent":["/**\n * The element's own track lists, for the audio, subtitles and video menus\n * of a native session. Safari lists the renditions of an HLS stream it\n * plays itself in `audioTracks`, `textTracks` and `videoTracks`. No\n * engine-shaped object goes over them: the menus read the lists and write\n * `enabled`, `mode` and `selected`.\n * Each list is feature-tested, so a browser without it keeps the menu hidden.\n */\nimport type { PlayerHost } from '../host.js';\n\n/** What the menus read of an `AudioTrack`, a `TextTrack` or a `VideoTrack`. */\nexport interface NativeTrack {\n readonly kind: string;\n readonly label: string;\n readonly language: string;\n}\n\n/** An `AudioTrackList` or a `TextTrackList`. lib.dom has no `AudioTrackList`. */\nexport interface NativeTrackList<T extends NativeTrack> extends EventTarget {\n readonly length: number;\n readonly [index: number]: T;\n}\n\n/**\n * The video's `audioTracks` or `textTracks` during a native session, or\n * undefined: an engine session has its own tracks, and Chromium has no\n * `audioTracks` without a flag.\n */\nexport function nativeTracks<T extends NativeTrack>(\n player: PlayerHost,\n name: 'audioTracks' | 'textTracks' | 'videoTracks',\n): T[] | undefined {\n const session = player.player?.session;\n if (session == null || session.engine !== null) return undefined;\n const list = (player.media as unknown as Record<string, NativeTrackList<T> | undefined>)[name];\n return list === undefined ? undefined : Array.from(list);\n}\n\n/** Calls `tick` when the video's list of `name` changes, and answers the unsubscribe. */\nexport function onNativeTracks(\n video: HTMLVideoElement,\n name: 'audioTracks' | 'textTracks' | 'videoTracks',\n tick: () => void,\n): (() => void) | undefined {\n const list = (video as unknown as Record<string, EventTarget | undefined>)[name];\n if (list === undefined) return undefined;\n const events = ['change', 'addtrack', 'removetrack'];\n for (const event of events) list.addEventListener(event, tick);\n return () => {\n for (const event of events) list.removeEventListener(event, tick);\n };\n}\n"],"mappings":";;;;;;AA4BA,SAAgB,aACd,QACA,MACiB;CACjB,MAAM,UAAU,OAAO,QAAQ;CAC/B,IAAI,WAAW,QAAQ,QAAQ,WAAW,MAAM,OAAO,KAAA;CACvD,MAAM,OAAQ,OAAO,MAAoE;CACzF,OAAO,SAAS,KAAA,IAAY,KAAA,IAAY,MAAM,KAAK,IAAI;AACzD;;AAGA,SAAgB,eACd,OACA,MACA,MAC0B;CAC1B,MAAM,OAAQ,MAA6D;CAC3E,IAAI,SAAS,KAAA,GAAW,OAAO,KAAA;CAC/B,MAAM,SAAS;EAAC;EAAU;EAAY;CAAa;CACnD,KAAK,MAAM,SAAS,QAAQ,KAAK,iBAAiB,OAAO,IAAI;CAC7D,aAAa;EACX,KAAK,MAAM,SAAS,QAAQ,KAAK,oBAAoB,OAAO,IAAI;CAClE;AACF"}
|
package/dist/element-entry.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export type { Connector, ConnectorSource, Programme, ProgrammeMetadata, Programm
|
|
|
2
2
|
export type { MatteboxPlayerOptions } from './element.js';
|
|
3
3
|
export { MatteboxPlayerElement } from './element.js';
|
|
4
4
|
export type { Block, PlayerAddon, PlayerHost } from './host.js';
|
|
5
|
+
export type { CastOptions, CastTarget, Ranges, Remote, RemoteLoad, RemoteMedia, TextFile, } from './remote.js';
|
|
5
6
|
export type { Text } from './text.js';
|
|
6
7
|
export type { Tracker, Trackers } from './trackers.js';
|
|
7
8
|
//# sourceMappingURL=element-entry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-entry.d.ts","sourceRoot":"","sources":["../src/element-entry.ts"],"names":[],"mappings":"AAOA,YAAY,EACV,SAAS,EACT,eAAe,EACf,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,MAAM,EACN,SAAS,GACV,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAChE,YAAY,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"element-entry.d.ts","sourceRoot":"","sources":["../src/element-entry.ts"],"names":[],"mappings":"AAOA,YAAY,EACV,SAAS,EACT,eAAe,EACf,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,MAAM,EACN,SAAS,GACV,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAChE,YAAY,EACV,WAAW,EACX,UAAU,EACV,MAAM,EACN,MAAM,EACN,UAAU,EACV,WAAW,EACX,QAAQ,GACT,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-entry.js","names":[],"sources":["../src/element-entry.ts"],"sourcesContent":["/**\n * `@mattebox/player/element`: registers <mattebox-player> and nothing else.\n * A page that takes this entry writes its own composition from the\n * `@mattebox/player/elements/*` entries it imports, and carries only those.\n */\nimport { MatteboxPlayerElement } from './element.js';\n\nexport type {\n Connector,\n ConnectorSource,\n Programme,\n ProgrammeMetadata,\n ProgrammeSource,\n Resolution,\n Source,\n SourceDrm,\n} from '@mattebox/player-core';\nexport type { MatteboxPlayerOptions } from './element.js';\nexport { MatteboxPlayerElement } from './element.js';\nexport type { Block, PlayerAddon, PlayerHost } from './host.js';\nexport type { Text } from './text.js';\nexport type { Tracker, Trackers } from './trackers.js';\n\nMatteboxPlayerElement.define();\n"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"element-entry.js","names":[],"sources":["../src/element-entry.ts"],"sourcesContent":["/**\n * `@mattebox/player/element`: registers <mattebox-player> and nothing else.\n * A page that takes this entry writes its own composition from the\n * `@mattebox/player/elements/*` entries it imports, and carries only those.\n */\nimport { MatteboxPlayerElement } from './element.js';\n\nexport type {\n Connector,\n ConnectorSource,\n Programme,\n ProgrammeMetadata,\n ProgrammeSource,\n Resolution,\n Source,\n SourceDrm,\n} from '@mattebox/player-core';\nexport type { MatteboxPlayerOptions } from './element.js';\nexport { MatteboxPlayerElement } from './element.js';\nexport type { Block, PlayerAddon, PlayerHost } from './host.js';\nexport type {\n CastOptions,\n CastTarget,\n Ranges,\n Remote,\n RemoteLoad,\n RemoteMedia,\n TextFile,\n} from './remote.js';\nexport type { Text } from './text.js';\nexport type { Tracker, Trackers } from './trackers.js';\n\nMatteboxPlayerElement.define();\n"],"mappings":";;;;;;;AAgCA,sBAAsB,OAAO"}
|
package/dist/element.d.ts
CHANGED
|
@@ -17,14 +17,16 @@
|
|
|
17
17
|
* them into runtime helpers, and the emit check bans helpers. Statics are
|
|
18
18
|
* getters and instance state is declared, then assigned in the constructor.
|
|
19
19
|
*/
|
|
20
|
-
import type { Connector, Handler, Player, PlayerError, Programme, ProgrammeSource, Session, Source, SourceVideoTrack } from '@mattebox/player-core';
|
|
20
|
+
import type { Connector, Handler, Player, PlayerError, Programme, ProgrammeSource, Projection, Session, Source, SourceVideoTrack } from '@mattebox/player-core';
|
|
21
21
|
import type { KernelConfig, Mattebox, Stage } from 'mattebox';
|
|
22
22
|
import type { AttachEmeOptions } from 'mattebox/eme';
|
|
23
23
|
import { type BreakMarks } from './controls/breaks.js';
|
|
24
|
+
import { type Chapter } from './controls/chapters.js';
|
|
24
25
|
import type { Marker, Markers } from './controls/markers.js';
|
|
25
26
|
import type { Block, PlayerAddon, PlayerHost } from './host.js';
|
|
26
27
|
import type { LocaleSource } from './locales.js';
|
|
27
28
|
import type { Messages } from './messages.js';
|
|
29
|
+
import type { CastOptions, CastTarget, Remote } from './remote.js';
|
|
28
30
|
import type { Tracker, Trackers } from './trackers.js';
|
|
29
31
|
/**
|
|
30
32
|
* What the element dispatches. `error` is also a standard DOM event name, so
|
|
@@ -33,6 +35,8 @@ import type { Tracker, Trackers } from './trackers.js';
|
|
|
33
35
|
*/
|
|
34
36
|
export interface MatteboxPlayerEventMap {
|
|
35
37
|
sourcechange: CustomEvent<Session | null>;
|
|
38
|
+
/** A device plays in the video's place, or stopped: the target, or null. */
|
|
39
|
+
castingchange: CustomEvent<CastTarget | null>;
|
|
36
40
|
/** The size tier changed: `compact`, `regular` or `wide`. */
|
|
37
41
|
layoutchange: CustomEvent<string>;
|
|
38
42
|
error: CustomEvent<PlayerError>;
|
|
@@ -110,7 +114,9 @@ export declare class MatteboxPlayerElement extends HTMLElement implements Player
|
|
|
110
114
|
* is defined waits for the definition.
|
|
111
115
|
*/
|
|
112
116
|
static define(options?: MatteboxPlayerOptions): void;
|
|
113
|
-
private readonly
|
|
117
|
+
private readonly node;
|
|
118
|
+
/** `player.media`: the video, or the device that plays in its place. */
|
|
119
|
+
private readonly playback;
|
|
114
120
|
/** Wraps the slot: the picture, and the controls over it or under it. */
|
|
115
121
|
private readonly stage;
|
|
116
122
|
/** Whether the element gave itself a tabindex for the bar, to take back with it. */
|
|
@@ -164,6 +170,18 @@ export declare class MatteboxPlayerElement extends HTMLElement implements Player
|
|
|
164
170
|
private offs;
|
|
165
171
|
/** Where `interrupt` left the programme: its time, whether it played, its tracks. */
|
|
166
172
|
private interruption;
|
|
173
|
+
/** The device a cast package handed over with `cast()`, or null. */
|
|
174
|
+
private device;
|
|
175
|
+
/** The device plays in the video's place: the playback members are its own, and the video stays paused. */
|
|
176
|
+
private away;
|
|
177
|
+
/** Ends the cast that runs. */
|
|
178
|
+
private uncast;
|
|
179
|
+
/** The device that plays, for the `casting` attribute: the remote's target, or AirPlay's. */
|
|
180
|
+
private target;
|
|
181
|
+
/** The position and play state the next session takes to the device, set by a switch. */
|
|
182
|
+
private handoff;
|
|
183
|
+
/** The session was live when the engine was suspended. A suspended engine no longer says. */
|
|
184
|
+
private frozenLive;
|
|
167
185
|
/** The add-ons attached to this player, with what each returned, run when it leaves the page. */
|
|
168
186
|
private attached;
|
|
169
187
|
/** Everything the element does to the player runs here, so it runs in order. */
|
|
@@ -181,8 +199,18 @@ export declare class MatteboxPlayerElement extends HTMLElement implements Player
|
|
|
181
199
|
/** Ends the hold of a switch: the poster and `switching` go back. Null without one. */
|
|
182
200
|
private held;
|
|
183
201
|
constructor(options?: MatteboxPlayerOptions);
|
|
184
|
-
/**
|
|
185
|
-
|
|
202
|
+
/**
|
|
203
|
+
* What plays: the video, with everything the browser already does. While
|
|
204
|
+
* a device plays in its place, the playback members are the device's.
|
|
205
|
+
* A proxy and not the node: a page that needs the node reads the
|
|
206
|
+
* `<video>` child of the player.
|
|
207
|
+
*/
|
|
208
|
+
get media(): HTMLVideoElement;
|
|
209
|
+
/**
|
|
210
|
+
* The programme's chapters, in order: the engine's when its session holds
|
|
211
|
+
* some, else the video's chapters track. Read again on each access.
|
|
212
|
+
*/
|
|
213
|
+
get chapters(): readonly Chapter[];
|
|
186
214
|
/** The ranges the page named in this source: credits to skip, parts that must not play. */
|
|
187
215
|
get markers(): Markers;
|
|
188
216
|
/** Where the programme's ad breaks are, which the seek bar draws: each add-on gives its own. */
|
|
@@ -251,6 +279,12 @@ export declare class MatteboxPlayerElement extends HTMLElement implements Player
|
|
|
251
279
|
private queued;
|
|
252
280
|
/** The other versions of the picture the source names at their own URLs, for the video menu. */
|
|
253
281
|
get videoSources(): readonly SourceVideoTrack[];
|
|
282
|
+
/**
|
|
283
|
+
* How the playing picture maps onto a sphere, for 360° video: the
|
|
284
|
+
* source's `projection`, else the manifest's, else null for a flat one.
|
|
285
|
+
* A version of `videoSources` is flat.
|
|
286
|
+
*/
|
|
287
|
+
get projection(): Projection | null;
|
|
254
288
|
/** The version of `videoSources` that plays, or null for the source itself. */
|
|
255
289
|
get videoSource(): SourceVideoTrack | null;
|
|
256
290
|
/**
|
|
@@ -267,6 +301,30 @@ export declare class MatteboxPlayerElement extends HTMLElement implements Player
|
|
|
267
301
|
* before, so the controls show that state through the load.
|
|
268
302
|
*/
|
|
269
303
|
private swap;
|
|
304
|
+
/** The device that plays in the video's place, its kind and its name, or null. The `casting` attribute carries the kind. */
|
|
305
|
+
get casting(): CastTarget | null;
|
|
306
|
+
/**
|
|
307
|
+
* Hands playback to a device, for a cast package. From here `media`
|
|
308
|
+
* reads the device for the members `remote.media` has, the video stays
|
|
309
|
+
* paused, and every load goes to the device. Returns the function that
|
|
310
|
+
* ends the cast: the video takes the device's position and play state
|
|
311
|
+
* back, with no new load. A second call ends the cast before it.
|
|
312
|
+
*/
|
|
313
|
+
cast(remote: Remote, options?: CastOptions): () => void;
|
|
314
|
+
/**
|
|
315
|
+
* Where the video is, for a device: seconds on demand, and for live null
|
|
316
|
+
* at the edge or the clock time behind it. Read before the engine is
|
|
317
|
+
* suspended, which no longer says where the edge is.
|
|
318
|
+
*/
|
|
319
|
+
private position;
|
|
320
|
+
/** Pauses the video and stops the engine's requests. The source stays loaded, for the chapters and the thumbnails. */
|
|
321
|
+
private freeze;
|
|
322
|
+
/** The device plays `source` in the video's place: the programme's own, or one that interrupts it. */
|
|
323
|
+
private hand;
|
|
324
|
+
/** The subtitle and caption files the page gave the video as `<track>` children. */
|
|
325
|
+
private textFiles;
|
|
326
|
+
/** Sets the device that plays: the `casting` attribute carries its kind, and `castingchange` the target. */
|
|
327
|
+
private aim;
|
|
270
328
|
/** The core, or null until the first source has been set up: resolving a preset is asynchronous. */
|
|
271
329
|
get player(): Player | null;
|
|
272
330
|
/** The engine feeding the video, or null for a native session and before the first load. */
|
|
@@ -352,7 +410,7 @@ export declare class MatteboxPlayerElement extends HTMLElement implements Player
|
|
|
352
410
|
*/
|
|
353
411
|
private mode;
|
|
354
412
|
/** Hands the `chapters` attribute to the engine, or keeps a hidden chapters track on the video for it. */
|
|
355
|
-
private
|
|
413
|
+
private chaptersAttribute;
|
|
356
414
|
private forward;
|
|
357
415
|
private enqueue;
|
|
358
416
|
/**
|
|
@@ -373,6 +431,11 @@ export declare class MatteboxPlayerElement extends HTMLElement implements Player
|
|
|
373
431
|
/** Sets a session up. It runs for every session, the one that replaces a failed source included. */
|
|
374
432
|
private adopt;
|
|
375
433
|
private ensure;
|
|
434
|
+
/**
|
|
435
|
+
* An add-on or an element inside the player needs the engine, so Safari's
|
|
436
|
+
* own HLS is not the default. Read at each load: an element may come later.
|
|
437
|
+
*/
|
|
438
|
+
private needsEngine;
|
|
376
439
|
/**
|
|
377
440
|
* Read at each use, not once in the constructor. Importing the package
|
|
378
441
|
* registers the element, and the parser's elements are constructed then,
|
package/dist/element.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,OAAO,EACP,MAAM,EACN,WAAW,EACX,SAAS,EACT,eAAe,EACf,OAAO,EACP,MAAM,EACN,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGrD,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,sBAAsB,CAAC;AACzE,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"element.d.ts","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