feat(media): subtitles that travel with the film — CLI, browser <track>, ExoPlayer

`shade media put Film.mkv` seals Film.srt / Film.no.srt / Film.en.vtt
found beside it and carries their grants in the film's sealed meta
(extra["shade.subtitles"]), so they follow the film alone or in an album
and the relay sees unrelated objects. /watch/ adds them as <track>s (SRT
to VTT, labels in the viewer's language, the viewer's language on, one at
a time); `media get` writes them back; Android opens them with
ShadeMedia.openFilm and gives them to ExoPlayer as side-loaded tracks
(ShadeMediaDataSource now resolves readers by URI).

Verified: 76 TS tests; Chromium nb-NO shows the Norwegian track only, en-US
the English one; film + subtitles round-trip bit-identical; Robolectric
ExoPlayer sees both text tracks with the Norwegian one default; a shared
vector checks the meta field in Kotlin (82/0).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-10-18 22:01:33 +02:00
parent 9efe1bcfd3
commit 422a37e830
19 changed files with 536 additions and 26 deletions

View File

@@ -155,6 +155,22 @@
"Ekstra",
"kanal"
]
},
{
"description": "subtitles: film meta with extra[\"shade.subtitles\"] naming two sealed subtitle files",
"meta": "{\"name\":\"Film.mkv\",\"mime\":\"video/x-matroska\",\"extra\":{\"shade.subtitles\":\"[{\\\"lang\\\":\\\"no\\\",\\\"label\\\":\\\"Norsk\\\",\\\"grant\\\":{\\\"kind\\\":\\\"shade.media-grant/v1\\\",\\\"mediaId\\\":\\\"VVVVVVVVVVVVVVVVVVVVVQ\\\",\\\"key\\\":\\\"IiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiI\\\",\\\"root\\\":\\\"3333333333333333333333333333333333333333333333333333333333333333\\\",\\\"url\\\":\\\"https://relay.example/v1/media/11111111111111111111111111111111\\\",\\\"meta\\\":{\\\"name\\\":\\\"Film.no.srt\\\"}}},{\\\"lang\\\":\\\"en\\\",\\\"grant\\\":{\\\"kind\\\":\\\"shade.media-grant/v1\\\",\\\"mediaId\\\":\\\"ZmZmZmZmZmZmZmZmZmZmZg\\\",\\\"key\\\":\\\"IiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiI\\\",\\\"root\\\":\\\"3333333333333333333333333333333333333333333333333333333333333333\\\",\\\"url\\\":\\\"https://relay.example/v1/media/11111111111111111111111111111111\\\",\\\"meta\\\":{\\\"name\\\":\\\"Film.en.vtt\\\"}}}]\"}}",
"langs": [
"no",
"en"
],
"labels": [
"Norsk",
null
],
"mediaIds": [
"55555555555555555555555555555555",
"66666666666666666666666666666666"
]
}
]
}