Browser demo
The library only runs on iOS and Android, so this page uses a web approximation instead. It redraws the native view on a canvas with the same layout, bar animation and defaults, and runs the same state rules for the ref methods. Use it to get a feel for the props and to see which events fire and when.
What to try
- Press
start()and speak. The bars enter from the right atsamplesPerSecond, andonMeterupdatesmeterUpdatesPerSecondtimes per second. - While recording, drag on the pill. Dragging left reports
cancelProgressand, pastslideToCancelThresholdDp, firesonSlideCancel; the demo then callscancel(), just as your app would. Dragging up firesonSlideLock; the "Locked" label is host UI, the library draws nothing for it. - Press
enterPreview(), then play and drag on the bars to seek.resume()from preview starts a new segment. - Turn on silence detection, stay quiet and watch
onSilenceDetected. - Set
maxDurationMsto10000to seeonMaxDurationReachedfollowed byonComplete. - Switch
enablePrevieworenableContinueRecordingoff to see the matchingonErrorcodes.
How it differs from the native view
| Native view | This demo | |
|---|---|---|
| Audio input | AVAudioRecorder, MediaRecorder or AudioRecord | getUserMedia and Web Audio, or a simulated voice |
| Output file | m4a by default, see output | Always mono 16-bit WAV in a blob: URL |
| Meter | iOS average power, Android peak level | Both mappings computed from the browser's samples |
| Gesture units | dp on Android, points on iOS | CSS pixels |
| Permission refused | onPermissionDenied | onPermissionDenied, then you can switch to the simulated voice |
The demo never uploads audio. Everything stays in the page and is discarded when you leave it.