Vite-based playground for testing and developing Video.js 10 integrations. Each sandbox is a standalone entry point that demonstrates a different platform, media engine, or scenario.
# From the repo root
pnpm dev:sandbox # sandbox + workspace package watch
pnpm dev # also runs the docs siteOpen the printed URL. The root route renders an interactive shell — a navbar with dropdowns for platform (HTML, React, CDN), preset (video, hls-video, audio, etc.), skin, styling (CSS or Tailwind), and source — that previews the selected combination in an iframe. Use the Open button to pop the preview out into its own tab.
The shell covers the main combinatorial matrix. One-off templates not in that matrix (e.g. firefox-mse-repro, spf-segment-loading, simple-hls-html) are reachable by navigating directly to /<template-name>/. See apps/sandbox/templates/ for the full list.
Three directories participate:
app/— The React-rendered shell served at/, plus shared helpers that sandboxes import via the@app/*alias. Checked into git.templates/— The source of truth for each sandbox. One subdirectory per entry point, each containing its ownindex.htmlandmain.ts/main.tsx. Checked into git.src/— Your working copy where you freely edit, experiment, and break things. Fully gitignored (src/*).
On pnpm dev:sandbox, scripts/setup.ts mirrors every file from templates/ into src/ that doesn't already exist there. Existing files in src/ are never overwritten, so your local changes persist across restarts.
Vite discovers sandbox entries by scanning src/* for subdirectories that contain an index.html — no manual registration is needed.
Note
src/index.html is generated by the serve-app-shell Vite plugin on every dev/build — don't edit it by hand.
Templates can import shared helpers from the app/ directory via the @app alias:
import '@app/styles.css';
import { SOURCES } from '@app/shared/sources';See templates/html-video/main.ts for a minimal reference, or templates/react-video/main.tsx for a React one.
When you've made improvements in src/ that should become the new baseline:
pnpm -F @videojs/sandbox syncThis shows a colored diff of every changed file, then prompts for confirmation before copying src/ changes into templates/. Files that only exist in templates/ are left untouched.
Sync when:
- You've fixed a bug or improved a sandbox and want to preserve it for others.
- You're preparing a commit —
templates/is what gets checked in.
To throw away your local src/ edits and restore from templates/:
pnpm -F @videojs/sandbox resetThis previews every change first and prompts before doing anything. It overwrites modified files, deletes files that exist only in src/, and restores any missing template files. Cannot be undone, so commit or sync anything you want to keep first.
- Create a directory in
templates/(e.g.templates/my-feature/). - Add an
index.htmlentry point and amain.tsormain.tsx. Import shared helpers from@app/*as needed. - Run
pnpm dev:sandbox—setup.tsmirrors the new template intosrc/, and Vite picks it up automatically.