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 joeyparrish committed Nov 12, 2024
1 parent 3ab75db commit 7e279fa
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 @@ -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);
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 7e279fa

Please sign in to comment.