Skip to content

Commit

Permalink
fix: Fix Windows detection (#7476)
Browse files Browse the repository at this point in the history
Fix Windows detection on platforms which do not implement
`userAgentData` & disable explicitly one workaround on Xbox (as Xbox is
also Windows).
  • Loading branch information
tykus160 authored and avelad committed Oct 24, 2024
1 parent 74f73eb commit 0462d1b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/media/content_workarounds.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,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);
Expand Down
2 changes: 1 addition & 1 deletion lib/util/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

/**
Expand Down

0 comments on commit 0462d1b

Please sign in to comment.