Back to Blog
Technical

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.

Christian Segovia March 1, 2026 5 min read

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

  1. Sign up at app.vidtreo.com
  2. Create an environment
  3. 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

  1. Browser captures video via MediaStream API
  2. Our engine produces optimized MP4 in real-time
  3. Compact file uploads to VIDTREO’s global edge storage
  4. AI transcription runs automatically
  5. 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

Get Started Free →

Share this article