Media surface primitives — ImageGenStream, AudioWaveform, VideoPlayer.
Zero runtime deps (canvas + native <video> + native <img>); PdfPreview
deferred to 0.2.x where it'll lazy-load pdf.js.
──────────────────────────────────────────────────────────────────
<ImageGenStream> · Wave 13.G.1
──────────────────────────────────────────────────────────────────
- Driven entirely by props (status + snapshot + finalUrl)
- 4 statuses: idle / streaming / complete / error
- Streaming: blurred partial image + overlay progress bar +
step label (e.g. 'denoising 24/50')
- Complete: drops blur with fade-in
- Error: muted error placeholder (token-tinted danger)
- Host pipes any transport (SSE / WebSocket / polling) into
the snapshot prop — pure presentation
<AudioWaveform> · Wave 13.G.2
- Canvas render with DPR-aware paint
- Two sources: pre-computed peaks (cheapest) OR lazy WebAudio
decode from audioUrl (falls back gracefully w/o AudioContext)
- Click-to-seek (returns 0..1 position)
- Progress overlay tints played bars with progressColor
- Resampling helper handles arbitrary peak-count inputs
<VideoPlayer> · Wave 13.G.4
- Native <video controls> wrapper — accessible by default
- Chapter buttons that seek + auto-play (silently swallows
autoplay rejections)
- Optional in-memory caption track (aria-live polite); hosts
that prefer real WebVTT pass <track> via the slot prop
- Token-tinted; rounded; muted poster background
──────────────────────────────────────────────────────────────────
Quality gates
──────────────────────────────────────────────────────────────────
✓ 10/10 tests passing
- AudioWaveform: 3 cases (canvas size · click-seek math ·
placeholder when no peaks)
- ImageGenStream: 4 cases (idle / streaming / complete /
error)
- VideoPlayer: 3 cases (src · chapter button list · caption
rail)
✓ tsc build clean
✓ Zero new runtime deps; all WebAudio access guarded for SSR
Showcase /futurism/multimodal (MAG.7) lands in the paired showcase
commit.
35 lines
878 B
JSON
35 lines
878 B
JSON
{
|
|
"name": "@bytelyst/media-ui",
|
|
"version": "0.1.0",
|
|
"type": "module",
|
|
"description": "Media surface primitives — AudioWaveform, VideoPlayer, ImageGenStream. Zero runtime deps; PdfPreview deferred to 0.2.x (pdf.js).",
|
|
"exports": {
|
|
".": {
|
|
"import": "./dist/index.js",
|
|
"types": "./dist/index.d.ts"
|
|
}
|
|
},
|
|
"main": "./dist/index.js",
|
|
"types": "./dist/index.d.ts",
|
|
"files": ["dist"],
|
|
"scripts": {
|
|
"build": "tsc",
|
|
"test": "vitest run --pool forks",
|
|
"typecheck": "tsc --noEmit"
|
|
},
|
|
"peerDependencies": {
|
|
"react": ">=18.0.0",
|
|
"react-dom": ">=18.0.0"
|
|
},
|
|
"devDependencies": {
|
|
"@testing-library/react": "^16.3.2",
|
|
"@types/react": "^19.2.14",
|
|
"@types/react-dom": "^19.2.3",
|
|
"happy-dom": "^18.0.1",
|
|
"react": "^19.2.4",
|
|
"react-dom": "^19.2.4",
|
|
"typescript": "^5.7.3",
|
|
"vitest": "^4.0.18"
|
|
}
|
|
}
|