Skip to content

Commit

Permalink
fix: Fix MediaCapabilities polyfill on Playstation 4 (#4320)
Browse files Browse the repository at this point in the history
Add Playstation 5 detection to the Media Capabilities Polyfill install method.

Fixes #4320
  • Loading branch information
bcupac authored and joeyparrish committed Jul 14, 2022
1 parent ccc9d1e commit 68fc5c4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/polyfill/media_capabilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ shaka.polyfill.MediaCapabilities = class {
// Browsers.
if (!shaka.util.Platform.isChromecast() &&
!shaka.util.Platform.isApple() &&
!shaka.util.Platform.isPS4() &&
!shaka.util.Platform.isPS5() &&
navigator.mediaCapabilities) {
shaka.log.info(
Expand Down
10 changes: 9 additions & 1 deletion lib/util/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,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 @@ -204,6 +205,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

0 comments on commit 68fc5c4

Please sign in to comment.