Skip to content

Commit

Permalink
fix: Reject TS content on Edge (shaka-project#5043)
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad committed Feb 28, 2023
1 parent 0b785f7 commit 8818a02
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions lib/polyfill/mediasource.js
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8818a02

Please sign in to comment.