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

feat(HLS): Re-add TS support to Safari #4097

Merged
merged 1 commit into from Apr 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 0 additions & 28 deletions lib/polyfill/mediasource.js
Expand Up @@ -38,11 +38,6 @@ shaka.polyfill.MediaSource = class {
// Chromecast cannot make accurate determinations via isTypeSupported.
shaka.polyfill.MediaSource.patchCastIsTypeSupported_();
} else if (safariVersion) {
// TS content is broken on Safari in general.
// See https://github.com/shaka-project/shaka-player/issues/743
// and https://bugs.webkit.org/show_bug.cgi?id=165342
shaka.polyfill.MediaSource.rejectTsContent_();

// NOTE: shaka.Player.isBrowserSupported() has its own restrictions on
// Safari version.
if (safariVersion <= 12) {
Expand Down Expand Up @@ -127,29 +122,6 @@ shaka.polyfill.MediaSource = class {
};
}

/**
* Patch isTypeSupported() to reject TS content. Used to avoid TS-related MSE
* bugs on Safari.
*
* @private
*/
static rejectTsContent_() {
const originalIsTypeSupported = MediaSource.isTypeSupported;

MediaSource.isTypeSupported = (mimeType) => {
// Parse the basic MIME type from its parameters.
const pieces = mimeType.split(/ *; */);
const basicMimeType = pieces[0];
const container = basicMimeType.split('/')[1];

if (container.toLowerCase() == 'mp2t') {
return false;
}

return originalIsTypeSupported(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