From 7e279fae8d0ccaba58863d436c61894610813b86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Tyczy=C5=84ski?= Date: Wed, 23 Oct 2024 12:58:48 +0200 Subject: [PATCH] fix: Fix Windows detection (#7476) Fix Windows detection on platforms which do not implement `userAgentData` & disable explicitly one workaround on Xbox (as Xbox is also Windows). --- lib/media/content_workarounds.js | 3 ++- lib/util/platform.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/media/content_workarounds.js b/lib/media/content_workarounds.js index ae06b16615..8d7d931429 100644 --- a/lib/media/content_workarounds.js +++ b/lib/media/content_workarounds.js @@ -176,7 +176,8 @@ shaka.media.ContentWorkarounds = class { // patched one, otherwise video element throws following error: // CHUNK_DEMUXER_ERROR_APPEND_FAILED: Sample encryption info is not // available. - if (shaka.util.Platform.isEdge() && shaka.util.Platform.isWindows()) { + if (shaka.util.Platform.isEdge() && shaka.util.Platform.isWindows() && + !shaka.util.Platform.isXboxOne()) { const doubleInitSegment = new Uint8Array(initSegment.byteLength + modifiedInitSegment.byteLength); doubleInitSegment.set(modifiedInitSegment); diff --git a/lib/util/platform.js b/lib/util/platform.js index 0f06c7ec92..2bdb8daee9 100644 --- a/lib/util/platform.js +++ b/lib/util/platform.js @@ -503,7 +503,7 @@ shaka.util.Platform = class { if (!navigator.platform) { return false; } - return navigator.platform.toLowerCase().includes('windows'); + return navigator.platform.toLowerCase().includes('win32'); } /**