Skip to content

Commit 4d8f855

Browse files
srikieonlineSrikanth Peddibhotlaavelad
authored
fix: Handle missing window.matchMedia API (#8385)
Some platforms may not support window.matchMedia API. --------- Co-authored-by: Srikanth Peddibhotla <[email protected]> Co-authored-by: Álvaro Velad Galván <[email protected]>
1 parent 933a4f2 commit 4d8f855

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/media/preference_based_criteria.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,8 @@ shaka.media.PreferenceBasedCriteria = class {
279279
static filterVariantsByHDRLevel_(variants, hdrLevel) {
280280
if (hdrLevel == 'AUTO') {
281281
// Auto detect the ideal HDR level.
282-
if (window.matchMedia('(color-gamut: p3)').matches) {
282+
if (window.matchMedia !== undefined &&
283+
window.matchMedia('(color-gamut: p3)').matches) {
283284
const someHLG = variants.some((variant) => {
284285
if (variant.video && variant.video.hdr &&
285286
variant.video.hdr == 'HLG') {

0 commit comments

Comments
 (0)