Media
Universal media controls shell (controller, scrubber, volume) consumed by OrigamAudio and OrigamVideo. Headless and media-agnostic — drives any HTMLMediaElement via state + methods refs from useMediaPlayer().
Structure
Anatomie
Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.
<origam-media-controller> — 6 internal zones: header slot, progress row (scrubber), transport row (buttons), footer slot, plus prepend/append transport injection points.- 1.origam-media-controller
- Root container. When inset=true, overlays the media surface with a gradient.
- 2.origam-media-controller__progress-row
- Hosts the OrigamMediaScrubber timeline (or the #waveform slot override).
- 3.origam-media-controller__buttons-row
- Transport row: play/pause, previous/next, time display, volume, config menu.
- 4.origam-media-controller__time
- Current time / total duration display. Children: __time-current, __time-sep, __time-total.
- 5.origam-media-controller__buttons-left
- Left side of transport row. Hosts #prepend-transport slot, play/pause, previous/next, time.
- 6.origam-media-controller__buttons-right
- Right side of transport row. Hosts #extraControlsRight slot, volume control, config menu.
API
Props
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.
- staterequisIMediaPlayerState—
- Reactive media state from useMediaPlayer() (or a specialisation). Required.
- methodsrequisIMediaPlayerMethods—
- Imperative methods from useMediaPlayer(). Required.
- insetbooleanfalse
- Overlay mode: the shell sits on top of the media surface with a dark gradient and auto-hides. When false, renders as an always-on toolbar.
- visiblebooleantrue
- Visibility flag driven by the parent's autohide logic.
- playbackRatesReadonlyArray<number>[0.5, 0.75, 1, 1.25, 1.5, 2]
- Available playback rates exposed via the config menu.
- allowRemotePlaybackbooleanfalse
- Enables the cast / AirPlay button (Remote Playback API).
- downloadablebooleanfalse
- Adds a "Download" row to the config menu.
- downloadUrlstring | nullnull
- URL surfaced to the consumer when "Download" is clicked.
- downloadFilenamestring
- Suggested filename written to the <a download="…"> attribute.
- qualityOptionsReadonlyArray<TQualityOption>[]
- Quality variants list. When ≥ 2 entries, a "Quality" drill-down appears in the config menu.
- currentQualitystring | nullnull
- Currently-active quality identifier.
- showPreviousbooleanfalse
- Show the "previous" transport button.
- showNextbooleanfalse
- Show the "next" transport button.
- showLoopbooleanfalse
- Show the tri-state loop button (none → all → one → none).
- showShufflebooleanfalse
- Show the shuffle toggle button.
- Current loop mode (v-model:loopMode). Cycles none → all → one → none on click.
- shufflebooleanfalse
- Current shuffle state (v-model:shuffle). Toggled on click.
API
Slots
Emplacements de contenu exposés par ce composant.
- #header
- Block rendered above the scrubber row. OrigamAudio injects cover + metadata here.
- #waveform
- Replaces the default OrigamMediaScrubber scrubber row. Receives state + methods to route seeks.
- #footer
- Block rendered below the transport row. OrigamAudio injects the playlist list here.
- #prepend-transport
- Buttons rendered at the start of the transport row, before the play button.
- #append-transport
- Buttons rendered at the end of the transport row, after the config menu.
- #extraControlsLeft
- Additional buttons rendered on the left side of the toolbar, after the time display.
- #extraControlsRight
- Additional buttons on the right side of the toolbar, before the config menu. OrigamVideo injects captions / PiP / fullscreen here.
- #configExtra
- Extra rows in the config menu (audio output device, subtitle track selector…).
API
Emits
Événements émis par ce composant.
- @quality-changestring
- Fired when the user picks a quality option from the config menu. Parent owns the <source> swap.
- @downloadvoid
- Fired when the user clicks the Download button in the config menu.
- @previousvoid
- Fired when the previous transport button is clicked. Parent decides skip-back vs playlist jump.
- @nextvoid
- Fired when the next transport button is clicked. Parent owns the playlist action.
- @update:loopModeTAudioLoopMode
- Two-way binding for the loop mode. Emitted when the user cycles the loop button.
- @update:shuffleboolean
- Two-way binding for shuffle state. Emitted on shuffle toggle click.
Personnalisation
Variables CSS
Propriétés CSS personnalisées exposées par ce composant. Surchargez-les pour personnaliser sans perdre la compatibilité avec le thème.
- Color of the filled progress track and thumb.
- Border-radius of the track and progress bar (pill shape by default).
- Color of the volume level bar inside the tooltip.
Inclusion
Accessibilité
Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.
Rôles ARIA
Interactions clavier
| Touche | Action |
|---|---|
| Space / K | Toggle play / pause. |
| ArrowLeft / J | Seek backward (scrubber step or 5 s). |
| ArrowRight / L | Seek forward (scrubber step or 5 s). |
| ArrowUp / ArrowDown | Adjust volume (vertical scrubber when focused). |
| M | Toggle mute. |
Notes
- OrigamMediaScrubber sets role="slider", aria-valuemin, aria-valuemax, aria-valuenow and aria-valuetext on the track element. Keyboard users can seek using ArrowLeft/ArrowRight.
- OrigamMediaVolumeControl mute button receives an aria-label from the muteLabel / unmuteLabel props. These must be translated strings passed by the parent.
- Scrubber transitions and controller fade-in are suppressed under prefers-reduced-motion: reduce.
Fondation
Design tokens
Extrait des tokens de ce composant — les variables --origam-<composant>---<propriété>, déclarées dans sa feuille de tokens tenue à la main, sans étape de build.
- color{color.action.primary.bg}
- Fill color of the scrubber progress bar and thumb.
- dimension{radius.full}
- Border-radius of the track, progress and thumb (pill by default).
Interactif
Playground
Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.
Rendu de l’aperçu en cours…
Usage
Exemples
Extraits de code prêts à coller dans vos templates.
MediaController usage
MediaScrubber standalone
Écosystème
Famille
Composants du même dossier qui partagent les conventions et se composent souvent ensemble.