domain glossary, context map, ADRs (library-as-source, playout, event queue)

This commit is contained in:
2026-07-12 06:30:08 +02:00
parent f45eb38d97
commit efd15c4f53
6 changed files with 219 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
# ADR-0002: K-TV owns the stream via a Playout Service
## Status
Accepted
## Context
The original design proxied streaming to each provider — Jellyfin served its own HLS, local files were either served directly or transcoded individually. This made it impossible to:
- Inject SCTE-35 markers for mid-roll breaks
- Insert timed metadata for overlays
- Stitch interstitial content between program items into a continuous stream
- Guarantee consistent stream format across providers
## Decision
K-TV owns the stream end-to-end via a Playout Service. Providers expose a source URI (network URL or local file path) instead of a viewer-facing playback URL. The Playout Service reads from the source URI using FFmpeg on-demand (no full file download), and produces the HLS output with all audio/subtitle tracks, segmentation, SCTE-35, and timed metadata.
## Alternatives considered
- **Continue proxying to provider streams** — rejected because mid-roll breaks, interstitials, and overlays require playlist-level control that provider-owned streams don't offer.
- **Download files locally then transcode** — rejected because it duplicates storage and defeats the purpose of having providers manage content.
## Consequences
- Provider port changes from "give me a playback URL" to "give me a source URI."
- Every stream goes through FFmpeg — CPU cost scales with concurrent viewers. Caching segments mitigates repeat access.
- Subtitles and audio tracks come from the source container — no separate subtitle API needed.
- All viewers get a uniform HLS experience regardless of provider.
- Disk space management becomes critical — HLS segments must be cleaned up.