Add Video Recording to React in 5 Minutes
A step-by-step tutorial on integrating browser-based video recording into your React app using the VIDTREO SDK.
TL;DR
- Install
@vidtreo/recorder-react - Add
<VidtreoRecorder />component - That’s it. Your users can record video.
Step 1: Install the SDK
npm install @vidtreo/recorder-react
Step 2: Get Your API Key
- Sign up at app.vidtreo.com
- Create an environment
- Copy your API key
Step 3: Add the Recorder Component
import { VidtreoRecorder } from '@vidtreo/recorder-react'
function App() {
return (
<VidtreoRecorder
apiKey="your-api-key"
onUploadComplete={(result) => {
console.log('Video recorded:', result.uploadUrl)
}}
/>
)
}
That’s the minimal integration. The component handles:
- Camera/microphone permission requests
- Recording controls (start, stop, pause)
- Browser-native MP4 encoding
- Upload to VIDTREO’s edge storage
- Error handling and retry logic
Step 4: Customize (Optional)
<VidtreoRecorder
apiKey="your-api-key"
maxRecordingTime={120_000}
lang="en"
onUploadComplete={(result) => {
// Handle completed recording
}}
onError={(error) => {
// Handle errors
}}
/>
Using the Hook for Custom UI
Want full control over the UI? Use the useVidtreoRecorder hook:
import { useEffect, useRef } from 'react'
import { useVidtreoRecorder } from '@vidtreo/recorder-react'
function CustomRecorder() {
const videoRef = useRef(null)
const { state, actions } = useVidtreoRecorder({
apiKey: 'your-api-key',
onUploadComplete: (result) => console.log('Uploaded:', result.uploadUrl),
})
useEffect(() => {
actions.startPreview()
}, [])
useEffect(() => {
if (videoRef.current && state.stream) videoRef.current.srcObject = state.stream
}, [state.stream])
return (
<div>
<video ref={videoRef} autoPlay muted playsInline />
{state.recordingState === 'idle' && (
<button onClick={() => actions.startRecording()}>Record</button>
)}
{state.recordingState === 'recording' && (
<button onClick={() => actions.stopRecording()}>Stop</button>
)}
</div>
)
}
What Happens Under the Hood
- Browser captures video via MediaStream API
- Our engine produces optimized MP4 in real-time
- Compact file uploads to VIDTREO’s global edge storage
- AI transcription runs automatically
- Webhook fires to notify your backend
All of this happens with zero server-side processing on your end.
Pricing
- Free tier: $1 credit (~100 HD minutes)
- Video recording: $0.008 to $0.015 per minute by resolution ($0.010 in HD), storage and transcription included; audio $0.005
- No monthly fee, no credit card required to start
Next Steps
Related Posts
How to Add One-Way Video Interviews to Your ATS
A step-by-step tutorial: record candidate answers in the browser with the VIDTREO SDK, tie each one to the candidate record, and get the transcript into your ATS by webhook.
AI Transcription & Summaries: Why Your Video Platform Needs Them Built In
Standalone speech-to-text APIs list at $0.0025 to $0.016 per minute and add another integration. See how VIDTREO transcribes every recording in the per-minute price and adds summaries with Intelligence.