← All Components
<mth-video-player>
Accessible custom-chrome video player with safe-URL validation, keyboard shortcuts, timeline seek, volume, speed control, and fullscreen toggle.
When NOT to use: Use a lightweight @methane-ui/css layout class instead of a custom element when static CSS suffices.
Live Interactive Preview
Ready · interact with <mth-video-player>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/video-player"></script>
<mth-video-player playsinline preload="metadata">Example</mth-video-player>import '@methane-ui/ui/video-player';
import '@methane-ui/react';
export function Example() {
return <mth-video-player playsinline preload="metadata">Example</mth-video-player>;
}<script setup lang="ts">
import '@methane-ui/ui/video-player';
</script>
<template>
<mth-video-player playsinline preload="metadata">Example</mth-video-player>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/video-player';
import { MthVideoPlayerDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthVideoPlayerDirective],
template: `<mth-video-player playsinline preload="metadata">Example</mth-video-player>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/video-player';
import MthVideoPlayer from '@methane-ui/svelte/MthVideoPlayer.svelte';
</script>
<MthVideoPlayer playsinline preload="metadata">Example</MthVideoPlayer>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
src | src | string | "" | Video media URL validated against safe protocols. |
poster | poster | string | "" | Optional poster image URL validated against safe protocols. |
label | label | string | "" | Accessible region label for the player. |
autoplay | autoplay | boolean | false | Requests automatic playback on load. |
loop | loop | boolean | false | Restarts playback from the beginning when ended. |
muted | muted | boolean | false | Starts or keeps audio output muted. |
playsinline | playsinline | boolean | true | Requests inline playback on mobile browsers. |
preload | preload | 'metadata' | 'auto' | 'none' | "metadata" | Native media preload hint. |
playbackRate | playback-rate | number | 1 | Active playback speed multiplier. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-play | undefined | Fired when video playback starts. |
mth-pause | undefined | Fired when video playback pauses. |
mth-timeupdate | { currentTime: number; duration: number } | Fired when playback time advances or seeks. |
mth-ended | undefined | Fired when video playback reaches the end. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| Space / k | both | player container focused | toggles play and pause |
| m | both | player container focused | toggles muted state |
| ArrowLeft / ArrowRight | both | timeline slider focused | seeks backward or forward |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | delegatesFocus: true with zero host internals.role (ADR-014). | lint-plugin & spec-compiler |
| contrast | Renders legible borders, focus outlines, and selection indicators under forced-colors: active. | Playwright forced-colors matrix |
| keyboard | Implements all 3 APG keyboard transitions across LTR/RTL. | mth-video-player.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(playing), :state(paused), :state(muted). | Conformance suite |
| i18n | Routes 10 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |