layouts
All repositories: gitoria
3.4 KB
# Media playerAudio and video in one phone-first player. Demo: `/media-player`(https://components.hybriel.worldapi.org/media-player).Pure Hybriel: one file, `media-player.hl`, with its own `Style`; no JavaScript file. Thebrowser's own media element plays — this component draws the controls around it, sizedfor a thumb (every button at least 44 px, play / pause larger).## Use it in an appCopy `components/media-player/media-player.hl` (and `components/icons/icons.hl` if youdo not have it — the player's icons come from there), then:```import MediaPlayer from './media-player.hl'Hybrid queue = [{ src = '/media/song.mp3' title = 'Song' dur = '3:41' }{ src = '/media/clip.mp4' title = 'Clip' dur = '0:30' }]String current = '/media/song.mp3'picked = (src) => { current = src }View {MediaPlayer { src = current kind = "audio" title = "Song" artist = "Someone"cover = "/media/cover.png" queue = queue onPlay = picked }}```## Attributes| Attribute | Meaning ||---|---|| `src` | the address of the media file (the host owns it) || `kind` | `"video"` (default) or `"audio"`: audio shows a cover instead of the video area || `title` | the heading of the cover (audio); the video element's accessible name || `artist` | the second line of the cover (audio) || `cover` | the cover image of an audio item (optional) || `queue` | the host's list: `[{ src, title, dur }]` — rendered under the player; the row whose `src` plays is marked with the accent colour only || `onPlay` | a function the host hands in; a tap on a queue item (and the end of one) calls it with that item's `src` (the host then hands a new `src` back — the player is built anew with it) || `jump` | the seek jump of the back / forward buttons, in seconds (default 10) |Write every attribute as a **literal** (`kind = "audio"`): then several players stand onone page, each with its own values. (A composed component's members are the page's state.)Use one per page: the player's own state (the time, the speed) is the page's state too.## Controls- A **seek bar** you drag with a finger (pointer events, the whole strip is 44 px tall):the played part in the accent colour, the buffered part lighter, the thumb a dot. Ittakes the keyboard too (arrows, Home, End) when it has the focus.- **Back 10 s**, **play / pause** (the largest button), **forward 10 s**, the **currenttime / total time**, **mute**, the **speed** (1 / 1.25 / 1.5 / 2, one button that stepsthrough them), and **fullscreen** on video.- Keyboard on the media element (a click on the video gives it the focus): Space plays /pauses, ArrowLeft / ArrowRight jump 10 s.## Behaviour- The video area is 16:9, letterboxed (`object-fit: contain`); audio shows the cover withthe title and artist.- The queue under the player is dense: 44 px tap rows that look thin (the visible rowshug their text, the touch area is the padding).- When an item ends, the next queue item's `src` goes to the host the same way a tap does.- Colours are the semantic tokens with a black/white/grey fallback (the base look), so abare copy looks right and an app that declares the WorldAPI tokens (layouts.worldapi.org'stheme) restyles it. No frames; the current queue item is the accent colour on a surface.## Not yetNo captions track UI (a `<track>` can be handed to the media element by the host's ownmarkup inside the component's slot is not offered yet); no volume slider (mute only);no picture-in-picture button (the browser's own menu on the video still has it).
Branches
Latest commits
- 40a9e69cMP: report, LOG linemre
- 5b5dbf0fMedia player: the component from components.hybriel dd003e5 (sync-components), the showcase page /components/media-player with a queue, its media files served with ranges (lib/media.hl), theme rules (the seek bar, the queue's current item, the radii), the page in the overview listsmre
- 9197159fTake components e54f83a: table lines and one-row desktop toolbar in the theme, Table button gates, a table in the md-editor demomre
- e6322a44UX: report and LOG linemre
- 58c2da6fUX: nav marker without bars; chat composer is one box (files-upload pick mode, showcase); comments state footer + closer reactions row; modal footer rule only for its own footer; gates for all of itmre
- 956f107async components.hybriel 4922f9c: 44 px targets in month-view, date-picker, range-picker, pagination, modal, comments; names follow <html lang> (English default), UTC weekday fix; gate: 390 px target checks, 'edited' hit-area padding; comments showcase 'You are' is a labelled group (SY)mre
- 49940371sessions last 99 years (creator 2026-10-23: logins never expire; only sign out ends them)mre
- 6f7bd392gate: the phone toolbar is two even rows (E2)mre
- 3049c082sync components.hybriel 214c318: MdEditor on a phone, two even toolbar rows of 44 px targets, label 15 px, table head 16 px (E2)mre
- b9a3f85fLOG: MLmre
- 7979397creport ML-mobilemre
- 85d2ed25gate: wordingmre
- 98a311c0gate: 390 px checks for list rows, table word, edited tap target, code in titlesmre
- 769b99d7theme: table cells keep a word whole, code in a title stays text-sized, 'edited' is a 44 px tap target on the phonemre
- c36b7595list rows (notes, mail) stack their parts full width: the date no longer a one-letter column beside the titlemre
- 02aa74aasync components.hybriel 134b4e3: MdEditor builds an editor put into the page at once, redraws a surface put in anew (F5, hybriel#211)mre
- 268b1c87sync components.hybriel 6b0936a: the 'edited' foldable drops the theme's border and marginmre
- c51d039fsync components.hybriel 8d79ff7: bubble hugs its content, quiet 'edited' label; gate checksmre
- f4ad7eecsync components 9a: shared Icon (icons/icons.hl), md-editor toolbar icons + single focus ring (components f4-icons ba96735)mre
- db258c11sync-components: copy icons/icons.hl + README (F4); testsmre