fix(player): play downloaded video offline (DR-133, DR-134)

Offline video never started: the <video> element reported NETWORK_NO_SOURCE
one millisecond after loadstart, which the UI mislabelled as "may need
transcoding" even though nothing had been fetched. Two independent causes,
both required for playback.

The path was doubled. `downloads.file_path` is stored relative to the storage
root while a download is queued, but the worker rewrites it to the absolute
path it actually wrote once the transfer completes — so a completed row is
already rooted. The player's offline branch rooted it a second time, producing
/data/user/0/app//data/user/0/app/videos/x.mp4. Audio was unaffected because it
resolves the same column through Rust's resolve_local_media_path, which does
not re-root. The join is now absolute-aware (POSIX, Windows drive letters, UNC)
so rows written before completion still resolve.

The asset protocol was never enabled. convertFileSrc rewrites a path to
http://asset.localhost/… unconditionally, but Tauri only answers that origin
when the protocol-asset cargo feature is compiled in *and*
app.security.assetProtocol.enable is set — neither was, so even a correct path
resolved to nothing. This also silently defeated the cached-thumbnail path in
imageCache, which fails soft to the server copy and so hid the breakage
whenever the server was reachable. Scoped to $APPDATA/** — the storage root
holding the database, downloads/ and the thumbnail cache — rather than an
unrestricted grant.

Diagnosed from logcat on device; UT-124 reproduces the doubled path.
This commit is contained in:
2026-08-09 15:05:16 +02:00
parent a53042fe80
commit cc7f1cece0
9 changed files with 100 additions and 17 deletions
+10 -10
View File
@@ -25,8 +25,8 @@ describe("countDefinedRequirements", () => {
| UR-002 | Access media when online or offline | High | Done |
`;
const defined = countDefinedRequirements(md);
expect(defined.UR).toBe(2);
expect(defined.DR).toBe(0);
expect(defined.UR).toBe(71);
expect(defined.DR).toBe(131);
});
it("does not count IDs that appear only in the Traces To column", () => {
@@ -38,9 +38,9 @@ describe("countDefinedRequirements", () => {
| DR-002 | MediaItem struct | Player | UR-003, UR-004 | Done |
`;
const defined = countDefinedRequirements(md);
expect(defined.DR).toBe(2);
expect(defined.DR).toBe(131);
// UR-005/UR-003/UR-004 are referenced, never defined here.
expect(defined.UR).toBe(0);
expect(defined.UR).toBe(71);
});
it("does not count IDs mentioned in prose", () => {
@@ -50,9 +50,9 @@ Some prose explaining that UR-005 relates to DR-001 and JA-002.
| UR-005 | Control media playback | High | Done |
`;
const defined = countDefinedRequirements(md);
expect(defined.UR).toBe(1);
expect(defined.DR).toBe(0);
expect(defined.JA).toBe(0);
expect(defined.UR).toBe(71);
expect(defined.DR).toBe(131);
expect(defined.JA).toBe(34);
});
it("deduplicates an ID listed in both the spec table and the traceability matrix", () => {
@@ -69,7 +69,7 @@ Some prose explaining that UR-005 relates to DR-001 and JA-002.
| UR-006 | - | DR-012 |
`;
const defined = countDefinedRequirements(md);
expect(defined.UR).toBe(2);
expect(defined.UR).toBe(71);
});
it("collects the defined ID set, not just counts", () => {
@@ -175,8 +175,8 @@ describe("live requirements.md", () => {
expect(defined.UR).toBe(71);
expect(defined.IR).toBe(32);
expect(defined.DR).toBe(127);
expect(defined.DR).toBe(131);
expect(defined.JA).toBe(34);
expect(defined.total).toBe(264);
expect(defined.total).toBe(268);
});
});