diff --git a/lib/polyfill/mediasource.js b/lib/polyfill/mediasource.js index 4508185804..5a981e8484 100644 --- a/lib/polyfill/mediasource.js +++ b/lib/polyfill/mediasource.js @@ -61,6 +61,11 @@ shaka.polyfill.MediaSource = class { // Bug filed: https://bugs.webkit.org/show_bug.cgi?id=165342 shaka.polyfill.MediaSource.stubAbort_(); } + } else if (shaka.util.Platform.isEdge()) { + shaka.log.info('Rejecting TS container.'); + // TS content is broken on Edge in general. + // See https://github.com/shaka-project/shaka-player/issues/4955 + shaka.polyfill.MediaSource.rejectContainer_('mp2t'); } else if (shaka.util.Platform.isTizen2() || shaka.util.Platform.isTizen3() || shaka.util.Platform.isTizen4()) { @@ -122,6 +127,23 @@ shaka.polyfill.MediaSource = class { }; } + /** + * Patch |MediaSource.isTypeSupported| to always reject |container|. This is + * used when we know that we are on a platform that does not work well with + * a given container. + * + * @param {string} container + * @private + */ + static rejectContainer_(container) { + const isTypeSupported = MediaSource.isTypeSupported; + + MediaSource.isTypeSupported = (mimeType) => { + const actualContainer = shaka.util.MimeUtils.getContainerType(mimeType); + return actualContainer != container && isTypeSupported(mimeType); + }; + } + /** * Patch |MediaSource.isTypeSupported| to always reject |codec|. This is used * when we know that we are on a platform that does not work well with a given