diff --git a/web/src/lib/api.ts b/web/src/lib/api.ts index bc4ca02..1d0928c 100644 --- a/web/src/lib/api.ts +++ b/web/src/lib/api.ts @@ -214,6 +214,10 @@ export const api = { fileUrlById: (id: number, fileId: number) => `/api/v1/items/${id}/files/${fileId}`, + subtitles: (id: number) => request<{ subtitles: Subtitle[] }>('GET', `/api/v1/items/${id}/subtitles`), + + subtitleUrl: (id: number, trackId: number) => `/api/v1/items/${id}/subtitles/${trackId}`, + progress: (id: number) => request<{ progress: Progress | null }>('GET', `/api/v1/items/${id}/progress`), putProgress: ( @@ -316,6 +320,21 @@ export interface ItemDetail { progress?: Progress } +// Subtitle carries the facts about one subtitle track. The server renders every +// format as WebVTT on the way out, so a client only needs the id to build the +// track URL; Path and StreamIndex stay server-side. +export interface Subtitle { + id: number + /** Where the track came from: "embedded", "sidecar" or "downloaded". */ + source: string + /** Language tag, or "" when the file did not carry one. */ + language: string + /** Human label for the picker, e.g. "English (SDH)". */ + label: string + /** Original format, e.g. "srt", "ass", "vtt". */ + format: string +} + // ── playback engines ──────────────────────────────────────────────────── // Playability is a property of the CLIENT, so a client declares the engines it // has and the server matches them against the file's codec facts. A browser diff --git a/web/src/lib/components/VideoPlayer.svelte b/web/src/lib/components/VideoPlayer.svelte index 01df8ec..59db388 100644 --- a/web/src/lib/components/VideoPlayer.svelte +++ b/web/src/lib/components/VideoPlayer.svelte @@ -1,6 +1,6 @@