@mattebox/player 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/mattebox-player.min.js +3 -3
- package/dist/controls/icons.d.ts +5 -28
- package/dist/controls/icons.d.ts.map +1 -1
- package/dist/controls/icons.js +38 -29
- package/dist/controls/icons.js.map +1 -1
- package/dist/controls/markers.d.ts +39 -0
- package/dist/controls/markers.d.ts.map +1 -0
- package/dist/controls/markers.js +38 -0
- package/dist/controls/markers.js.map +1 -0
- package/dist/controls/menu.d.ts +14 -2
- package/dist/controls/menu.d.ts.map +1 -1
- package/dist/controls/menu.js +50 -4
- package/dist/controls/menu.js.map +1 -1
- package/dist/controls/native-tracks.d.ts +28 -0
- package/dist/controls/native-tracks.d.ts.map +1 -0
- package/dist/controls/native-tracks.js +30 -0
- package/dist/controls/native-tracks.js.map +1 -0
- package/dist/controls/quality-names.d.ts +15 -0
- package/dist/controls/quality-names.d.ts.map +1 -0
- package/dist/controls/quality-names.js +62 -0
- package/dist/controls/quality-names.js.map +1 -0
- package/dist/controls/track-names.d.ts +40 -0
- package/dist/controls/track-names.d.ts.map +1 -0
- package/dist/controls/track-names.js +59 -0
- package/dist/controls/track-names.js.map +1 -0
- package/dist/element.d.ts +60 -2
- package/dist/element.d.ts.map +1 -1
- package/dist/element.js +182 -23
- package/dist/element.js.map +1 -1
- package/dist/elements/audio-menu.d.ts +19 -8
- package/dist/elements/audio-menu.d.ts.map +1 -1
- package/dist/elements/audio-menu.js +60 -19
- package/dist/elements/audio-menu.js.map +1 -1
- package/dist/elements/component.d.ts.map +1 -1
- package/dist/elements/component.js +10 -0
- package/dist/elements/component.js.map +1 -1
- package/dist/elements/control-bar.d.ts +2 -0
- package/dist/elements/control-bar.d.ts.map +1 -1
- package/dist/elements/control-bar.js +23 -7
- package/dist/elements/control-bar.js.map +1 -1
- package/dist/elements/current-time.d.ts.map +1 -1
- package/dist/elements/current-time.js +1 -1
- package/dist/elements/current-time.js.map +1 -1
- package/dist/elements/drm-badge.d.ts +3 -2
- package/dist/elements/drm-badge.d.ts.map +1 -1
- package/dist/elements/drm-badge.js +11 -9
- package/dist/elements/drm-badge.js.map +1 -1
- package/dist/elements/duration.d.ts.map +1 -1
- package/dist/elements/duration.js +6 -2
- package/dist/elements/duration.js.map +1 -1
- package/dist/elements/error-screen.js +1 -1
- package/dist/elements/live-button.js +1 -1
- package/dist/elements/marker-button.d.ts +22 -0
- package/dist/elements/marker-button.d.ts.map +1 -0
- package/dist/elements/marker-button.js +95 -0
- package/dist/elements/marker-button.js.map +1 -0
- package/dist/elements/quality-menu.d.ts +4 -0
- package/dist/elements/quality-menu.d.ts.map +1 -1
- package/dist/elements/quality-menu.js +22 -8
- package/dist/elements/quality-menu.js.map +1 -1
- package/dist/elements/scan-button.js +1 -1
- package/dist/elements/seek-bar.d.ts +6 -1
- package/dist/elements/seek-bar.d.ts.map +1 -1
- package/dist/elements/seek-bar.js +37 -25
- package/dist/elements/seek-bar.js.map +1 -1
- package/dist/elements/shared.js +3 -3
- package/dist/elements/skip-button.js +2 -2
- package/dist/elements/skip-button.js.map +1 -1
- package/dist/elements/spinner.js +1 -1
- package/dist/elements/start-button.d.ts +5 -0
- package/dist/elements/start-button.d.ts.map +1 -1
- package/dist/elements/start-button.js +15 -2
- package/dist/elements/start-button.js.map +1 -1
- package/dist/elements/subtitles-menu.d.ts +7 -1
- package/dist/elements/subtitles-menu.d.ts.map +1 -1
- package/dist/elements/subtitles-menu.js +62 -20
- package/dist/elements/subtitles-menu.js.map +1 -1
- package/dist/elements/title.d.ts.map +1 -1
- package/dist/elements/title.js +3 -1
- package/dist/elements/title.js.map +1 -1
- package/dist/elements/volume-slider.js +1 -1
- package/dist/elements/volume.js +1 -1
- package/dist/entries/marker-button.d.ts +5 -0
- package/dist/entries/marker-button.d.ts.map +1 -0
- package/dist/entries/marker-button.js +9 -0
- package/dist/entries/marker-button.js.map +1 -0
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/asyncToGenerator.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/defineProperty.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/objectSpread2.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/toPrimitive.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/toPropertyKey.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/typeof.js +1 -1
- package/dist/es2015/controls/chapters.js +1 -1
- package/dist/es2015/controls/icons.js +38 -29
- package/dist/es2015/controls/markers.js +36 -0
- package/dist/es2015/controls/menu.js +52 -5
- package/dist/es2015/controls/native-tracks.js +29 -0
- package/dist/es2015/controls/quality-names.js +67 -0
- package/dist/es2015/controls/track-names.js +57 -0
- package/dist/es2015/element.js +185 -29
- package/dist/es2015/elements/audio-menu.js +66 -20
- package/dist/es2015/elements/component.js +10 -0
- package/dist/es2015/elements/control-bar.js +23 -7
- package/dist/es2015/elements/current-time.js +1 -1
- package/dist/es2015/elements/drm-badge.js +12 -9
- package/dist/es2015/elements/duration.js +6 -2
- package/dist/es2015/elements/error-screen.js +1 -1
- package/dist/es2015/elements/live-button.js +1 -1
- package/dist/es2015/elements/marker-button.js +96 -0
- package/dist/es2015/elements/quality-menu.js +23 -8
- package/dist/es2015/elements/scan-button.js +1 -1
- package/dist/es2015/elements/seek-bar.js +42 -29
- package/dist/es2015/elements/shared.js +3 -3
- package/dist/es2015/elements/skip-button.js +2 -2
- package/dist/es2015/elements/spinner.js +1 -1
- package/dist/es2015/elements/start-button.js +15 -2
- package/dist/es2015/elements/subtitles-menu.js +72 -26
- package/dist/es2015/elements/title.js +3 -1
- package/dist/es2015/elements/volume-slider.js +1 -1
- package/dist/es2015/elements/volume.js +1 -1
- package/dist/es2015/entries/marker-button.js +7 -0
- package/dist/es2015/index.js +3 -1
- package/dist/es2015/presets.js +1 -1
- package/dist/es2015/style.js +1 -1
- package/dist/es2015/tags.js +2 -1
- package/dist/host.d.ts +3 -0
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/style.js +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 +4 -5
- package/NOTICE +0 -24
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subtitles-menu.js","names":[],"sources":["../../src/elements/subtitles-menu.ts"],"sourcesContent":["/**\n * <mbx-subtitles-menu>: the text track over `engine.tracks`, with \"off\"\n * because a text selection is releasable and an audio one is not, and a\n * Settings page behind it with the size and the background. The glyph\n * says whether a track is on: `icon` or `icon-on`. Hidden without text\n * tracks, and for a native session.\n *\n * The looks are attributes on the player, `subtitle-size` and\n * `subtitle-background`, where the element's stylesheet turns them into\n * the cue rules; a page can set them in markup and persist them however\n * it likes. Every word the menu shows is an attribute: `label`,\n * `label-off`, `label-track`, `label-settings`, `label-size`,\n * `label-background`, one per size and one per background.\n */\nimport type { Mattebox } from 'mattebox';\nimport { icon } from '../controls/icons.js';\nimport type { MenuGroup } from '../controls/menu.js';\nimport type { PlayerHost } from '../host.js';\nimport { onTracks, trackItems } from './audio-menu.js';\nimport { MenuElement } from './menu-element.js';\nimport { show } from './shared.js';\n\nconst OFF = 'off';\nexport const SUBTITLE_SIZE = 'subtitle-size';\nexport const SUBTITLE_BACKGROUND = 'subtitle-background';\n\nconst SIZES: ReadonlyArray<readonly [string, string]> = [\n ['small', 'Small'],\n ['medium', 'Medium'],\n ['large', 'Large'],\n ['xlarge', 'Extra large'],\n];\nconst BACKGROUNDS: ReadonlyArray<readonly [string, string]> = [\n ['none', 'None'],\n ['dark', 'Dark'],\n ['solid', 'Solid'],\n];\n\ntype State = 'off' | 'on';\nconst STATES: readonly State[] = ['off', 'on'];\n\nexport class MbxSubtitlesMenu extends MenuElement<State> {\n static get observedAttributes(): readonly string[] {\n return [\n 'label',\n 'label-back',\n 'label-off',\n 'label-track',\n 'label-settings',\n 'label-size',\n 'label-background',\n ...SIZES.map(([id]) => `label-${id}`),\n ...BACKGROUNDS.map(([id]) => `label-${id}`),\n ];\n }\n\n declare private engine: Mattebox | null;\n\n constructor() {\n super(STATES, (state) => icon(state === 'on' ? 'closed-captions-on' : 'closed-captions'));\n this.engine = null;\n show(this.slots, 'off');\n }\n\n protected override name(): string {\n return 'Subtitles';\n }\n\n /** A look's group: the choices named from the attributes, the value from the player's. */\n private looks(\n player: PlayerHost,\n attribute: string,\n name: string,\n fallback: string,\n choices: ReadonlyArray<readonly [string, string]>,\n initial: string,\n ): MenuGroup {\n const set = player.getAttribute(attribute);\n const value = set !== null && choices.some(([id]) => id === set) ? set : initial;\n return {\n name,\n label: this.getAttribute(`label-${name}`) ?? fallback,\n items: choices.map(([id, text]) => [id, this.getAttribute(`label-${id}`) ?? text]),\n value,\n onSelect: (chosen) => {\n player.setAttribute(attribute, chosen);\n this.render();\n },\n };\n }\n\n protected override attach(player: PlayerHost): void {\n this.follow(player, (engine) => {\n this.engine = engine;\n this.render();\n if (engine === null) return undefined;\n return onTracks(engine, () => {\n this.render();\n });\n });\n }\n\n protected override render(): void {\n super.render();\n const engine = this.engine;\n const player = this.player;\n if (engine === null || player === null) {\n this.hidden = true;\n return;\n }\n const [tracks, active] = trackItems(engine, 'text');\n const items: Array<readonly [string, string]> = [\n [OFF, this.getAttribute('label-off') ?? 'Off'],\n ...tracks,\n ];\n this.menu.fill([\n {\n name: 'track',\n label: this.getAttribute('label-track') ?? 'Track',\n items,\n value: active ?? OFF,\n onSelect: (value) => {\n if (value === OFF) engine.tracks.deselect('text');\n else engine.tracks.select(value);\n this.render();\n },\n },\n {\n name: 'settings',\n label: this.getAttribute('label-settings') ?? 'Settings',\n entries: [\n this.looks(player, SUBTITLE_SIZE, 'size', 'Size', SIZES, 'medium'),\n this.looks(player, SUBTITLE_BACKGROUND, 'background', 'Background', BACKGROUNDS, 'dark'),\n ],\n },\n ]);\n show(this.slots, active === null ? 'off' : 'on');\n this.hidden = tracks.length === 0;\n }\n}\n"],"mappings":";;;;;AAsBA,MAAM,MAAM;AACZ,MAAa,gBAAgB;AAC7B,MAAa,sBAAsB;AAEnC,MAAM,QAAkD;CACtD,CAAC,SAAS,OAAO;CACjB,CAAC,UAAU,QAAQ;CACnB,CAAC,SAAS,OAAO;CACjB,CAAC,UAAU,aAAa;AAC1B;AACA,MAAM,cAAwD;CAC5D,CAAC,QAAQ,MAAM;CACf,CAAC,QAAQ,MAAM;CACf,CAAC,SAAS,OAAO;AACnB;AAGA,MAAM,SAA2B,CAAC,OAAO,IAAI;AAE7C,IAAa,mBAAb,cAAsC,YAAmB;CACvD,WAAW,qBAAwC;EACjD,OAAO;GACL;GACA;GACA;GACA;GACA;GACA;GACA;GACA,GAAG,MAAM,KAAK,CAAC,QAAQ,SAAS,IAAI;GACpC,GAAG,YAAY,KAAK,CAAC,QAAQ,SAAS,IAAI;EAC5C;CACF;CAIA,cAAc;EACZ,MAAM,SAAS,UAAU,KAAK,UAAU,OAAO,uBAAuB,iBAAiB,CAAC;EACxF,KAAK,SAAS;EACd,KAAK,KAAK,OAAO,KAAK;CACxB;CAEA,OAAkC;EAChC,OAAO;CACT;;CAGA,MACE,QACA,WACA,MACA,UACA,SACA,SACW;EACX,MAAM,MAAM,OAAO,aAAa,SAAS;EACzC,MAAM,QAAQ,QAAQ,QAAQ,QAAQ,MAAM,CAAC,QAAQ,OAAO,GAAG,IAAI,MAAM;EACzE,OAAO;GACL;GACA,OAAO,KA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les-menu.js","names":[],"sources":["../../src/elements/subtitles-menu.ts"],"sourcesContent":["/**\n * <mbx-subtitles-menu>: the text track over `engine.tracks`, or over the\n * video's `textTracks` of kind `subtitles` and `captions` for a native\n * session, with \"off\" because a text selection is releasable and an audio\n * one is not, and a Settings page behind it with the size and the\n * background. The glyph says whether a track is on: `icon` or `icon-on`.\n * Hidden without text tracks.\n *\n * The looks are attributes on the player, `subtitle-size` and\n * `subtitle-background`, where the element's stylesheet turns them into\n * the cue rules; a page can set them in markup and persist them however\n * it likes. Every word the menu shows is an attribute: `label`,\n * `label-off`, `label-track`, `label-settings`, `label-size`,\n * `label-background`, one per size and one per background, `label-sdh`\n * for the badge on subtitles for the deaf and hard of hearing, and\n * `label-cc` for the badge on closed captions carried in the video.\n * `label-track` also names a track that has no name and no language.\n *\n * Forced tracks are not listed. The engine's forced-subtitles stage shows\n * one while no subtitle is selected, so the menu reads Off then (guide\n * chapter 06). In a native session Safari shows them itself. A native\n * `captions` track carries the SDH badge: Safari gives that kind to the\n * subtitles that describe music and sound.\n */\nimport type { Mattebox } from 'mattebox';\nimport { isSdh } from 'mattebox';\nimport type { IconName } from '../controls/icons.js';\nimport { icon } from '../controls/icons.js';\nimport type { MenuGroup, MenuPage } from '../controls/menu.js';\nimport { nativeTracks, onNativeTracks } from '../controls/native-tracks.js';\nimport type { TrackEntry } from '../controls/track-names.js';\nimport { trackNames } from '../controls/track-names.js';\nimport type { PlayerHost } from '../host.js';\nimport { onTracks, trackItems } from './audio-menu.js';\nimport { MenuElement } from './menu-element.js';\nimport { show } from './shared.js';\n\nconst OFF = 'off';\nexport const SUBTITLE_SIZE = 'subtitle-size';\nexport const SUBTITLE_BACKGROUND = 'subtitle-background';\n\nconst SIZES: ReadonlyArray<readonly [string, string]> = [\n ['small', 'Small'],\n ['medium', 'Medium'],\n ['large', 'Large'],\n ['xlarge', 'Extra large'],\n];\nconst BACKGROUNDS: ReadonlyArray<readonly [string, string]> = [\n ['none', 'None'],\n ['dark', 'Dark'],\n ['solid', 'Solid'],\n];\n\ntype State = 'off' | 'on';\nconst STATES: readonly State[] = ['off', 'on'];\n\nexport class MbxSubtitlesMenu extends MenuElement<State> {\n static get observedAttributes(): readonly string[] {\n return [\n 'label',\n 'label-back',\n 'label-off',\n 'label-track',\n 'label-settings',\n 'label-size',\n 'label-background',\n 'label-sdh',\n 'label-cc',\n ...SIZES.map(([id]) => `label-${id}`),\n ...BACKGROUNDS.map(([id]) => `label-${id}`),\n ];\n }\n\n declare private engine: Mattebox | null;\n\n constructor() {\n super(STATES, (state) => icon(state === 'on' ? 'subtitles-on' : 'subtitles'));\n this.engine = null;\n show(this.slots, 'off');\n }\n\n protected override name(): string {\n return 'Subtitles';\n }\n\n /**\n * A look's page: an item with the look's glyph, its name and the value\n * chosen, which opens the choices. They are named from the attributes,\n * and the value is the player's.\n */\n private looks(\n player: PlayerHost,\n attribute: string,\n name: string,\n fallback: string,\n choices: ReadonlyArray<readonly [string, string]>,\n initial: string,\n glyph: IconName,\n ): MenuPage {\n const set = player.getAttribute(attribute);\n const value = set !== null && choices.some(([id]) => id === set) ? set : initial;\n const label = this.getAttribute(`label-${name}`) ?? fallback;\n const items = choices.map(\n ([id, text]) => [id, this.getAttribute(`label-${id}`) ?? text] as const,\n );\n return {\n name,\n label,\n glyph: () => icon(glyph),\n detail: items.find(([id]) => id === value)?.[1] ?? '',\n entries: [\n {\n name,\n label,\n hideLabel: true,\n items,\n value,\n onSelect: (chosen) => {\n player.setAttribute(attribute, chosen);\n this.render();\n },\n },\n ],\n };\n }\n\n protected override attach(player: PlayerHost): void {\n this.follow(player, (engine) => {\n this.engine = engine;\n this.render();\n const tick = (): void => {\n this.render();\n };\n return engine === null\n ? onNativeTracks(player.video, 'textTracks', tick)\n : onTracks(engine, tick);\n });\n }\n\n /** The native session's subtitle tracks as entries, and the showing one's. */\n private native(tracks: readonly TextTrack[]): [TrackEntry[], string | null] {\n const sdh = this.getAttribute('label-sdh') ?? 'SDH';\n const entries = tracks.map(\n (track, index): TrackEntry => [\n String(index),\n track.label,\n track.language,\n track.kind === 'captions' ? [sdh] : [],\n [],\n ],\n );\n const on = tracks.findIndex((track) => track.mode === 'showing');\n return [entries, on === -1 ? null : String(on)];\n }\n\n protected override render(): void {\n super.render();\n const engine = this.engine;\n const player = this.player;\n // The chapters track the element adds, and any metadata track, are not subtitles.\n const listed =\n engine === null && player !== null\n ? nativeTracks<TextTrack>(player, 'textTracks')?.filter(\n (track) => track.kind === 'subtitles' || track.kind === 'captions',\n )\n : undefined;\n if (player === null || (engine === null && listed === undefined)) {\n this.hidden = true;\n return;\n }\n const [tracks, active] =\n listed !== undefined\n ? this.native(listed)\n : trackItems(\n engine as Mattebox,\n 'text',\n (track) => [\n // A manifest names in-band captions by their channel (guide chapter 06).\n ...(track.instreamId !== undefined ? [this.getAttribute('label-cc') ?? 'CC'] : []),\n ...(isSdh(track) ? [this.getAttribute('label-sdh') ?? 'SDH'] : []),\n ],\n (track) => track.forced !== true,\n );\n const word = this.getAttribute('label-track');\n const items: MenuGroup['items'] = [\n [OFF, this.getAttribute('label-off') ?? 'Off'],\n ...trackNames(tracks, word),\n ];\n this.menu.fill([\n {\n name: 'track',\n label: word ?? 'Track',\n // The menu's title says what the list is.\n hideLabel: true,\n items,\n // The badges are glyphs, named by `label-cc` and `label-sdh`.\n badgeGlyphs: {\n [this.getAttribute('label-cc') ?? 'CC']: () => icon('closed-captions'),\n [this.getAttribute('label-sdh') ?? 'SDH']: () => icon('sdh'),\n },\n value: active ?? OFF,\n onSelect: (value) => {\n if (listed !== undefined) {\n // Off first, so two tracks never show at once.\n for (const track of listed) track.mode = 'disabled';\n const chosen = listed[Number(value)];\n if (chosen !== undefined) chosen.mode = 'showing';\n } else if (value === OFF) engine?.tracks.deselect('text');\n else engine?.tracks.select(value);\n this.render();\n },\n },\n {\n name: 'settings',\n label: this.getAttribute('label-settings') ?? 'Settings',\n entries: [\n this.looks(player, SUBTITLE_SIZE, 'size', 'Size', SIZES, 'medium', 'text-size'),\n this.looks(\n player,\n SUBTITLE_BACKGROUND,\n 'background',\n 'Background',\n BACKGROUNDS,\n 'dark',\n 'text-background',\n ),\n ],\n },\n ]);\n show(this.slots, active === null ? 'off' : 'on');\n this.hidden = tracks.length === 0;\n }\n}\n"],"mappings":";;;;;;;;AAqCA,MAAM,MAAM;AACZ,MAAa,gBAAgB;AAC7B,MAAa,sBAAsB;AAEnC,MAAM,QAAkD;CACtD,CAAC,SAAS,OAAO;CACjB,CAAC,UAAU,QAAQ;CACnB,CAAC,SAAS,OAAO;CACjB,CAAC,UAAU,aAAa;AAC1B;AACA,MAAM,cAAwD;CAC5D,CAAC,QAAQ,MAAM;CACf,CAAC,QAAQ,MAAM;CACf,CAAC,SAAS,OAAO;AACnB;AAGA,MAAM,SAA2B,CAAC,OAAO,IAAI;AAE7C,IAAa,mBAAb,cAAsC,YAAmB;CACvD,WAAW,qBAAwC;EACjD,OAAO;GACL;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,GAAG,MAAM,KAAK,CAAC,QAAQ,SAAS,IAAI;GACpC,GAAG,YAAY,KAAK,CAAC,QAAQ,SAAS,IAAI;EAC5C;CACF;CAIA,cAAc;EACZ,MAAM,SAAS,UAAU,KAAK,UAAU,OAAO,iBAAiB,WAAW,CAAC;EAC5E,KAAK,SAAS;EACd,KAAK,KAAK,OAAO,KAAK;CACxB;CAEA,OAAkC;EAChC,OAAO;CACT;;;;;;CAOA,MACE,QACA,WACA,MACA,UACA,SACA,SACA,OACU;EACV,MAAM,MAAM,OAAO,aAAa,SAAS;EACzC,MAAM,QAAQ,QAAQ,QAAQ,QAAQ,MAAM,CAAC,QAAQ,OAAO,GAAG,IAAI,MAAM;EACzE,MAAM,QAAQ,KAAK,aAAa,SAAS,MAAM,KAAK;EACpD,MAAM,QAAQ,QAAQ,KACnB,CAAC,IAAI,UAAU,CAAC,IAAI,KAAK,aAAa,SAAS,IAAI,KAAK,IAAI,CAC/D;EACA,OAAO;GACL;GACA;GACA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7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAI3C,qBAAa,QAAS,SAAQ,SAAS;IACrC,MAAM,KAAK,kBAAkB,IAAI,SAAS,MAAM,EAAE,CAEjD;IAED,iBAAyB,OAAO,CAAmB;IACnD,iBAAyB,OAAO,CAAc;IAC9C,iBAAyB,UAAU,CAAc;IACjD,0FAA0F;IAC1F,QAAgB,OAAO,CAAwB;;cAgB5B,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"title.d.ts","sourceRoot":"","sources":["../../src/elements/title.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAI3C,qBAAa,QAAS,SAAQ,SAAS;IACrC,MAAM,KAAK,kBAAkB,IAAI,SAAS,MAAM,EAAE,CAEjD;IAED,iBAAyB,OAAO,CAAmB;IACnD,iBAAyB,OAAO,CAAc;IAC9C,iBAAyB,UAAU,CAAc;IACjD,0FAA0F;IAC1F,QAAgB,OAAO,CAAwB;;cAgB5B,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;cAmBhC,MAAM,IAAI,IAAI;IAOjC,uEAAuE;IACvE,OAAO,CAAC,KAAK;IAIb,gHAAgH;IAChH,OAAO,CAAC,GAAG;cAUQ,MAAM,IAAI,IAAI;CAelC"}
|
package/dist/elements/title.js
CHANGED
|
@@ -24,7 +24,7 @@ import { style } from "./shared.js";
|
|
|
24
24
|
* override. Placed first among the screens, so the start button, the
|
|
25
25
|
* error screen and the spinner paint over its band.
|
|
26
26
|
*/
|
|
27
|
-
const STYLE = ":host{padding:
|
|
27
|
+
const STYLE = ":host{padding:4.5em calc(var(--mbx-pad) + .5em) calc(var(--mbx-bar-rows,0px) + .75em);color:var(--mbx-text);font:400 1em / 1.35 var(--mbx-font);text-shadow:0 1px 2px #0006;pointer-events:none;background:linear-gradient(#0000,#0000004d 55%,#0000008c);align-items:flex-end;display:flex;position:absolute;bottom:0;left:0;right:0}:host([playing]),:host([empty]),:host([hidden]){display:none}[part~=artwork]{border-radius:var(--mbx-radius);object-fit:cover;flex:none;width:auto;max-width:8em;height:4.5em;margin-right:.875em;box-shadow:0 0 0 1px #ffffff24}[part~=artwork][hidden]{display:none}[part~=text]{flex-direction:column;min-width:0;max-width:60ch;font-size:.875em;display:flex}[part~=text]>:not([hidden])~:not([hidden]){margin-top:.1429em}[part~=heading]{letter-spacing:-.01em;white-space:nowrap;text-overflow:ellipsis;font-size:1.4286em;font-weight:600;line-height:1.2;overflow:hidden}[part~=subheading]{color:#ffffffc7;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}[part~=heading]:empty,[part~=subheading]:empty{display:none}:host([artwork]) [part~=heading]:not(:empty){white-space:normal;-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box}:host([artwork][subheading]) [part~=heading]:not(:empty){-webkit-line-clamp:2}:host([layout=compact]){padding:.75em calc(var(--mbx-pad) + .5em) 2.5em;background:linear-gradient(#0000008c,#0000);align-items:flex-start;top:0;bottom:auto}:host([layout=compact]) [part~=artwork],:host([layout=compact]) [part~=subheading]{display:none}:host([layout=compact]) [part~=text] [part~=heading]:not(:empty){white-space:nowrap;font-size:1.1429em;display:block}";
|
|
28
28
|
var MbxTitle = class extends Component {
|
|
29
29
|
static get observedAttributes() {
|
|
30
30
|
return [
|
|
@@ -60,6 +60,8 @@ var MbxTitle = class extends Component {
|
|
|
60
60
|
this.fit(player);
|
|
61
61
|
});
|
|
62
62
|
this.resizer.observe(player);
|
|
63
|
+
const bar = player.querySelector("mbx-control-bar");
|
|
64
|
+
if (bar !== null) this.resizer.observe(bar);
|
|
63
65
|
}
|
|
64
66
|
this.fit(player);
|
|
65
67
|
this.state(player);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"title.js","names":[],"sources":["../../src/elements/title.ts"],"sourcesContent":["/**\n * <mbx-title>: the heading, the subheading and the artwork of what plays,\n * as a lower third across the picture above the bar: a scrim that fades\n * upward, the artwork in the first column, the two lines in the second,\n * so a heading alone sits on a band and never floats. The content comes\n * from attributes, `heading`,\n * `subheading` and `artwork`, because the stream carries none of it: a page\n * writes what it knows, and a Cast receiver writes what the sender said.\n * With none of the three the element draws nothing.\n *\n * Shown while the video is paused, which includes before the first play,\n * and hidden while it plays. The element carries `playing` for that rule,\n * so a page changes it in CSS: `mattebox-player[started] mbx-title\n * { display: none }` keeps it to the time before the first play, like the\n * poster, and `mattebox-player:hover mbx-title { display: flex }` brings it\n * back on hover. The height of the bar's rows, its box less the fade it\n * pads itself with, goes on the host as `--mbx-bar-rows`, so the text sits\n * just above the seek row while the band runs under the bar to the bottom\n * edge, one ramp with the bar's own fade. The scrim is the page's to\n * override. Placed first among the screens, so the start button, the\n * error screen and the spinner paint over its band.\n */\nimport { el } from '../dom.js';\nimport type { PlayerHost } from '../host.js';\nimport { Component } from './component.js';\nimport { style } from './shared.js';\nimport STYLE from './title.css?inline';\n\nexport class MbxTitle extends Component {\n static get observedAttributes(): readonly string[] {\n return ['heading', 'subheading', 'artwork'];\n }\n\n declare private readonly artwork: HTMLImageElement;\n declare private readonly heading: HTMLElement;\n declare private readonly subheading: HTMLElement;\n /** Watches the player's box: the height of the bar's rows decides where the text sits. */\n declare private resizer: ResizeObserver | null;\n\n constructor() {\n super();\n this.resizer = null;\n const root = this.attachShadow({ mode: 'open' });\n this.artwork = el('img', 'artwork');\n this.artwork.alt = '';\n this.artwork.hidden = true;\n const text = el('div', 'text');\n this.heading = el('div', 'heading');\n this.subheading = el('div', 'subheading');\n text.append(this.heading, this.subheading);\n root.append(style(STYLE), this.artwork, text);\n }\n\n protected override attach(player: PlayerHost): void {\n this.listen(player.video, ['play', 'pause', 'ended', 'emptied'], () => {\n this.state(player);\n });\n if (typeof ResizeObserver !== 'undefined') {\n this.resizer = new ResizeObserver(() => {\n this.fit(player);\n });\n this.resizer.observe(player);\n }\n this.fit(player);\n this.state(player);\n this.render();\n }\n\n protected override detach(): void {\n this.resizer?.disconnect();\n this.resizer = null;\n this.removeAttribute('playing');\n this.style.removeProperty('--mbx-bar-rows');\n }\n\n /** `playing` on the element, for its own stylesheet and the page's. */\n private state(player: PlayerHost): void {\n this.toggleAttribute('playing', !player.video.paused);\n }\n\n /** The height of the bar's rows: its box less the padding above them, which is its fade. Zero without a bar. */\n private fit(player: PlayerHost): void {\n const bar = player.querySelector('mbx-control-bar');\n let rows = 0;\n if (bar !== null) {\n const top = Number.parseFloat(getComputedStyle(bar).paddingTop) || 0;\n rows = Math.max(0, bar.getBoundingClientRect().height - top);\n }\n this.style.setProperty('--mbx-bar-rows', `${rows}px`);\n }\n\n protected override render(): void {\n const heading = this.getAttribute('heading') ?? '';\n const subheading = this.getAttribute('subheading') ?? '';\n const artwork = this.getAttribute('artwork');\n this.heading.textContent = heading;\n this.subheading.textContent = subheading;\n if (artwork === null) {\n this.artwork.removeAttribute('src');\n this.artwork.hidden = true;\n } else {\n this.artwork.src = artwork;\n this.artwork.hidden = false;\n }\n this.toggleAttribute('empty', heading === '' && subheading === '' && artwork === null);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAA,QAAA;AAEA,IAAA,WAAA,cAAA,UAAA;CACA,WAAA,qBAAA;EACA,OAAA;GAAA;GAAA;GAAA;EAAA;CACA;CAQA,cAAA;EACA,MAAA;EACA,KAAA,UAAA;EACA,MAAA,OAAA,KAAA,aAAA,EAAA,MAAA,OAAA,CAAA;EACA,KAAA,UAAA,GAAA,OAAA,SAAA;EACA,KAAA,QAAA,MAAA;EACA,KAAA,QAAA,SAAA;EACA,MAAA,OAAA,GAAA,OAAA,MAAA;EACA,KAAA,UAAA,GAAA,OAAA,SAAA;EACA,KAAA,aAAA,GAAA,OAAA,YAAA;EACA,KAAA,OAAA,KAAA,SAAA,KAAA,UAAA;EACA,KAAA,OAAA,MAAA,KAAA,GAAA,KAAA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ts"],"sourcesContent":["/**\n * <mbx-title>: the heading, the subheading and the artwork of what plays,\n * as a lower third across the picture above the bar: a scrim that fades\n * upward, the artwork in the first column, the two lines in the second,\n * so a heading alone sits on a band and never floats. The content comes\n * from attributes, `heading`,\n * `subheading` and `artwork`, because the stream carries none of it: a page\n * writes what it knows, and a Cast receiver writes what the sender said.\n * With none of the three the element draws nothing.\n *\n * Shown while the video is paused, which includes before the first play,\n * and hidden while it plays. The element carries `playing` for that rule,\n * so a page changes it in CSS: `mattebox-player[started] mbx-title\n * { display: none }` keeps it to the time before the first play, like the\n * poster, and `mattebox-player:hover mbx-title { display: flex }` brings it\n * back on hover. The height of the bar's rows, its box less the fade it\n * pads itself with, goes on the host as `--mbx-bar-rows`, so the text sits\n * just above the seek row while the band runs under the bar to the bottom\n * edge, one ramp with the bar's own fade. The scrim is the page's to\n * override. Placed first among the screens, so the start button, the\n * error screen and the spinner paint over its band.\n */\nimport { el } from '../dom.js';\nimport type { PlayerHost } from '../host.js';\nimport { Component } from './component.js';\nimport { style } from './shared.js';\nimport STYLE from './title.css?inline';\n\nexport class MbxTitle extends Component {\n static get observedAttributes(): readonly string[] {\n return ['heading', 'subheading', 'artwork'];\n }\n\n declare private readonly artwork: HTMLImageElement;\n declare private readonly heading: HTMLElement;\n declare private readonly subheading: HTMLElement;\n /** Watches the player's box: the height of the bar's rows decides where the text sits. */\n declare private resizer: ResizeObserver | null;\n\n constructor() {\n super();\n this.resizer = null;\n const root = this.attachShadow({ mode: 'open' });\n this.artwork = el('img', 'artwork');\n this.artwork.alt = '';\n this.artwork.hidden = true;\n const text = el('div', 'text');\n this.heading = el('div', 'heading');\n this.subheading = el('div', 'subheading');\n text.append(this.heading, this.subheading);\n root.append(style(STYLE), this.artwork, text);\n }\n\n protected override attach(player: PlayerHost): void {\n this.listen(player.video, ['play', 'pause', 'ended', 'emptied'], () => {\n this.state(player);\n });\n if (typeof ResizeObserver !== 'undefined') {\n this.resizer = new ResizeObserver(() => {\n this.fit(player);\n });\n this.resizer.observe(player);\n // The bar's rows change height with the player's size tier, without\n // the player's box changing.\n const bar = player.querySelector('mbx-control-bar');\n if (bar !== null) this.resizer.observe(bar);\n }\n this.fit(player);\n this.state(player);\n this.render();\n }\n\n protected override detach(): void {\n this.resizer?.disconnect();\n this.resizer = null;\n this.removeAttribute('playing');\n this.style.removeProperty('--mbx-bar-rows');\n }\n\n /** `playing` on the element, for its own stylesheet and the page's. */\n private state(player: PlayerHost): void {\n this.toggleAttribute('playing', !player.video.paused);\n }\n\n /** The height of the bar's rows: its box less the padding above them, which is its fade. Zero without a bar. */\n private fit(player: PlayerHost): void {\n const bar = player.querySelector('mbx-control-bar');\n let rows = 0;\n if (bar !== null) {\n const top = Number.parseFloat(getComputedStyle(bar).paddingTop) || 0;\n rows = Math.max(0, bar.getBoundingClientRect().height - top);\n }\n this.style.setProperty('--mbx-bar-rows', `${rows}px`);\n }\n\n protected override render(): void {\n const heading = this.getAttribute('heading') ?? '';\n const subheading = this.getAttribute('subheading') ?? '';\n const artwork = this.getAttribute('artwork');\n this.heading.textContent = heading;\n this.subheading.textContent = subheading;\n if (artwork === null) {\n this.artwork.removeAttribute('src');\n this.artwork.hidden = true;\n } else {\n this.artwork.src = artwork;\n this.artwork.hidden = false;\n }\n this.toggleAttribute('empty', heading === '' && subheading === '' && artwork === null);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAA,QAAA;AAEA,IAAA,WAAA,cAAA,UAAA;CACA,WAAA,qBAAA;EACA,OAAA;GAAA;GAAA;GAAA;EAAA;CACA;CAQA,cAAA;EACA,MAAA;EACA,KAAA,UAAA;EACA,MAAA,OAAA,KAAA,aAAA,EAAA,MAAA,OAAA,CAAA;EACA,KAAA,UAAA,GAAA,OAAA,SAAA;EACA,KAAA,QAAA,MAAA;EACA,KAAA,QAAA,SAAA;EACA,MAAA,OAAA,GAAA,OAAA,MAAA;EACA,KAAA,UAAA,GAAA,OAAA,SAAA;EACA,KAA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,SAAA;EACA,OAAA;GACA,KAAA,QAAA,MAAA;GACA,KAAA,QAAA,SAAA;EACA;EACA,KAAA,gBAAA,SAAA,YAAA,MAAA,eAAA,MAAA,YAAA,IAAA;CACA;AACA"}
|
|
@@ -2,7 +2,7 @@ import { Component } from "./component.js";
|
|
|
2
2
|
import { SLIDER_STYLE, number, style } from "./shared.js";
|
|
3
3
|
import { slider } from "../controls/slider.js";
|
|
4
4
|
//#region src/elements/volume-slider.ts
|
|
5
|
-
const VOLUME_SLIDER_CSS = ":host{flex:none;width:
|
|
5
|
+
const VOLUME_SLIDER_CSS = ":host{flex:none;width:5em}";
|
|
6
6
|
const STEP = .05;
|
|
7
7
|
const PAGE = .2;
|
|
8
8
|
var MbxVolumeSlider = class extends Component {
|
package/dist/elements/volume.js
CHANGED
|
@@ -15,7 +15,7 @@ import { style } from "./shared.js";
|
|
|
15
15
|
* stuck. So the group carries `pointer` from a pointer press until a key
|
|
16
16
|
* is pressed or focus leaves, and focus unfolds the slider only without it.
|
|
17
17
|
*/
|
|
18
|
-
const STYLE = ":host{align-items:center;display:inline-flex}:host([hidden]){display:none}::slotted(mbx-volume-slider){opacity:0;width:0;transition:width .2s,opacity .2s;overflow:hidden}::slotted(mbx-volume-slider[collapsed]){display:none}:host(:hover) ::slotted(mbx-volume-slider),:host(:focus-within:not([pointer])) ::slotted(mbx-volume-slider){opacity:1;width:
|
|
18
|
+
const STYLE = ":host{align-items:center;display:inline-flex}:host([hidden]){display:none}::slotted(mbx-volume-slider){opacity:0;width:0;transition:width .2s,opacity .2s;overflow:hidden}::slotted(mbx-volume-slider[collapsed]){display:none}:host(:hover) ::slotted(mbx-volume-slider),:host(:focus-within:not([pointer])) ::slotted(mbx-volume-slider){opacity:1;width:5em}@media (prefers-reduced-motion:reduce){::slotted(mbx-volume-slider){transition:none}}";
|
|
19
19
|
var MbxVolume = class extends Component {
|
|
20
20
|
constructor() {
|
|
21
21
|
super();
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** `@mattebox/player/elements/marker-button`: registers <mbx-marker-button>, and the player with it. */
|
|
2
|
+
import '../element-entry.js';
|
|
3
|
+
import { MbxMarkerButton } from '../elements/marker-button.js';
|
|
4
|
+
export { MbxMarkerButton };
|
|
5
|
+
//# sourceMappingURL=marker-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marker-button.d.ts","sourceRoot":"","sources":["../../src/entries/marker-button.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAM/D,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MARKER_BUTTON } from "../tags.js";
|
|
2
|
+
import "../element-entry.js";
|
|
3
|
+
import { MbxMarkerButton } from "../elements/marker-button.js";
|
|
4
|
+
//#region src/entries/marker-button.ts
|
|
5
|
+
if (customElements.get("mbx-marker-button") === void 0) customElements.define(MARKER_BUTTON, MbxMarkerButton);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { MbxMarkerButton };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=marker-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marker-button.js","names":[],"sources":["../../src/entries/marker-button.ts"],"sourcesContent":["/** `@mattebox/player/elements/marker-button`: registers <mbx-marker-button>, and the player with it. */\nimport '../element-entry.js';\nimport { MbxMarkerButton } from '../elements/marker-button.js';\nimport { MARKER_BUTTON } from '../tags.js';\n\nif (customElements.get(MARKER_BUTTON) === undefined)\n customElements.define(MARKER_BUTTON, MbxMarkerButton);\n\nexport { MbxMarkerButton };\n"],"mappings":";;;;AAKA,IAAI,eAAe,IAAA,mBAAiB,MAAM,KAAA,GACxC,eAAe,OAAO,eAAe,eAAe"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import toPropertyKey from "./toPropertyKey.js";
|
|
2
|
-
//#region \0@oxc-project+runtime@0.
|
|
2
|
+
//#region \0@oxc-project+runtime@0.152.0/helpers/esm/defineProperty.js
|
|
3
3
|
function _defineProperty(e, r, t) {
|
|
4
4
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
5
5
|
value: t,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "./defineProperty.js";
|
|
2
|
-
//#region \0@oxc-project+runtime@0.
|
|
2
|
+
//#region \0@oxc-project+runtime@0.152.0/helpers/esm/objectSpread2.js
|
|
3
3
|
function ownKeys(e, r) {
|
|
4
4
|
var t = Object.keys(e);
|
|
5
5
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _typeof from "./typeof.js";
|
|
2
|
-
//#region \0@oxc-project+runtime@0.
|
|
2
|
+
//#region \0@oxc-project+runtime@0.152.0/helpers/esm/toPrimitive.js
|
|
3
3
|
function toPrimitive(t, r) {
|
|
4
4
|
if ("object" != _typeof(t) || !t) return t;
|
|
5
5
|
var e = t[Symbol.toPrimitive];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _typeof from "./typeof.js";
|
|
2
2
|
import toPrimitive from "./toPrimitive.js";
|
|
3
|
-
//#region \0@oxc-project+runtime@0.
|
|
3
|
+
//#region \0@oxc-project+runtime@0.152.0/helpers/esm/toPropertyKey.js
|
|
4
4
|
function toPropertyKey(t) {
|
|
5
5
|
var i = toPrimitive(t, "string");
|
|
6
6
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.
|
|
1
|
+
//#region \0@oxc-project+runtime@0.152.0/helpers/esm/typeof.js
|
|
2
2
|
function _typeof(o) {
|
|
3
3
|
"@babel/helpers - typeof";
|
|
4
4
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
import { optional } from "./session.js";
|
|
3
3
|
//#region src/controls/chapters.ts
|
|
4
4
|
/** The first chapters track on the video, or null. */
|
|
@@ -1,37 +1,46 @@
|
|
|
1
1
|
//#region src/controls/icons.ts
|
|
2
2
|
/**
|
|
3
3
|
* Each glyph's subpaths joined into one `d`. The path is drawn even-odd:
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* a frame, a ring or a letter cuts its hole with a nested subpath, and no
|
|
5
|
+
* two filled subpaths overlap.
|
|
6
6
|
*/
|
|
7
7
|
const PATHS = {
|
|
8
|
-
play: "
|
|
9
|
-
pause: "M8
|
|
10
|
-
replay: "
|
|
11
|
-
mute: "
|
|
12
|
-
"volume-low": "
|
|
13
|
-
"volume-high": "
|
|
14
|
-
fullscreen: "
|
|
15
|
-
"fullscreen-exit": "
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
"lock-closed": "
|
|
21
|
-
"seek-backward": "
|
|
22
|
-
"seek-forward": "
|
|
23
|
-
"seek-backward-
|
|
24
|
-
"seek-forward-
|
|
25
|
-
"seek-backward-
|
|
26
|
-
"seek-forward-
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
|
|
8
|
+
play: "M9 5L26 16L9 27z",
|
|
9
|
+
pause: "M8 6h5.5v20h-5.5zM18.5 6h5.5v20h-5.5z",
|
|
10
|
+
replay: "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",
|
|
11
|
+
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",
|
|
12
|
+
"volume-low": "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",
|
|
13
|
+
"volume-high": "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",
|
|
14
|
+
fullscreen: "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",
|
|
15
|
+
"fullscreen-exit": "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",
|
|
16
|
+
quality: "M5 22L10 18.1L10 27L5 27zM13.5 15.4L18.5 11.6L18.5 27L13.5 27zM22 8.9L27 5L27 27L22 27z",
|
|
17
|
+
audio: "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",
|
|
18
|
+
subtitles: "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",
|
|
19
|
+
"subtitles-on": "M4 6h20l4 4v16H4zM9 14h8v2.5h-8zM19 14h4v2.5h-4zM9 18.5h4v2.5h-4zM15 18.5h8v2.5h-8z",
|
|
20
|
+
"lock-closed": "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",
|
|
21
|
+
"seek-backward": "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",
|
|
22
|
+
"seek-forward": "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",
|
|
23
|
+
"seek-backward-5": "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",
|
|
24
|
+
"seek-forward-5": "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",
|
|
25
|
+
"seek-backward-10": "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",
|
|
26
|
+
"seek-forward-10": "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",
|
|
27
|
+
"seek-backward-15": "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",
|
|
28
|
+
"seek-forward-15": "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",
|
|
29
|
+
"seek-backward-30": "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",
|
|
30
|
+
"seek-forward-30": "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",
|
|
31
|
+
"playback-speed": "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",
|
|
32
|
+
"picture-in-picture": "M4 6h24v20H4zM6.5 8.5v15h19v-15zM15 15h8v6h-8z",
|
|
33
|
+
"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",
|
|
34
|
+
airplay: "M4 6H28V23.25H23V20.75H25.5V8.5H6.5V20.75H9V23.25H4zM16 17.5L23.5 27L8.5 27z",
|
|
35
|
+
"airplay-active": "M4 6H28V23.25H22.1L16 15.5L9.9 23.25H4zM16 17.5L23.5 27L8.5 27z",
|
|
36
|
+
chapters: "M5 6.5h4v4h-4zM12 7.25h15v2.5h-15zM5 14h4v4h-4zM12 14.75h15v2.5h-15zM5 21.5h4v4h-4zM12 22.25h15v2.5h-15z",
|
|
37
|
+
"fast-forward": "M4 7L15 16L4 25zM16 7L27 16L16 25z",
|
|
38
|
+
"fast-backward": "M28 7L17 16L28 25zM16 7L5 16L16 25z",
|
|
39
|
+
"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",
|
|
40
|
+
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",
|
|
41
|
+
"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",
|
|
42
|
+
"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",
|
|
43
|
+
"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"
|
|
35
44
|
};
|
|
36
45
|
const SVG = "http://www.w3.org/2000/svg";
|
|
37
46
|
/** A glyph, hidden from the accessibility tree: the button it sits in carries the name. */
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//#region src/controls/markers.ts
|
|
2
|
+
/**
|
|
3
|
+
* Past a blocked range's end by this much, so the playhead does not settle
|
|
4
|
+
* on the end itself and enter the range again: Safari can report a time a
|
|
5
|
+
* hair before the one it was given.
|
|
6
|
+
*/
|
|
7
|
+
const PAST = .1;
|
|
8
|
+
/**
|
|
9
|
+
* Markers over `video`. `emit` reports a change of the list as
|
|
10
|
+
* `markerschange` and a jump over a blocked range as `blocked`.
|
|
11
|
+
*/
|
|
12
|
+
function createMarkers(video, emit) {
|
|
13
|
+
let list = [];
|
|
14
|
+
const within = (time) => list.filter((marker) => marker.start <= time && time < marker.end);
|
|
15
|
+
const guard = () => {
|
|
16
|
+
const blocked = within(video.currentTime).find((marker) => marker.kind === "blocked");
|
|
17
|
+
if (blocked === void 0) return;
|
|
18
|
+
video.currentTime = Math.min(blocked.end + PAST, video.duration || Number.POSITIVE_INFINITY);
|
|
19
|
+
emit("blocked", blocked);
|
|
20
|
+
};
|
|
21
|
+
video.addEventListener("seeking", guard);
|
|
22
|
+
video.addEventListener("timeupdate", guard);
|
|
23
|
+
return {
|
|
24
|
+
get list() {
|
|
25
|
+
return list;
|
|
26
|
+
},
|
|
27
|
+
set(next) {
|
|
28
|
+
list = [...next].sort((a, b) => a.start - b.start);
|
|
29
|
+
emit("markerschange", list);
|
|
30
|
+
guard();
|
|
31
|
+
},
|
|
32
|
+
within
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { createMarkers };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { el, setChildren, state } from "../dom.js";
|
|
2
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
2
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
|
|
3
3
|
//#region src/controls/menu.ts
|
|
4
4
|
/**
|
|
5
5
|
* The menu primitive the quality, audio, subtitles and speed menus share: a
|
|
@@ -25,6 +25,12 @@ import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.150.0/helpers/es
|
|
|
25
25
|
*/
|
|
26
26
|
/** Air between the popup's top and the picture's. */
|
|
27
27
|
const AIR = 8;
|
|
28
|
+
/**
|
|
29
|
+
* The tallest a popup grows, in pixels: the title and about seven and a half rows, so
|
|
30
|
+
* the half row at the foot says the list goes on. A page sets its own
|
|
31
|
+
* with `--mbx-menu-max-height`.
|
|
32
|
+
*/
|
|
33
|
+
const MAX_HEIGHT = 22;
|
|
28
34
|
/** An item's picture. Decorative: the item's text names it. Loaded when the popup first shows it. */
|
|
29
35
|
function picture(url) {
|
|
30
36
|
const node = el("img", "item-image");
|
|
@@ -44,6 +50,9 @@ function menu(options) {
|
|
|
44
50
|
button.setAttribute("aria-haspopup", "menu");
|
|
45
51
|
button.setAttribute("aria-expanded", "false");
|
|
46
52
|
const popup = el("div", "popup");
|
|
53
|
+
popup.addEventListener("scroll", () => {
|
|
54
|
+
more();
|
|
55
|
+
});
|
|
47
56
|
popup.setAttribute("role", "menu");
|
|
48
57
|
popup.hidden = true;
|
|
49
58
|
let open = false;
|
|
@@ -65,15 +74,31 @@ function menu(options) {
|
|
|
65
74
|
function outside(event) {
|
|
66
75
|
if (!event.composedPath().includes(host)) close();
|
|
67
76
|
}
|
|
68
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* The popup's height: its maximum, or the room above the button if that
|
|
79
|
+
* is less, so the popup never leaves the picture. Its width: the room
|
|
80
|
+
* left of its right edge.
|
|
81
|
+
*/
|
|
69
82
|
function fit() {
|
|
83
|
+
if (host.getAttribute("layout") === "compact") {
|
|
84
|
+
popup.style.maxHeight = "";
|
|
85
|
+
popup.style.maxWidth = "";
|
|
86
|
+
more();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
70
89
|
const picture = options.picture();
|
|
71
90
|
if (picture === null) return;
|
|
72
91
|
const room = button.getBoundingClientRect().top - picture.top - AIR;
|
|
73
|
-
|
|
92
|
+
const most = Number.parseFloat(getComputedStyle(host).getPropertyValue("--mbx-menu-max-height")) || MAX_HEIGHT * (Number.parseFloat(getComputedStyle(host).fontSize) || 16);
|
|
93
|
+
popup.style.maxHeight = `${Math.max(0, Math.floor(Math.min(most, room)))}px`;
|
|
94
|
+
more();
|
|
74
95
|
const wide = host.getBoundingClientRect().right - picture.left - AIR;
|
|
75
96
|
popup.style.maxWidth = `${Math.max(0, Math.floor(wide))}px`;
|
|
76
97
|
}
|
|
98
|
+
/** `more` on the popup while rows wait below its foot, which then fades out. */
|
|
99
|
+
function more() {
|
|
100
|
+
popup.toggleAttribute("more", popup.scrollTop + popup.clientHeight < popup.scrollHeight - 1);
|
|
101
|
+
}
|
|
77
102
|
function clear() {
|
|
78
103
|
for (const item of items()) {
|
|
79
104
|
const handler = handlers.get(item);
|
|
@@ -95,6 +120,11 @@ function menu(options) {
|
|
|
95
120
|
const page = stack[stack.length - 1];
|
|
96
121
|
if (page === void 0) return;
|
|
97
122
|
let tab = true;
|
|
123
|
+
if (stack.length === 1 && name !== "") {
|
|
124
|
+
const title = el("div", "title", name);
|
|
125
|
+
title.setAttribute("aria-hidden", "true");
|
|
126
|
+
popup.append(title);
|
|
127
|
+
}
|
|
98
128
|
if (stack.length > 1) {
|
|
99
129
|
const back = item("item back-item", page.label, () => {
|
|
100
130
|
var _items$;
|
|
@@ -116,6 +146,11 @@ function menu(options) {
|
|
|
116
146
|
});
|
|
117
147
|
link.setAttribute("role", "menuitem");
|
|
118
148
|
link.setAttribute("aria-haspopup", "menu");
|
|
149
|
+
if (entry.glyph !== void 0) {
|
|
150
|
+
link.prepend(entry.glyph());
|
|
151
|
+
state(link, `item page-item ${entry.name}-item`, { "glyph-item": true });
|
|
152
|
+
}
|
|
153
|
+
if (entry.detail !== void 0) link.append(el("span", "item-detail", entry.detail));
|
|
119
154
|
popup.append(link);
|
|
120
155
|
continue;
|
|
121
156
|
}
|
|
@@ -123,14 +158,26 @@ function menu(options) {
|
|
|
123
158
|
section.setAttribute("role", "group");
|
|
124
159
|
if (entry.label !== void 0) {
|
|
125
160
|
section.setAttribute("aria-label", entry.label);
|
|
126
|
-
section.append(el("div", `section-label ${entry.name}-label`, entry.label));
|
|
161
|
+
if (entry.hideLabel !== true) section.append(el("div", `section-label ${entry.name}-label`, entry.label));
|
|
127
162
|
}
|
|
128
|
-
for (const [id, text, detail, image] of entry.items) {
|
|
163
|
+
for (const [id, text, detail, image, badges] of entry.items) {
|
|
129
164
|
const choice = item(`item ${entry.name}-item`, text, () => {
|
|
130
165
|
close();
|
|
131
166
|
button.focus();
|
|
132
167
|
entry.onSelect(id);
|
|
133
168
|
});
|
|
169
|
+
for (const badge of badges !== null && badges !== void 0 ? badges : []) {
|
|
170
|
+
var _entry$badgeGlyphs;
|
|
171
|
+
const glyph = (_entry$badgeGlyphs = entry.badgeGlyphs) === null || _entry$badgeGlyphs === void 0 ? void 0 : _entry$badgeGlyphs[badge];
|
|
172
|
+
if (glyph === void 0) {
|
|
173
|
+
choice.append(el("span", "item-badge", badge));
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
const drawn = el("span", "item-badge item-glyph");
|
|
177
|
+
drawn.title = badge;
|
|
178
|
+
drawn.append(glyph(), el("span", "badge-text", badge));
|
|
179
|
+
choice.append(drawn);
|
|
180
|
+
}
|
|
134
181
|
if (detail !== void 0) choice.append(el("span", "item-detail", detail));
|
|
135
182
|
if (image !== void 0) {
|
|
136
183
|
const [, ...rest] = choice.childNodes;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region src/controls/native-tracks.ts
|
|
2
|
+
/**
|
|
3
|
+
* The video's `audioTracks` or `textTracks` during a native session, or
|
|
4
|
+
* undefined: an engine session has its own tracks, and Chromium has no
|
|
5
|
+
* `audioTracks` without a flag.
|
|
6
|
+
*/
|
|
7
|
+
function nativeTracks(player, name) {
|
|
8
|
+
var _player$player;
|
|
9
|
+
const session = (_player$player = player.player) === null || _player$player === void 0 ? void 0 : _player$player.session;
|
|
10
|
+
if (session == null || session.engine !== null) return void 0;
|
|
11
|
+
const list = player.video[name];
|
|
12
|
+
return list === void 0 ? void 0 : Array.from(list);
|
|
13
|
+
}
|
|
14
|
+
/** Calls `tick` when the video's list of `name` changes, and answers the unsubscribe. */
|
|
15
|
+
function onNativeTracks(video, name, tick) {
|
|
16
|
+
const list = video[name];
|
|
17
|
+
if (list === void 0) return void 0;
|
|
18
|
+
const events = [
|
|
19
|
+
"change",
|
|
20
|
+
"addtrack",
|
|
21
|
+
"removetrack"
|
|
22
|
+
];
|
|
23
|
+
for (const event of events) list.addEventListener(event, tick);
|
|
24
|
+
return () => {
|
|
25
|
+
for (const event of events) list.removeEventListener(event, tick);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { nativeTracks, onNativeTracks };
|