From 2f7f63c06795ca6cff542da8b508231108a3c6ad Mon Sep 17 00:00:00 2001 From: Quick <31828688+Quick104@users.noreply.github.com> Date: Fri, 26 Jun 2026 18:28:22 -0400 Subject: [PATCH] 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 --- web/src/player/hooks/useCodecDetection.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/web/src/player/hooks/useCodecDetection.ts b/web/src/player/hooks/useCodecDetection.ts index 774f8a9e..c32d5c71 100644 --- a/web/src/player/hooks/useCodecDetection.ts +++ b/web/src/player/hooks/useCodecDetection.ts @@ -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 }; }, []);