Nonverbal audio: three sustained harmonic tones enter together, ring briefly, then fade to silence.
Customise
Code
<MediaAudioRegionLoop src="/media/pronunciation.wav" title="Harbour sentence · spoken model" transcript="At dawn, the bell answers across the harbour." regionStart={0} regionEnd={2.2} />
Audio Region Loop is a free React audio component for Next.js that returns native playback to one metadata-validated passage. A language learner can repeat a spoken phrase; a sound designer can listen again to a short original recording. The browser still owns the audio controls, and the visible transcript or nonverbal description remains available at every step.
The loop follows native media events rather than a frame clock. Browsers deliver those events at varying rates, so playback may pass the selected end slightly before it seeks back to the start; the component makes no sample-accurate promise. The native player, transcript and direct source link render before hydration, while the loop action appears only when the loaded recording contains the requested region. A failed source, invalid range, or rejected play request leaves ordinary media access intact.
Install
Add the @te registry to your components.json once:
import { MediaAudioRegionLoop } from "@/components/media-audio-region-loop";
export default function Page() {
return (
<MediaAudioRegionLoop
src="/media/pronunciation.wav"
title="Harbour sentence · spoken model"
transcript="At dawn, the bell answers across the harbour."
regionStart={0}
regionEnd={2.2}
/>
);
}
Props
Prop
Type
Default
Description
src
string
required
Consumer-owned audio URL. No microphone or streaming client is used.
title
string
required
Specific visible title for the recording.
transcript
string
required
Complete transcript, or an accurate description for nonverbal audio.
regionStart
number
required
Finite, non-negative start time in seconds.
regionEnd
number
required
Finite end time in seconds, greater than the start and no later than the loaded duration.
className
string
undefined
Additional classes merged onto the section with cn().
Customisation
The component exposes one accent and one track token so consumers can align the passage controls with their theme. Native audio controls keep their browser-provided appearance and semantics.
No. The component reacts to native media events, whose cadence varies by browser and system. Playback can pass the marked end briefly before returning to the start; the component does not promise sample-accurate boundaries.
Does this replace the browser's player?
No. Native audio controls stay available for keyboard, assistive technology, volume and ordinary playback. The additional loop button only enables or stops returning to the requested passage.
What happens when the region or recording is invalid?
The loop control stays hidden with a visible explanation. The title, native player, supplied transcript or description and source link remain available.