Skip to content

Commit

Permalink
fix(Xbox): Fix screen resolution detection (#6988)
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad committed Jul 8, 2024
1 parent 247037e commit 4d2aa24
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions lib/util/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -727,15 +727,17 @@ shaka.util.Platform = class {
'screen size 1920x1080.');
}
} else if (Platform.isXboxOne()) {
const protectionCapabilities =
new Windows.Media.Protection.ProtectionCapabilities();
const protectionResult =
Windows.Media.Protection.ProtectionCapabilityResult;
// isTypeSupported may return "maybe", which means the operation is not
// completed. This means we need to retry
// https://learn.microsoft.com/en-us/uwp/api/windows.media.protection.protectioncapabilityresult?view=winrt-22621
let result = null;
maxResolution.width = 1920;
maxResolution.height = 1080;
try {
const protectionCapabilities =
new Windows.Media.Protection.ProtectionCapabilities();
const protectionResult =
Windows.Media.Protection.ProtectionCapabilityResult;
// isTypeSupported may return "maybe", which means the operation is not
// completed. This means we need to retry
// https://learn.microsoft.com/en-us/uwp/api/windows.media.protection.protectioncapabilityresult?view=winrt-22621
let result = null;
const type =
'video/mp4;codecs="hvc1,mp4a";features="decode-res-x=3840,' +
'decode-res-y=2160,decode-bitrate=20000,decode-fps=30,' +
Expand All @@ -745,15 +747,13 @@ shaka.util.Platform = class {
do {
result = protectionCapabilities.isTypeSupported(type, keySystem);
} while (result === protectionResult.maybe);
if (result === protectionResult.probably) {
maxResolution.width = 3840;
maxResolution.height = 2160;
}
} catch (e) {
result = protectionResult.notSupported;
}
if (result === protectionResult.probably) {
maxResolution.width = 3840;
maxResolution.height = 2160;
} else {
maxResolution.width = 1920;
maxResolution.height = 1080;
shaka.log.alwaysWarn('Xbox: Error detecting screen size, default ' +
'screen size 1920x1080.');
}
} else if (Platform.isWebOS()) {
try {
Expand Down

0 comments on commit 4d2aa24

Please sign in to comment.