adds favorites
This commit is contained in:
13
AGENTS.md
13
AGENTS.md
@@ -6,18 +6,18 @@ This project is a web video player for clients that can decode audio and still i
|
||||
|
||||
The UI intentionally has only two screens:
|
||||
|
||||
- URL entry screen with a stream URL input, a `Next` button, and globally stored recently played URLs.
|
||||
- URL entry screen with a stream URL input, a `Next` button, globally stored recently played URLs, and globally stored favorites.
|
||||
- Fullscreen player screen with JPEG frames drawn to a canvas and native audio playback through an `<audio>` element.
|
||||
- Playback controls are overlay controls toggled by tapping/clicking the frame area, similar to YouTube.
|
||||
- Do not reintroduce debug panels, frame counters, settings forms, explanatory marketing copy, or visible ffmpeg details into the normal UI.
|
||||
|
||||
The backend stores recently played URLs globally, not per-browser. The default path is `data/recent-urls.json`, configurable with `RECENT_URLS_PATH`. Docker Compose persists this through the `frame-stream-data` volume.
|
||||
The backend stores recently played URLs and favorites globally, not per-browser. The default recent URL path is `data/recent-urls.json`, configurable with `RECENT_URLS_PATH`. The default favorites path is `data/favorites.json`, configurable with `FAVORITES_PATH`. Docker Compose persists both through the `frame-stream-data` volume.
|
||||
|
||||
## Core Architecture
|
||||
|
||||
The app is plain Node/Express plus browser JavaScript:
|
||||
|
||||
- `server/index.js`: API, WebSocket, source proxy/relay, ffmpeg process lifecycle, recent URL persistence.
|
||||
- `server/index.js`: API, WebSocket, source proxy/relay, ffmpeg process lifecycle, recent URL and favorites persistence.
|
||||
- `public/index.html`: frontend markup.
|
||||
- `public/app.js`: URL submission, WebSocket frame receiving, audio element coordination, canvas drawing, overlay controls.
|
||||
- `public/styles.css`: two-screen player UI.
|
||||
@@ -28,6 +28,8 @@ Main public endpoints:
|
||||
|
||||
- `POST /api/session`: validates the stream URL, stores recent URL, creates a short-lived playback session.
|
||||
- `GET /api/recent-urls`: returns global recent URL entries with `url`, redacted `displayUrl`, and `lastPlayedAt`.
|
||||
- `GET /api/favorites`: returns global favorite entries with `title` and `url`.
|
||||
- `PUT /api/favorites`: replaces the global favorites list. Each favorite has a user-provided `title` and stream `url`.
|
||||
- `GET /audio/:sessionId`: serves MP3 audio to the browser audio element.
|
||||
- `WS /frames/:sessionId`: sends timed JPEG frame packets to the browser.
|
||||
- `GET /api/health`: exposes basic health and active playback connection mode.
|
||||
@@ -170,6 +172,8 @@ Runtime:
|
||||
- `PLAYBACK_CONNECTION_MODE`: `split`, `relay`, or `single`.
|
||||
- `RECENT_URLS_PATH`: recent URL JSON path.
|
||||
- `RECENT_URL_LIMIT`: recent URL count, default `12`.
|
||||
- `FAVORITES_PATH`: favorites JSON path.
|
||||
- `FAVORITES_LIMIT`: favorites count, default `50`.
|
||||
- `MAX_WS_BUFFER_BYTES`: server-side WebSocket JPEG frame backlog cap, default `2097152`.
|
||||
- `MAX_AUDIO_QUEUE_BYTES`: single-mode audio output queue cap, default `16777216`.
|
||||
- `MAX_RELAY_BRANCH_QUEUE_BYTES`: relay per-branch compressed-input queue cap, default `16777216`.
|
||||
@@ -218,6 +222,7 @@ Start a mode locally:
|
||||
|
||||
```sh
|
||||
PORT=3014 RECENT_URLS_PATH=/tmp/carplay-relay-recent.json \
|
||||
FAVORITES_PATH=/tmp/carplay-relay-favorites.json \
|
||||
FFMPEG_LOG_LEVEL=warning FFMPEG_INPUT_SEEKABLE=0 \
|
||||
PLAYBACK_CONNECTION_MODE=relay npm start
|
||||
```
|
||||
@@ -225,7 +230,7 @@ PORT=3014 RECENT_URLS_PATH=/tmp/carplay-relay-recent.json \
|
||||
After smoke testing, remove generated assets:
|
||||
|
||||
```sh
|
||||
rm -f public/_relay-smoke.ts /tmp/carplay-*-recent.json
|
||||
rm -f public/_relay-smoke.ts /tmp/carplay-*-recent.json /tmp/carplay-*-favorites.json
|
||||
```
|
||||
|
||||
## Security Notes
|
||||
|
||||
Reference in New Issue
Block a user