Skip to content

Commit

Permalink
feat(HLS): Re-add TS support to Safari (shaka-project#4097)
Browse files Browse the repository at this point in the history
It appears that the problems we previously had with TS content
on Safari have been fixed. We no longer need the workaround where
we transmuxed TS on that platform.
  • Loading branch information
theodab authored Apr 2, 2022
1 parent f382cc7 commit 8a3bed7
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions lib/polyfill/mediasource.js
Original file line number Diff line number Diff line change
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

0 comments on commit 8a3bed7

Please sign in to comment.