Skip to content

API Reference parrot_formdesigner.renderers.fields.audio

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_formdesigner.renderers.fields.audio

View source

AudioFieldRenderer — HTML5 field renderer for FieldType.AUDIO.

Renders a FieldType.AUDIO field as a record button + hidden input + inline JavaScript using the MediaRecorder API. The recording button controls start/stop, the waveform indicator provides visual feedback, and the hidden stores the transcribed text (populated via the audio WebSocket or client-side transcription).

This renderer implements the FieldRenderer protocol and is registered in HTML5Renderer._build_registry() for FieldType.AUDIO.

Added by FEAT-224 (FormDesigner Audio Renderer).

Class AudioFieldRenderer

HTML5 field renderer for FieldType.AUDIO fields.

Produces a self-contained HTML snippet with:

  • A label element for the field.
  • A record button (start/stop toggle).
  • A visual waveform indicator.
  • A hidden that stores the transcribed text.
  • Inline JavaScript using the MediaRecorder API.

Implements the FieldRenderer protocol so it can be registered in HTML5Renderer._registry.

Example::

renderer = AudioFieldRenderer()
html_snippet = await renderer.render(field, locale="en")

Method AudioFieldRenderer.render

Render the audio field as an HTML5 snippet.

render(field: FormField, *, locale: str = 'en', prefilled: Any = None, error: str | None = None) -> str

Parameter Type Default Description
field FormField The FormField to render (must be FieldType.AUDIO).
locale str 'en' BCP 47 locale for label resolution.
prefilled Any None Pre-filled transcription text (shown in the hidden input as default value).
error str | None None Optional validation error message.

Returns: str — HTML string with the recording button, waveform, hidden input, and inline JavaScript.

Alias FormField

Re-exported from parrot_formdesigner.core.schema.FormField.

Alias LocalizedString

Re-exported from parrot_formdesigner.core.types.LocalizedString.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally