Skip to content

Props ​

WaveformRecorderView accepts the props below plus standard View props such as style and testID. Give it a height: the view has no intrinsic size. Event props are listed in Events. Types are in the API reference.

Output ​

All output settings live in one nested output prop. Every field is optional.

tsx
<WaveformRecorderView
  output={{ format: 'm4a', sampleRate: 44100, channels: 1, bitrate: 128000, quality: 'high' }}
/>
FieldTypeDefaultNotes
uristringA file in the cache directoryfile:// URI for the recording. Only used for recordings with a single segment; see Segments.
format'm4a' | 'aac' | 'wav' | 'opus''m4a'See Formats.
sampleRatenumber44100In Hz.
channels1 | 21
bitratenumber128000Bits per second. Ignored for wav. Clamped by quality on Android.
quality'low' | 'medium' | 'high''high'Encoder quality on iOS, bitrate range on Android.

Recording limits and timing ​

PropTypeDefaultNotes
maxDurationMsnumber0Stops automatically when reached: onMaxDurationReached fires, then onComplete. 0 means no limit.
minDurationMsnumber0If stop() is called with less audio than this, the recording is discarded: the state returns to idle and onError fires with code 'min-duration'.
meterUpdatesPerSecondnumber30How often the level is read and onMeter fires. Clamped to 1 to 120.
samplesPerSecondnumber12How many bars per second are added. A bar is added on a meter tick, so it cannot go above meterUpdatesPerSecond.

Bars ​

PropTypeDefaultNotes
playedBarColorColorValuewhiteBars while recording, and the played part during preview.
unplayedBarColorColorValuewhite at 50% opacityThe unplayed part during preview.
futureBarColorColorValueunplayedBarColor, more transparentColor of the futureBarStyle placeholders.
barWidthnumber3In dp or points.
barGapnumber2In dp or points.
barRadiusnumber-1Corner radius. Negative means barWidth / 2.
futureBarStyle'hidden' | 'dot' | 'line''hidden'What fills the empty slots on the left before the bars reach them.
recordingMode'scroll' | 'morph' | 'centered''scroll'Only 'scroll' is implemented. The other values render like 'scroll'.
newSampleEntry'grow' | 'fade' | 'none''grow'Currently every value uses the grow-in animation.

Pill and timer ​

PropTypeDefaultNotes
containerBackgroundColorColorValue#3478F6Background of the pill.
containerBorderRadiusnumber16
showBackgroundbooleantrueSet to false to draw only bars and timer on your own background.
showTimebooleantrueThe m:ss label on the right.
timeColorColorValuewhite
timeMode'count-up' | 'count-down''count-up''count-down' shows the time left until maxDurationMs while recording, and the time left in the file during preview. Without maxDurationMs it counts up while recording.

The default colors are white bars on a blue pill. If you set showBackground={false} on a light screen, also change playedBarColor, unplayedBarColor and timeColor.

Preview ​

PropTypeDefaultNotes
enablePreviewbooleantrueWhen false, enterPreview() fires onError with code 'preview-disabled'.
enableContinueRecordingbooleantrueWhen false, resume() from preview fires onError with code 'continue-disabled'.
showPlayButtonbooleantruePlay and pause button inside the pill during preview.
playButtonColorColorValuewhite

Gestures ​

PropTypeDefaultNotes
enableSlideToCancelbooleanfalseFires onSlideCancel after a drag to the left. Call cancel() yourself.
slideToCancelThresholdDpnumber80Horizontal distance in dp or points.
enableSlideToLockbooleanfalseFires onSlideLock after an upward drag.
slideToLockThresholdDpnumber80Vertical distance in dp or points.

See Slide gestures.

PCM stream ​

PropTypeDefaultNotes
enablePcmStreambooleanfalseFires onPcmChunk while recording. Only with output.format = 'wav'.
pcmChunkMsnumber200Approximate chunk length in ms, at least 20.

See PCM stream.

Background recording ​

PropTypeDefaultNotes
backgroundRecordingbooleanfalseNeeds native setup, see Installation.
backgroundNotificationTitlestring'Recording'Android only.
backgroundNotificationBodystring'Microphone recording in progress.'Android only.

Silence detection ​

PropTypeDefaultNotes
silenceThresholdDbnumber-160Level in dBFS below which the input counts as silent. The default never triggers.
silenceTimeoutMsnumber0How long the level must stay below the threshold. 0 disables detection.
autoStopOnSilencebooleanfalseStop and finalise when silence is detected.

Set both silenceThresholdDb and silenceTimeoutMs to turn detection on. See Silence detection.

Controlled state ​

state is an experimental controlled mode. When it is set, the ref methods stop running transitions and only report the requested state through onStateChange, and changing the prop does not start or stop recording either. Leave it unset and use the ref methods.

Released under the MIT License.