blinkenscreens

Synchronized drawing-and-light show across multiple devices in real-time.

0
0
0
TypeScript
public
Archived

โœจ Blinkenscreens

Create synchronized drawing-and-light shows across multiple devices in real-time!

Turn any event into an interactive art experience. Everyone draws, everyone gets ready, and when you hit play โ€” all screens light up together in perfect sync. ๐ŸŽจ๐Ÿ’ก

๐ŸŽฏ What is this?

A Nuxt 4 web app that combines drawing, WebSockets, and synchronized playback to create shared visual experiences at events. Perfect for parties, workshops, or any gathering where you want people to collaborate creatively!

โœจ Features

๐Ÿ–ผ๏ธ For Participants

  • Fullscreen canvas with four themed prompts (๐Ÿคฉ joy, ๐Ÿ˜ช sad, ๐Ÿ˜ž despair, ๐ŸŽ‰ party)
  • Wake-lock keeps screens on during the show
  • Local storage saves your drawings safely
  • Download your artwork anytime

๐ŸŽ›๏ธ For Event Organizers

  • Admin console at /admin with token auth
  • Live monitoring: see connected devices, latency, and readiness
  • Test mode for practice runs
  • One-click launch when everyoneโ€™s ready

๐Ÿš€ Under the Hood

  • WebSocket sync with automatic latency measurement
  • Clock alignment across all devices
  • Smart countdowns adapt to slowest connection (3x latency + buffer)
  • Schedule-driven playback with flashes, fades, and effects
  • Session resumption survives reconnects

๐Ÿ—๏ธ Tech Stack

  • Nuxt 4 + Vue 3
  • Nitro WebSocket server
  • Canvas API for drawing
  • Wake Lock API for always-on screens
  • localStorage for persistence
  • mkcert for local HTTPS

๐Ÿš€ Quick Start

Prerequisites: Node 20+, pnpm, mkcert

# Install mkcert (if needed)
# macOS: brew install mkcert
# Linux: See https://github.com/FiloSottile/mkcert#installation

# Clone and setup
pnpm install
pnpm prepare  # Generates SSL certs

# Create .env file
echo "NUXT_ADMIN_TOKEN=changeme" > .env

# Start dev server (HTTPS on localhost:3000)
pnpm dev

๐ŸŽฎ Usage

For Participants

  1. Open https://localhost:3000 on your device
  2. Draw something for each of the four prompts
  3. Hit โ€œReadyโ€ when youโ€™re done
  4. Watch the magic happen when admin starts the show! โœจ

For Admins

  1. Open https://localhost:3000/admin
  2. Enter your admin token
  3. Monitor connected devices and their readiness
  4. Test countdown or Start Playback
  5. Watch the synchronized show across all devices ๐ŸŽ†

๐Ÿ“ฆ Scripts

pnpm dev         # Dev server with HTTPS
pnpm build       # Build for production
pnpm preview     # Preview production build
pnpm start:node  # Run production server (requires env vars)

๐ŸŽจ Customizing the Show

Edit server/data/schedule.json to customize timing and effects:

{
  "totalMs": 220000,
  "events": [
    { "label": "up", "time_ms": 12822 },
    { "label": "drop", "time_ms": 51234 }
  ]
}

Effect labels:

  • up / down / ground โ€” Show themed images with fades
  • life / buildup โ€” Repeating flashes
  • drop โ€” Party mode with colorful flashes
  • silence / end โ€” Dimming effects

๐Ÿ“ Project Structure

app/
  โ”œโ”€โ”€ pages/
  โ”‚   โ”œโ”€โ”€ index.vue      # ๐ŸŽจ Participant view
  โ”‚   โ””โ”€โ”€ admin.vue      # ๐ŸŽ›๏ธ Admin console
  โ”œโ”€โ”€ composables/
  โ”‚   โ”œโ”€โ”€ usePlaybackSocket.ts      # WebSocket connection
  โ”‚   โ”œโ”€โ”€ usePlaybackScheduler.ts   # Timeline engine
  โ”‚   โ”œโ”€โ”€ useDrawingCanvas.ts       # Canvas drawing
  โ”‚   โ””โ”€โ”€ useCountdownSync.ts       # Countdown overlay
  โ””โ”€โ”€ components/         # UI components

server/
  โ”œโ”€โ”€ routes/
  โ”‚   โ””โ”€โ”€ playback.ts    # WebSocket handler
  โ”œโ”€โ”€ api/
  โ”‚   โ””โ”€โ”€ schedule.get.ts
  โ””โ”€โ”€ data/
      โ””โ”€โ”€ schedule.json  # Playback timeline

types/
  โ”œโ”€โ”€ topics.ts          # Drawing prompts
  โ””โ”€โ”€ websocket.ts       # Message schemas

๐Ÿ”ง Configuration

Set these environment variables:

# Required
NUXT_ADMIN_TOKEN=your-secret-token

# Production (optional)
HOST=0.0.0.0
NITRO_SSL_CERT=/path/to/ssl.crt
NITRO_SSL_KEY=/path/to/ssl.key

๐Ÿ› Troubleshooting

Admin auth fails?
โ†’ Check NUXT_ADMIN_TOKEN is set in your environment

HTTPS certificate errors?
โ†’ Run mkcert -install and then pnpm prepare

Wake lock not working?
โ†’ Requires HTTPS. Make sure youโ€™re using https:// in the URL.

v0.3.3[beta]