Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Reject TS content on Edge #5043

Merged
merged 3 commits into from
Feb 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions lib/polyfill/mediasource.js
Original file line number Diff line number Diff line change
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