Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix MediaCapabilities polyfill on Playstation 4 #4320

Merged
merged 3 commits into from
Jun 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/polyfill/media_capabilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ shaka.polyfill.MediaCapabilities = class {
// See: https://github.com/shaka-project/shaka-player/issues/3582
// TODO: re-evaluate MediaCapabilities in the future versions of PS5
// Browsers.
// Since MediaCapabilities implementation does not exist in PS4 browsers, we
// should always install polyfill.
let canUseNativeMCap = true;
if (shaka.util.Platform.isApple() ||
shaka.util.Platform.isPS5() ||
shaka.util.Platform.isPS4() ||
shaka.util.Platform.isChromecast()) {
canUseNativeMCap = false;
}
Expand Down
10 changes: 9 additions & 1 deletion lib/util/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ shaka.util.Platform = class {
static isApple() {
return !!navigator.vendor && navigator.vendor.includes('Apple') &&
!shaka.util.Platform.isTizen() &&
!shaka.util.Platform.isEOS();
!shaka.util.Platform.isEOS() &&
!shaka.util.Platform.isPS4();
}

/**
Expand All @@ -214,6 +215,13 @@ shaka.util.Platform = class {
return shaka.util.Platform.userAgentContains_('PlayStation 5');
}

/**
* Check if the current platform is Playstation 4.
*/
static isPS4() {
return shaka.util.Platform.userAgentContains_('PlayStation 4');
}

/**
* Returns a major version number for Safari, or Safari-based iOS browsers.
*
Expand Down