Methane@methane-ui/*
CSS LayoutsComponentsSkillsTheme BuilderGitHub
← All Components

<mth-camera-capture>

@methane-ui/rtc~6.8 KB brotli shell + lazy engine~1.4 KB shell · lazy engine chunk

Accessible camera capture component wrapping MediaDevices.getUserMedia with graceful JSDOM/SSR fallback.

When NOT to use: Use a lightweight @methane-ui/css layout class instead of a custom element when static CSS suffices.

Live Interactive Preview

Interactive StageLive Custom Element · <mth-camera-capture> (@methane-ui/rtc)
Ready · interact with <mth-camera-capture>, or toggle Theme, Direction (LTR/RTL), or props above.

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/rtc/camera-capture"></script>
<mth-camera-capture facing-mode="user" mime-type="image/png"></mth-camera-capture>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
facingModefacing-mode'user' | 'environment'"user"Preferred camera facing mode (user or environment).
deviceIddevice-idstring""Explicit video input device ID.
mimeTypemime-typestring"image/png"Snapshot image MIME type.
qualityqualitynumber0.92Encoder quality (0..1) for lossy image formats.
disableddisabledbooleanfalseDisables camera controls.
labellabelstring""Accessible region label.

Events

EventDetail TypeDescription
mth-capture{ dataUrl: string; width: number; height: number }Fired when a still frame snapshot is captured.
mth-permission-change{ status: unknown }Fired when camera permission or stream status changes.
mth-device-change{ deviceId: string }Fired when the selected camera device changes.
mth-error{ message: string }Fired when camera access or capture encounters an error.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
EnterbothFocus is on Start/Stop or Capture buttonTriggers camera stream toggle or captures a snapshot

Accessibility Checklist

CategoryRequirementVerified By
ariaAll aria-* IDREFs resolve within the same DOM root (ADR-003).scanSameRootAria
focusdelegatesFocus: true with zero host internals.role (ADR-014).lint-plugin & spec-compiler
contrastRenders legible borders, focus outlines, and selection indicators under forced-colors: active.Playwright forced-colors matrix
keyboardImplements all 1 APG keyboard transitions across LTR/RTL.mth-camera-capture.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(active), :state(denied), :state(unsupported).Conformance suite
i18nRoutes 15 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test