← All Components
<mth-audio-recorder>
Accessible MediaRecorder audio capture control with pause/resume, live input level meter, and duration limit.
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-audio-recorder>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/rtc/audio-recorder"></script>
<mth-audio-recorder mime-type="audio/webm" max-duration="0"></mth-audio-recorder>import '@methane-ui/rtc/audio-recorder';
import '@methane-ui/react';
export function Example() {
return <mth-audio-recorder mime-type="audio/webm" max-duration="0"></mth-audio-recorder>;
}<script setup lang="ts">
import '@methane-ui/rtc/audio-recorder';
</script>
<template>
<mth-audio-recorder mime-type="audio/webm" max-duration="0"></mth-audio-recorder>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/rtc/audio-recorder';
import { MthAudioRecorderDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthAudioRecorderDirective],
template: `<mth-audio-recorder mime-type="audio/webm" max-duration="0"></mth-audio-recorder>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/rtc/audio-recorder';
import MthAudioRecorder from '@methane-ui/svelte/MthAudioRecorder.svelte';
</script>
<MthAudioRecorder mime-type="audio/webm" max-duration="0"></MthAudioRecorder>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
mimeType | mime-type | string | "audio/webm" | Preferred audio recording MIME type. |
maxDuration | max-duration | number | 0 | Maximum recording duration in seconds (0 for unlimited). |
disabled | disabled | boolean | false | Disables recorder controls. |
label | label | string | "" | Accessible region label. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-state-change | { state: unknown } | Fired when recorder state transitions. |
mth-record-complete | { blob: Blob | null; url: string; durationMs: number; mimeType: string } | Fired when recording stops with blob/URL/duration payload. |
mth-level | { level: number } | Fired when input level updates. |
mth-error | { message: string } | Fired on microphone or recorder errors. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| Enter | both | Focus is on Record, Pause, Resume, or Stop button | Transitions recorder state and emits mth-state-change |
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 1 APG keyboard transitions across LTR/RTL. | mth-audio-recorder.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(recording), :state(paused), :state(stopped), :state(unsupported). | Conformance suite |
| i18n | Routes 16 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |