This React component is a locally-based solution for generating still frames from a video source. This method is an alternative to a server-side, Node.js/FFmpeg solution where video frames would be extracted and returned to the client as a sequence of images.
The diagram below illustrates the high-level data and component flow of the application, from initial video load through frame extraction and user-driven scrubbing.
flowchart TD
A[App mounts] --> B{videoReady?}
B -- No --> C[VideoUpload component]
C --> D[preloadVideo<br/>fetch video as Blob]
D --> E[loadVideoMetadata<br/>read duration, width, height]
E --> F[dispatch setVideoState<br/>updates videoSlice]
F --> G[User clicks 'Use Video']
G --> H[onVideoSelectedCallback<br/>setVideoReady=true]
H --> B
B -- Yes --> I[Scrubber component]
I --> J[ScrubberFrames]
I --> K[ScrubberSlider]
J --> L[Compute currentTimes array<br/>duration / scrubberFramesMax]
L --> M[videoFramesToCanvasArray<br/>seek video to each time<br/>draw frame to canvas]
M --> N[setCanvasFrames<br/>array of HTMLCanvasElement]
K --> O[User moves slider]
O --> P[dispatch setCurrentScrubberFrame<br/>updates scrubberSlice]
P --> Q[ScrubberFrames re-renders]
N --> Q
Q --> R[Draw canvasFrames currentScrubberFrame<br/>to visible canvas]
- Load —
VideoUploadpreloads the source video as a Blob and reads its metadata, then dispatches it into the ReduxvideoSlice. - Confirm — Once the user confirms the video,
AppswapsVideoUploadfor theScrubber. - Extract Frames —
ScrubberFramescalculates evenly-spaced time offsets and usesvideoFramesToCanvasArrayto seek a hidden<video>element to each offset, drawing the result into an array of<canvas>elements. - Scrub —
ScrubberSliderdispatches the current frame index to thescrubberSlice;ScrubberFrameslistens for changes and paints the matching cached canvas into the visible canvas.
Make sure you have Node.js installed.
git clone https://github.com/patrick-s-young/react-video-scrubber.git # or clone your own fork
cd react-video-scrubber
yarn install
yarn start- React - JavaScript UI library.
- Redux Toolkit - Opinionated, batteries-included toolset for efficient Redux development.
- TypeScript - Extends JavaScript by adding types to the language.
- webpack - Static module builder.
- Patrick Young - Patrick Young
This project is licensed under the MIT License - see the LICENSE file for details.

