FRAMEWORKS

React (Vite) video

Complete video infrastructure for a React app. Install the packages and you get uploads, adaptive playback, live streams, DRM, analytics and AI features, without building your own encoding, storage and delivery.

Free plan: 10 videos, 100K streaming minutes, 300 minutes of subtitles and moderation. No credit card.

Node 18+ · React 18+runtime
@fastpix/fastpix-nodeserver SDK
MITlicense

TRUSTED BY PRODUCT TEAMS SHIPPING VIDEO AT SCALE

Customer logoCustomer logoCustomer logoCustomer logoCustomer logoCustomer logo

What you get

What you get from FastPix for React video

Four things you don't have to build or run yourself.

One video API

Upload, storage, delivery, the player, analytics and AI all come from the same API. No Vite plugin, nothing added to your build.

Built-in encoding

FastPix turns each upload into several quality levels and packages them for streaming. No FFmpeg, no queue workers.

Analytics already on

The player sends view data on its own. Add a title and a viewer ID and you can see who watched what.

Secure video streaming and DRM

Sign a token on your server and pass it to the player. Widevine, PlayReady and FairPlay are all supported.

Functionality

Every React video capability, from upload to AI

Pick a group, then a capability. Each one tells you where the code goes and how much of it is actually React work.

Video upload API

Your server creates a signed URL. The browser then uploads the file straight to FastPix in chunks, so nothing passes through your backend. If the connection drops, the upload picks up where it left off.

Where it runs · React component
1<FastPixUploader
2 endpoint={createUpload}
3 accept="video/*"
4/>

Setup

Install and configure the React video packages

Install the React video packages

The uploader and the player run in the browser. The language SDK runs on your server, where it creates upload URLs, signs playback tokens and asks for AI features.

npm
1# Browser: the uploader and the player
2npm i @fastpix/fp-react-uploader @fastpix/fp-player
3
4# Server: Vite has no server of its own, so Express runs beside it
5npm i @fastpix/fastpix-node express
6
7// src/main.jsx: import the uploader stylesheet once
8import "@fastpix/fp-react-uploader/styles.css";
9
10// vite.config.js: development only, this does not survive the build
11server: { proxy: { "/api": "http://localhost:8787" } }

Configure the React video package

There's no API key. You get two values, an Access Token ID and a Secret Key, and they work as a username and password. Both stay on your server.

Get your access token
server.js
1// server.js: never put these in a VITE_ variable,
2// which Vite inlines into the client bundle at build time.
3import { Fastpix } from "@fastpix/fastpix-node";
4
5const fastpix = new Fastpix({
6 security: {
7 username: process.env.FASTPIX_USERNAME, // Access Token ID
8 password: process.env.FASTPIX_PASSWORD, // Secret Key
9 },
10});

A React and Vite project with all of it wired

The uploader, the player, the Express server and the proxy, in one project you can clone and run. Everything in one place instead of four doc pages.

· Vite· React 18· Express
· Resumable upload· HLS playback

Behind the scenes

What happens after your React app uploads a file

Here's what happens between the file leaving the browser and the video reaching a viewer. None of it is code you write, and none of it runs in your app.

480p
1080p
Encoding renditions
4K

Native uploader

Chunked and resumable, from the browser to a signed URL.

Import from a URL

Or pass a public video URL and FastPix pulls it in.

FastPix

Ingest, encode, package

No FFmpeg, no build step, nothing in your output directory.

Chunked, resumable ingest
Transcode to a ladder
Store and version
Package HLS renditions
Thumbnails and captions
Encrypt for DRM

video.media.ready

The webhook that tells your server the video is ready.

Adaptive playback

One playback ID into the player, on-demand or live.

1
2
3

Upload

From your React app

Process

FastPix handles this

Play

Webhook + playback ID

Your React app only touches the two ends. A server call hands over a signed URL and the player takes the playback ID. In between, a video.media.ready webhook tells your server the video is ready.

FAQ

React video questions, answered

  • What's the best way to add video upload to a React app?

    Not a single fetch of the whole file. Create a signed upload URL on a server, then upload in chunks from the browser so a dropped connection costs one chunk instead of the transfer.

  • How do I play HLS video in React?

    Safari plays HLS natively and Chrome, Firefox and Edge do not, so a hand-rolled player carries two code paths and Hls.isSupported() returns false on the one you forget to test.

  • Why does my React video player restart when the component re-renders?

    Because the effect that creates the player is re-running. React 18 StrictMode mounts every effect twice in development, so without a cleanup that calls destroy() you get two instances attached to one video element. A changing src does the same thing in production, which is what catches people refreshing a playback token.

  • Do I need a backend to upload video from a React app?

    You need somewhere to run one function, because the signed URL is created with a Secret Key and a key in the bundle is a published key. A Vite app has no server of its own, so that is a small endpoint or a serverless function.