From 8284eec22be4417902ff61b4efe0ea8bbe057765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Velad=20Galv=C3=A1n?= Date: Wed, 23 Oct 2024 08:10:39 +0200 Subject: [PATCH] fix: Fix select HLG tracks when using AUTO hdr level (#7470) Fixes https://github.com/shaka-project/shaka-player/issues/7468 --- lib/media/adaptation_set_criteria.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/media/adaptation_set_criteria.js b/lib/media/adaptation_set_criteria.js index 8be5992765..b59366cd2b 100644 --- a/lib/media/adaptation_set_criteria.js +++ b/lib/media/adaptation_set_criteria.js @@ -356,7 +356,14 @@ shaka.media.PreferenceBasedCriteria = class { if (hdrLevel == 'AUTO') { // Auto detect the ideal HDR level. if (window.matchMedia('(color-gamut: p3)').matches) { - hdrLevel = 'PQ'; + const someHLG = variants.some((variant) => { + if (variant.video && variant.video.hdr && + variant.video.hdr == 'HLG') { + return true; + } + return false; + }); + hdrLevel = someHLG ? 'HLG' : 'PQ'; } else { hdrLevel = 'SDR'; }