Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
assets/dev/*.mp4 filter=lfs diff=lfs merge=lfs -text
fixtures/*.mov filter=lfs diff=lfs merge=lfs -text
5 changes: 5 additions & 0 deletions .lfsconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Don't auto-download the big regen master on clone/checkout — it's only needed to regenerate
# the dev-seed fixtures. Fetch it on demand with: git lfs pull --include "fixtures/*.mov"
# The small assets/dev/*.mp4 clips are still fetched normally.
[lfs]
fetchexclude = fixtures/*.mov
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ This is an [Expo](https://expo.dev) project created with [`create-expo-app`](htt

## Get started

> **Git LFS required.** The dev-seed video fixtures in `assets/dev/*.mp4` are stored in [Git LFS](https://git-lfs.com). Install it **before/after cloning** or those files arrive as tiny pointer stubs and the dev `+ seed` button breaks:
>
> ```bash
> brew install git-lfs && git lfs install # one-time
> git lfs pull # if you cloned before installing
> ```
>
> The ~400 MB fixture-regen master (`fixtures/bbb_master.mov`) is intentionally **excluded** from normal clones (see `.lfsconfig`); fetch it only when regenerating fixtures: `git lfs pull --include "fixtures/*.mov"`.

1. Install dependencies

```bash
Expand All @@ -16,6 +25,8 @@ This is an [Expo](https://expo.dev) project created with [`create-expo-app`](htt
npx expo start
```

This app uses native modules (`expo-camera`), so it needs a **dev build** (`npm run ios` / `npm run android`), not Expo Go. In a dev build, the Home screen has `+ seed` / `clear` buttons that create/remove a "Dev sample" draft from the bundled `assets/dev/` clips — so the editor is exercisable on a simulator with no camera. See [assets/dev/README.md](assets/dev/README.md) and [docs/implementation-status.md](docs/implementation-status.md).

In the output, you'll find options to open the app in a

- [development build](https://docs.expo.dev/develop/development-builds/introduction/)
Expand Down
63 changes: 63 additions & 0 deletions assets/dev/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Dev fixture clips (§1.0b)

Sample video clips for the **dev seed** — bundled into the app so the timeline editor is
testable on a simulator/emulator with no camera. Dev-only; never shipped in production.

## Current clips

Chosen to match the **video surfaces the app actually meets**, so the seed exercises the real
ingest / normalization path. Derived from [Big Buck Bunny](https://peach.blender.org/) (Blender
Foundation, CC-BY 3.0), a different scene per clip. Each has a burned-in **progress bar + playhead**
(this ffmpeg has no freetype, so a sweeping bar stands in for a timecode) so position is visible
while trimming.

**Portrait** is the primary surface (short-form — the recorder & iPhone Camera). iPhone stores
portrait as a **coded-landscape buffer + 90° rotation matrix** in a **QuickTime** container, _not_
baked-portrait pixels — these fixtures replicate that exactly (so the rotation/normalization path is
actually tested). The **landscape** clips stand in for video added later from the Photos app that
must be normalized into the portrait timeline.

| file | display | coded | rot | fps | codec | container | len |
| -------------------------------- | --------- | --------- | --- | --- | ----- | --------- | --- |
| `portrait-1080p-30fps-h264.mp4` | 1080×1920 | 1920×1080 | 90° | 30 | H.264 | QuickTime | 24s |
| `portrait-1080p-30fps-hevc.mp4` | 1080×1920 | 1920×1080 | 90° | 30 | HEVC | QuickTime | 22s |
| `portrait-1080p-60fps-hevc.mp4` | 1080×1920 | 1920×1080 | 90° | 60 | HEVC | QuickTime | 20s |
| `portrait-4k-60fps-hevc.mp4` | 2160×3840 | 3840×2160 | 90° | 60 | HEVC | QuickTime | 12s |
| `landscape-1080p-30fps-h264.mp4` | 1920×1080 | 1920×1080 | — | 30 | H.264 | MP4 | 24s |
| `landscape-4k-30fps-hevc.mp4` | 3840×2160 | 3840×2160 | — | 30 | HEVC | QuickTime | 14s |

The `portrait-1080p-30fps-h264` clip mirrors **this recorder's exact output** (H.264/AAC 1080p30
portrait, QuickTime bytes named `.mp4`). All have AAC audio and are ~12–24s so there's room to trim.
Regenerate with [`scripts/make-dev-fixtures.sh`](../../scripts/make-dev-fixtures.sh).

## How to add / change clips

1. Drop short `.mp4` files in this folder.
2. List each one in [`src/dev/seed.ts`](../../src/dev/seed.ts) `FIXTURES` (a static `require()` per
file, in the order they should appear on the timeline).
3. In a dev build, tap **`+ seed`** on Home → a single `Dev sample` draft is created with these
clips as segments. The button is idempotent — pressing it again is a no-op (`clear` resets it).

## What clips to pick

Mirror the **real video surfaces the app meets**, and span enough variety to stress normalization:

- **Orientation:** mostly **portrait (9:16)** — the short-form primary; plus some **landscape (16:9)**
to normalize in. iPhone portrait is a coded-landscape buffer + a 90° rotation matrix, so include
rotation-tagged clips (the script does this), not just baked-portrait pixels.
- **Resolution:** mix 1080p and 4K. **Frame rate:** mix 30fps and 60fps.
- **Codec:** mix H.264 and HEVC. **Container:** mix QuickTime (camera) and plain MP4 (shared).
- **Length:** ~12–24s so there's room to trim.

## Size / git (Git LFS)

The clips (~25 MB) are stored in **Git LFS** (`assets/dev/*.mp4`) and fetched on a normal clone, so
`+ seed` works out of the box — just have `git lfs` installed. The regen master
(`fixtures/bbb_master.mov`, ~400 MB) is **also** in LFS but **excluded from normal clones** via
[`.lfsconfig`](../../.lfsconfig); fetch it only when regenerating:

```sh
git lfs pull --include "fixtures/*.mov" # the make-dev-fixtures script does this automatically
```

They rarely change — regenerate with the script rather than hand-editing.
3 changes: 3 additions & 0 deletions assets/dev/landscape-1080p-30fps-h264.mp4
Git LFS file not shown
3 changes: 3 additions & 0 deletions assets/dev/landscape-4k-30fps-hevc.mp4
Git LFS file not shown
3 changes: 3 additions & 0 deletions assets/dev/portrait-1080p-30fps-h264.mp4
Git LFS file not shown
3 changes: 3 additions & 0 deletions assets/dev/portrait-1080p-30fps-hevc.mp4
Git LFS file not shown
3 changes: 3 additions & 0 deletions assets/dev/portrait-1080p-60fps-hevc.mp4
Git LFS file not shown
3 changes: 3 additions & 0 deletions assets/dev/portrait-4k-60fps-hevc.mp4
Git LFS file not shown
18 changes: 11 additions & 7 deletions docs/implementation-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

> **What this is.** A snapshot of where the build actually stands vs. the design docs, the gaps that matter, and a phased plan to continue. Pick this up later as the working checklist. Reconcile against the decisions in [pulse-new-plan.md](pulse-new-plan.md) (forward decisions) and [pulse-original-features.md](pulse-original-features.md) (behavior spec).
>
> **Captured:** 2026-06-04 · **last updated:** 2026-06-05 (Phase A landed, recorder refactor + tooling, commit `4c7aac8`), branch `feat/foundation-home`. Update as phases land.
> **Captured:** 2026-06-04 · **last updated:** 2026-06-08 (real dev-seed fixtures landed + verified on the iOS simulator; clips stored in Git LFS), branch `feat/dev-seed-fixtures`. Update as phases land.

---

Expand All @@ -28,7 +28,8 @@
| Prebuild plugin: disable script sandboxing | [plugins/with-disable-script-sandboxing.js](../plugins/with-disable-script-sandboxing.js) | ✅ lets bundle phase write dev-server `ip.txt` on device builds |
| Routes registered as full-screen modals | [src/app/\_layout.tsx](../src/app/_layout.tsx) | ✅ `recorder` + `timeline` (§2.0) |
| Recorder screen (#2) | [src/app/recorder.tsx](../src/app/recorder.tsx) + [src/features/recorder/](../src/features/recorder/) | ✅ **Phase A complete** — draft-backed, persisted, resumable (see §3) |
| Timeline screen (#3) | [src/app/timeline.tsx](../src/app/timeline.tsx) | 🚧 **stub placeholder only** — next milestone |
| Timeline screen (#3) | [src/app/timeline.tsx](../src/app/timeline.tsx) | 🚧 **stub placeholder only** ("Timeline editor — coming next") — next milestone |
| Dev-seed fixtures + seed/clear | [src/dev/seed.ts](../src/dev/seed.ts) + [assets/dev/](../assets/dev/) | ✅ **real (2026-06-08)** — 6 bundled clips (Git LFS) → one idempotent "Dev sample" draft; verified on simulator (§1.0b) |

**Recorder — what works:** `CameraView`; JIT camera+mic permission gate with Settings fallback (§2.3); tap-to-record start/stop; clips persisted to the document dir + autosaved as `segments` rows; segment bar driven by `useLiveQuery` with inline ✕ delete and hold+drag reorder; real first-frame thumbnails (runtime); camera controls (flip / flash / stabilization); lazy draft creation + empty-draft cleanup; resume a draft from Home via `draftId`; `→` carries `draftId` to `/timeline`.

Expand All @@ -37,6 +38,8 @@
- **Feature-scoped modules.** The recorder lives in [src/features/recorder/](../src/features/recorder/): `use-recorder` (draft + recording state/actions), `use-recorder-permissions`, and presentational `permission-gate` / `camera-controls` / `segment-bar` / `close-button`. [recorder.tsx](../src/app/recorder.tsx) is a thin orchestrator. Convention going forward: `components/` = shared, `features/<screen>/` = feature-scoped.
- **Media utils.** [src/utils/video.ts](../src/utils/video.ts) (`generateThumbnail` cached by uri, `getDurationMs`) and [src/utils/file-store.ts](../src/utils/file-store.ts) (relative-path clip storage over the SDK 56 `File`/`Directory`/`Paths` API).
- **Formatting/lint.** Prettier configured ([.prettierrc.json](../.prettierrc.json), `npm run format` / `format:check`) and wired into ESLint via `eslint-config-prettier`. Codebase is tsc-, lint-, and Prettier-clean.
- **Dev-seed fixtures (Git LFS).** [src/dev/seed.ts](../src/dev/seed.ts) `seedDraft()`/`clearDrafts()` back the Home `+ seed` / `clear` buttons (`__DEV__`-only). `seedDraft()` copies six bundled clips from [assets/dev/](../assets/dev/) onto disk via [`copyIntoSegments`](../src/utils/file-store.ts) (a **byte copy** that leaves the bundled source intact, vs. the move-based `persistRecording`), reads native duration, and inserts them through the production `addSegment` path. The fixtures **match the surfaces the app meets**: 4 portrait + 2 landscape, mixed H.264/HEVC, 1080p/4K, 30/60fps, QuickTime/MP4 containers — and the portrait clips carry an **iPhone-accurate coded-landscape + 90° rotation matrix** (not baked-portrait pixels), so the ingest/rotation path is genuinely exercised. The clips (~25 MB) and the regen master (`fixtures/bbb_master.mov`, ~400 MB, excluded from clones via [.lfsconfig](../.lfsconfig)) live in **Git LFS** — a clone needs `git lfs` installed. Regenerate with [scripts/make-dev-fixtures.sh](../scripts/make-dev-fixtures.sh). Full matrix + rationale in [assets/dev/README.md](../assets/dev/README.md).
- **Recorder capture profile (reference).** `recordAsync()` is called with no options, so a real capture is iOS AVFoundation defaults: **H.264/AAC, 1080×1080… 1920×1080, ~30fps, portrait, QuickTime (`.mov`) bytes** — then persisted **renamed to `.mp4`** (the on-disk extension is always `.mp4`; bytes are unchanged). The `portrait-1080p-30fps-h264` fixture mirrors this exactly. No import-from-Photos path exists yet (`expo-image-picker` is Phase D); when it lands it must normalize the landscape/HEVC variety the fixtures already include.

---

Expand All @@ -45,8 +48,9 @@
### ⚠️ Gap A — Build-order inversion

- **Docs say:** the **timeline editor is Milestone 0** ("editing leads, recording follows," §Build order, 2026-06-02), built on a `DEV_SEED_SEGMENTS` flag + bundled fixtures so it's **emulator-testable with no camera**. The riskiest piece is the native trim/concat module + timeline (§1.0).
- **Reality:** recorder was built first; timeline is a stub; the native module doesn't exist; the dev-seed path that was meant to de-risk the editor on a simulator isn't real — [`devSeedDraft`](../src/db/drafts.ts) inserts DB rows pointing at non-existent `dev/a.mp4` / `dev/b.mp4` files (no clips in `assets/`).
- **Not a mistake to undo** — just means the de-risking the docs planned hasn't happened yet.
- **Reality:** recorder was built first; the native export module doesn't exist; the **timeline editor is still a stub** ("Timeline editor — coming next").
- **Progress (2026-06-08):** the dev-seed path is now **real** — [src/dev/seed.ts](../src/dev/seed.ts) `seedDraft()` builds a real "Dev sample" draft from six bundled `assets/dev/` clips (replacing the old fake `devSeedDraft` that pointed at non-existent `dev/a.mp4`/`dev/b.mp4`). Verified end-to-end on the iOS simulator (seed → 6 segments/116 s, rotation handled in thumbnails, clear teardown, idempotent across 3 taps). So the de-risking the docs planned is now **half done**: the seed exists; the editor that consumes it is the remaining gap.
- **Not a mistake to undo** — the editor-first risk (native trim/concat + timeline UI) is still the next real milestone.

### ✅ Gap B — Recorder doesn't go through the draft model — **RESOLVED (Phase A, 2026-06-05)**

Expand Down Expand Up @@ -88,8 +92,8 @@ Not blocking — recorded here so they aren't forgotten:

Goal: the doc's actual Milestone 0, now testable because Phase A made segments real DB rows.

- [ ] **Dev-seed fixtures** — add 2–3 short clips with **deliberately mismatched res/fps/codec** (§1.0b note) under `assets/dev/`; make `DEV_SEED_SEGMENTS` copy them into a draft dir and route straight into `/timeline`. (Current `devSeedDraft` points at files that don't exist — make them real.)
- [ ] **Timeline editor UI** ([timeline.tsx](../src/app/timeline.tsx)) — clips end-to-end, playhead, `expo-video` preview, **trim** (drag edge → `trimStartMs`/`trimEndMs`), **split** (new row sharing `originalFilename`), Reset. All non-destructive metadata writes (§1.0a/§1.0c).
- [x] **Dev-seed fixtures** ✅ **2026-06-08** — six bundled clips under [assets/dev/](../assets/dev/) (Git LFS), portrait-weighted and realistic (mixed res/fps/codec/container, iPhone-accurate rotation metadata). [src/dev/seed.ts](../src/dev/seed.ts) `seedDraft()` copies them into `drafts/dev-seed/segments/` and inserts segments via the production path; `clearDrafts()` tears it down. Idempotent (fixed `dev-seed` id). Wired to Home `+ seed`/`clear`. Verified on simulator. _Note: routes into `/timeline` (the stub) — the actual editor is the next bullet._
- [ ] **Timeline editor UI** ([timeline.tsx](../src/app/timeline.tsx)) — **still a stub.** Build: clips end-to-end, playhead, `expo-video` preview, **trim** (drag edge → `trimStartMs`/`trimEndMs`), **split** (new row sharing `originalFilename`), Reset. All non-destructive metadata writes (§1.0a/§1.0c). This is where **upright portrait playback** gets its real test (so far confirmed only via thumbnails — the rotation matrix on the fixtures is the thing to get right here).

### Phase C — Native export module (the rebuild risk, §1.0)

Expand All @@ -106,7 +110,7 @@ Goal: the doc's actual Milestone 0, now testable because Phase A made segments r

## 4. Key recommendation

**Phase A is done — Phase B (the timeline editor, real Milestone 0) is next.** Segments are now real DB rows, so start by making the dev-seed path real: drop 2–3 short clips with deliberately mismatched res/fps/codec under `assets/dev/`, have `DEV_SEED_SEGMENTS` copy them into a draft dir, and route straight into `/timeline` — so the editor is buildable/testable on a simulator with no camera. Then build the timeline UI ([timeline.tsx](../src/app/timeline.tsx)) as non-destructive metadata writes (§1.0a/§1.0c), with `draftId` already being passed in from the recorder's `→`. Prototype the native export module (Phase C) early — it's the single biggest rebuild risk.
**Phase A is done, the dev-seed path is now real — the timeline editor UI is the next step.** The dev-seed fixtures landed (2026-06-08): six realistic bundled clips in Git LFS, `seedDraft()` builds a real "Dev sample" draft, verified on a simulator with no camera. So the remaining Phase B work is the **timeline UI** itself ([timeline.tsx](../src/app/timeline.tsx), today a stub) — clips end-to-end, playhead, `expo-video` preview, non-destructive trim/split (§1.0a/§1.0c), with `draftId` already passed in from the recorder's `→`. That screen is also where **upright portrait playback** gets verified for real (the fixtures' rotation metadata is correct; thumbnails already render upright). Prototype the native export module (Phase C) early on these mismatched clips — it's the single biggest rebuild risk.

## 5. Invariants to honor (don't regress these)

Expand Down
3 changes: 3 additions & 0 deletions fixtures/bbb_master.mov
Git LFS file not shown
Loading