junkpile

20 · Tauri v1 Live Video Switcher

A standalone Tauri v1 + raw WebGL example that turns four reusable media slots into a compact software video switcher. Each source can be a generated test pattern, still image, looping video, or the shared live camera. Preview and Program buses feed GPU transitions, a lower-third/logo overlay, MediaRecorder capture, and PNG export.

Run

npm install
npm run dev

On macOS, approve camera permission only when you assign a camera to a source slot.

Signal flow

Source 1 ┐
Source 2 ├─→ Preview / Program buses ─→ WebGL transition ─→ overlay ─→ stage
Source 3 ┤                                                       ├─→ MediaRecorder
Source 4 ┘                                                       └─→ PNG export

Source rack

All four source slots support:

Only one camera stream is opened. Assigning it to another source moves the live input and restores the previous slot’s generated pattern.

Switching

GPU transitions

  1. Dissolve
  2. Horizontal wipe
  3. Vertical wipe
  4. Radial reveal
  5. Box reveal
  6. Noise dissolve
  7. Luma melt

The four source textures stay resident in WebGL. The fragment shader chooses the active Program and Preview samplers, generates the transition mask, composites the overlay texture, and applies the final fade-to-black control.

Program graphics

The text and logo are drawn into a transparent 2D canvas, uploaded as a WebGL texture, and composited in the final fragment pass.

Output and inspection

macOS permissions

src-tauri/Info.plist includes NSCameraUsageDescription and entitlements.plist enables the camera entitlement. Camera frames remain local to the application.

Important WebView notes

Project layout

20-tauri-v1-live-video-switcher/
├── package.json
├── README.md
├── src/
│   ├── index.html
│   ├── styles.css
│   └── app.js
└── src-tauri/
    ├── Cargo.toml
    ├── Info.plist
    ├── entitlements.plist
    ├── tauri.conf.json
    ├── build.rs
    ├── icons/
    └── src/main.rs