feat: prefer derived mp4 playback with fallback

This commit is contained in:
William Valentin
2026-02-01 15:58:11 -08:00
parent 4fecfd469f
commit 5058afc980
3 changed files with 75 additions and 5 deletions

View File

@@ -0,0 +1,18 @@
import { test, expect } from "bun:test";
import { pickVideoPlaybackVariant } from "../../app/lib/playback";
test("prefer mp4 derived over original", () => {
const picked = pickVideoPlaybackVariant({
originalMimeType: "video/x-matroska",
variants: [{ kind: "video_mp4", size: 720, key: "derived/video/a.mp4" }],
});
expect(picked).toEqual({ kind: "video_mp4", size: 720 });
});
test("falls back to original when no derived", () => {
const picked = pickVideoPlaybackVariant({
originalMimeType: "video/x-matroska",
variants: [],
});
expect(picked).toEqual({ kind: "original" });
});