Skip to content

Commit

Permalink
fix: Fix MSE polyfill for iOS (#7049)
Browse files Browse the repository at this point in the history
Fixes #7048
  • Loading branch information
avelad committed Jul 18, 2024
1 parent 451a41e commit 44dc9a9
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/polyfill/mediasource.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ shaka.polyfill.MediaSource = class {

if (!window.MediaSource && !window.ManagedMediaSource) {
shaka.log.info('No MSE implementation available.');
} else if (safariVersion) {
} else if (safariVersion && window.MediaSource) {
// NOTE: shaka.Player.isBrowserSupported() has its own restrictions on
// Safari version.
if (safariVersion <= 10) {
Expand Down Expand Up @@ -167,14 +167,16 @@ shaka.polyfill.MediaSource = class {
* @private
*/
static rejectContainer_(container) {
const isTypeSupported =
// eslint-disable-next-line no-restricted-syntax
MediaSource.isTypeSupported.bind(MediaSource);
if (window.MediaSource) {
const isTypeSupported =
// eslint-disable-next-line no-restricted-syntax
MediaSource.isTypeSupported.bind(MediaSource);

MediaSource.isTypeSupported = (mimeType) => {
const actualContainer = shaka.util.MimeUtils.getContainerType(mimeType);
return actualContainer != container && isTypeSupported(mimeType);
};
MediaSource.isTypeSupported = (mimeType) => {
const actualContainer = shaka.util.MimeUtils.getContainerType(mimeType);
return actualContainer != container && isTypeSupported(mimeType);
};
}

if (window.ManagedMediaSource) {
const isTypeSupportedManaged =
Expand Down

0 comments on commit 44dc9a9

Please sign in to comment.