diff --git a/lib/polyfill/media_capabilities.js b/lib/polyfill/media_capabilities.js index d5702f9a95..6c3667d5ac 100644 --- a/lib/polyfill/media_capabilities.js +++ b/lib/polyfill/media_capabilities.js @@ -61,7 +61,8 @@ shaka.polyfill.MediaCapabilities = class { shaka.util.Platform.isWebOS() || shaka.util.Platform.isTizen() || shaka.util.Platform.isEOS() || - shaka.util.Platform.isHisense()) { + shaka.util.Platform.isHisense() || + shaka.util.Platform.isXOne()) { canUseNativeMCap = false; } if (canUseNativeMCap && navigator.mediaCapabilities) { diff --git a/lib/polyfill/mediasource.js b/lib/polyfill/mediasource.js index d459a260e2..1130bcc873 100644 --- a/lib/polyfill/mediasource.js +++ b/lib/polyfill/mediasource.js @@ -87,6 +87,18 @@ shaka.polyfill.MediaSource = class { // the player from trying to play opus on Tizen, we will override media // source to always reject opus content. shaka.polyfill.MediaSource.rejectCodec_('opus'); + } else if (shaka.util.Platform.isXOne()) { + // XOne look to be like safari 8 which do not correctly + // implement abort() on SourceBuffer. + // Calling abort() before appending a segment causes that segment to be + // incomplete in the buffer. + // Bug filed: https://bugs.webkit.org/show_bug.cgi?id=165342 + shaka.polyfill.MediaSource.stubAbort_(); + // If you remove up to a keyframe, Webkit 601.x.x incorrectly will also + // remove that keyframe and the content up to the next. + // Offsetting the end of the removal range seems to help. + // Bug filed: https://bugs.webkit.org/show_bug.cgi?id=177884 + shaka.polyfill.MediaSource.patchRemovalRange_(); } else { shaka.log.info('Using native MSE as-is.'); } diff --git a/lib/util/platform.js b/lib/util/platform.js index 2bdb8daee9..ca8d5957ed 100644 --- a/lib/util/platform.js +++ b/lib/util/platform.js @@ -302,7 +302,8 @@ shaka.util.Platform = class { !shaka.util.Platform.isAmazonFireTV() && !shaka.util.Platform.isWPE() && !shaka.util.Platform.isZenterio() && - !shaka.util.Platform.isSkyQ(); + !shaka.util.Platform.isSkyQ() && + !shaka.util.Platform.isXOne(); } /** @@ -354,6 +355,23 @@ shaka.util.Platform = class { return shaka.util.Platform.userAgentContains_('Sky_STB'); } + /** + * Check if the current platform is XOne. + */ + static isXOne() { + let rdk = false; + if (window && Object.keys(window).includes('ServiceManager')) { + const subRDK = window['ServiceManager']; + if (Object.keys(subRDK).includes('getServiceForJavaScript')) { + rdk = true; + } + } + return rdk && navigator.platform && + navigator.platform.includes('Linux aarch64') && + shaka.util.Platform.userAgentContains_('AppleWebKit') && + shaka.util.Platform.userAgentContains_('Version/8.0'); + } + /** * Check if the current platform is Amazon Fire TV. * https://developer.amazon.com/docs/fire-tv/identify-amazon-fire-tv-devices.html @@ -537,7 +555,8 @@ shaka.util.Platform = class { Platform.isEOS() || Platform.isAPL() || Platform.isVirginMedia() || Platform.isOrange() || Platform.isWPE() || Platform.isChromecast() || - Platform.isHisense() || Platform.isZenterio()) { + Platform.isHisense() || Platform.isZenterio() || + Platform.isXOne()) { return true; } return false;