fix(player): detect Firefox HDR via video-dynamic-range media query

Firefox (116+) does not report HDR capability through the standard
`(dynamic-range: high)` media query, but does through
`(video-dynamic-range: high)`. The client codec capabilities check only
queried the former, so HDR-capable Firefox clients reported `hdr: false`
and were denied HDR playback.

Check both queries, keeping the existing `typeof matchMedia` guard so the
second query is also safe in non-browser/SSR contexts (short-circuit).
Other browsers are unaffected: `hdr` can only become true in more cases,
never fewer.

Closes #206

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Quick
2026-06-26 18:28:22 -04:00
co-authored by Claude Opus 4.8
parent 4d2a990de1
commit 2f7f63c067
+7 -2
View File
@@ -170,8 +170,13 @@ export function useCodecDetection() {
// Detect max resolution via reported screen dimensions.
const max_resolution = detectMaxResolutionFromScreen(screen.width, screen.height);
// HDR detection (best effort).
const hdr = typeof matchMedia !== "undefined" && matchMedia("(dynamic-range: high)").matches;
// HDR detection (best effort). Firefox (116+) does not report HDR via the
// standard `(dynamic-range: high)` query but does via `(video-dynamic-range: high)`,
// so check both.
const hdr =
typeof matchMedia !== "undefined" &&
(matchMedia("(dynamic-range: high)").matches ||
matchMedia("(video-dynamic-range: high)").matches);
return { codecs_video, codecs_audio, containers, max_resolution, hdr };
}, []);