mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-26 17:46:26 +03:00
fix: Add ManagedMediaSource support in MediaSource polyfill (#6361)
This commit is contained in:
committed by
GitHub
parent
03bb463a72
commit
12bf6428e0
@@ -30,7 +30,7 @@ shaka.polyfill.MediaSource = class {
|
||||
// platform detection tricks to decide which patches to install.
|
||||
const safariVersion = shaka.util.Platform.safariVersion();
|
||||
|
||||
if (!window.MediaSource) {
|
||||
if (!window.MediaSource && !window.ManagedMediaSource) {
|
||||
shaka.log.info('No MSE implementation available.');
|
||||
} else if (shaka.util.Platform.isChromecast()) {
|
||||
shaka.log.info('Patching Chromecast MSE bugs.');
|
||||
@@ -158,12 +158,25 @@ shaka.polyfill.MediaSource = class {
|
||||
* @private
|
||||
*/
|
||||
static rejectContainer_(container) {
|
||||
const isTypeSupported = MediaSource.isTypeSupported;
|
||||
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);
|
||||
};
|
||||
|
||||
if (window.ManagedMediaSource) {
|
||||
const isTypeSupportedManaged =
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
ManagedMediaSource.isTypeSupported.bind(ManagedMediaSource);
|
||||
|
||||
window.ManagedMediaSource.isTypeSupported = (mimeType) => {
|
||||
const actualContainer = shaka.util.MimeUtils.getContainerType(mimeType);
|
||||
return actualContainer != container && isTypeSupportedManaged(mimeType);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -175,12 +188,25 @@ shaka.polyfill.MediaSource = class {
|
||||
* @private
|
||||
*/
|
||||
static rejectCodec_(codec) {
|
||||
const isTypeSupported = MediaSource.isTypeSupported;
|
||||
const isTypeSupported =
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
MediaSource.isTypeSupported.bind(MediaSource);
|
||||
|
||||
MediaSource.isTypeSupported = (mimeType) => {
|
||||
const actualCodec = shaka.util.MimeUtils.getCodecBase(mimeType);
|
||||
return actualCodec != codec && isTypeSupported(mimeType);
|
||||
};
|
||||
|
||||
if (window.ManagedMediaSource) {
|
||||
const isTypeSupportedManaged =
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
ManagedMediaSource.isTypeSupported.bind(ManagedMediaSource);
|
||||
|
||||
window.ManagedMediaSource.isTypeSupported = (mimeType) => {
|
||||
const actualCodec = shaka.util.MimeUtils.getCodecBase(mimeType);
|
||||
return actualCodec != codec && isTypeSupportedManaged(mimeType);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user