# 📹 Tape Camera A/V Feature Plan > **Goal**: Enable `tape camera` (or shorthand like `tc` or `tok`) to record a TikTok-style video with synchronized audio/video from the device camera + microphone, then play it back and allow posting. --- ## 📋 Current State Analysis ### Camera System (`camera.mjs`) **Location**: `/system/public/aesthetic.computer/disks/camera.mjs` **Current Capabilities**: - ✅ Webcam/device camera access via `video("camera")` API - ✅ Front/back camera switching ("user" / "environment" facing) - ✅ Real-time pixel shader effects (sparkles) - ✅ Frame capture to painting system - ❌ **No video recording** - only still captures - ❌ **No audio support** - purely visual - ❌ **Responsiveness issues** - layout doesn't adapt well to different screen sizes **Responsiveness Problems**: - Video fills painting frame size, not screen - No aspect ratio handling for portrait vs landscape - Swap button positioning is fixed (`bottom: 6, right: 6`) - No fullscreen/immersive mode for TikTok-style recording ### Tape System (`prompt.mjs` + `disk.mjs`) **Location**: `/system/public/aesthetic.computer/disks/prompt.mjs` (lines 5390-5650) **Current Capabilities**: - ✅ Screen recording via canvas capture - ✅ Frame-based or time-based recording modes - ✅ Microphone support with `tape:mic` / `tape:nomic` flags - ✅ Recording progress bar overlay - ✅ Automatic jump to `video.mjs` for playback/export - ✅ MP4, GIF, WebP export options - ❌ **No camera video input** - only captures canvas/screen - ❌ **Audio is separate from video** - mic records to separate track ### Current Tape Commands ``` tape [duration] [flags] # Record screen for N seconds tape 30f $code # Record 30 frames of a KidLisp piece tape:mic # Enable microphone tape:nomic # Disable microphone tape:cut / cut # Stop recording early ``` ### Video Piece (`video.mjs`) **Location**: `/system/public/aesthetic.computer/disks/video.mjs` **Current Capabilities**: - ✅ Playback of recorded frames - ✅ Scrubbing (STAMPLE-style lazy following) - ✅ Export to GIF, MP4, WebP, ZIP - ✅ POST to ATProto (Bluesky) - ❌ **Audio playback is buggy** - often out of sync - ❌ **No camera preview during playback** ### BIOS Recording System (`bios.mjs`) **Location**: `/system/public/aesthetic.computer/bios.mjs` (lines 730-900, 7300-8700) **Current Capabilities**: - ✅ MediaRecorder API for canvas capture - ✅ Frame buffer storage - ✅ Timing/timestamp tracking - ✅ Codec support (H.264 for MP4) - ❌ **No webcam stream integration** - only canvas capture - ❌ **Audio mixing** - mic is separate from system audio --- ## 🎯 Proposed Feature: `tape camera` ### User Flow (TikTok-style) 1. **Start**: User types `tape camera` (or `tc` / `tok`) 2. **Permission**: Browser requests camera + microphone access 3. **Preview**: Full-screen camera view with countdown (3, 2, 1...) 4. **Recording**: - Live camera feed shown on screen - Red recording indicator - Progress bar at top - Microphone capturing audio - Optional duration limit (default 60s for TikTok style) 5. **Finish**: Tap screen or wait for timer to stop 6. **Playback**: Jump to `video.mjs` with A/V preview 7. **Post**: User can POST to ATProto with one tap ### Shorthand Commands for `prompt.mjs` | Command | Expands To | Description | |---------|-----------|-------------| | `tc` | `tape camera` | Quick TikTok-style recording | | `tok` | `tape camera` | TikTok-inspired shorthand | | `toks` | `tape camera:selfie` | Front-facing camera | | `selfievid` | `tape camera:selfie` | Explicit selfie video | **Additional Flags**: ``` tape camera # Default (rear camera, with mic) tape camera:selfie # Front-facing camera tape camera:nomic # Without microphone tape camera:15 # 15-second max duration tape camera~filter # With filter effect (future) ``` --- ## 🏗️ Implementation Plan ### Phase 1: Camera Recording Foundation #### 1.1 Create `tape-camera.mjs` piece **New file**: `/system/public/aesthetic.computer/disks/tape-camera.mjs` ```javascript // Tape Camera - TikTok-style A/V recording // Combines camera.mjs video feed with tape recording system let vid, stream; let recording = false; let countdown = 3; let maxDuration = 60; // seconds function boot({ params, colon }) { // Parse params: selfie, duration, nomic const selfie = colon.includes('selfie') || params.includes('me'); maxDuration = parseInt(params.find(p => !isNaN(p))) || 60; } function paint({ video, screen, wipe }) { if (countdown > 0) { // Show countdown overlay wipe(0); ink(255, 0, 0).write(countdown, { center: "xy", size: 8 }); return; } // Fullscreen camera feed vid?.(); if (recording) { // Red recording dot + progress bar ink(255, 0, 0).circle(screen.width - 20, 20, 8, true); } } ``` #### 1.2 Extend BIOS for Camera Stream Recording **Modify**: `/system/public/aesthetic.computer/bios.mjs` - Add `mediaRecorder` support for camera + mic streams (not just canvas) - Combine `getUserMedia` video + audio into single MediaRecorder - Store as WebM/MP4 with embedded audio track #### 1.3 Update `video.mjs` for A/V Playback - Load recorded video as HTML `