Skip to content

Commit

Permalink
feat: only polyfill MCap for non Android-based Cast devices.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alvaro Velad committed Apr 27, 2022
1 parent feefd7b commit 5deb7ed
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/polyfill/media_capabilities.js
Expand Up @@ -24,8 +24,8 @@ shaka.polyfill.MediaCapabilities = class {
* @export
*/
static install() {
// Since MediaCapabilities is not fully supported on Chromecast yet, we
// should always install polyfill for Chromecast.
// Since MediaCapabilities is not fully supported on some Chromecast yet,
// we should always install polyfill for all Chromecast not Android-based.
// TODO: re-evaluate MediaCapabilities in the future versions of Chromecast.
// Since MediaCapabilities implementation is buggy in Apple browsers, we
// should always install polyfill for Apple browsers.
Expand All @@ -37,7 +37,7 @@ 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.
if (!shaka.util.Platform.isChromecast() &&
if (!shaka.util.Platform.isAndroidCastDevice() &&
!shaka.util.Platform.isApple() &&
!shaka.util.Platform.isPS5() &&
navigator.mediaCapabilities) {
Expand Down
10 changes: 10 additions & 0 deletions lib/util/platform.js
Expand Up @@ -163,6 +163,16 @@ shaka.util.Platform = class {
return shaka.util.Platform.userAgentContains_('CrKey');
}

/**
* Check if the current platform is a Android-based Cast devices.
*
* @return {boolean}
*/
static isAndroidCastDevice() {
return shaka.util.Platform.isChromecast() &&
shaka.util.Platform.userAgentContains_('Android');
}

/**
* Check if the current platform is Google Chrome.
*
Expand Down

0 comments on commit 5deb7ed

Please sign in to comment.