From ef506ac647cc6134a8b187fe82824eaa065f8bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Velad=20Galv=C3=A1n?= Date: Mon, 16 Aug 2021 16:16:21 +0200 Subject: [PATCH] Fix: Add Support to iOS 12 in MediaCapabilities polyfill (#3573) In iOS, there is no support for MediaSource, and we should have 'file' as the type of the MediaiDecodingConfig, to check whether the content is supported or not. We should only require MediaSource support in the polyfill when the type of MediaiDecodingConfig is 'media-source'. Issue: #3530 . --- lib/polyfill/media_capabilities.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/polyfill/media_capabilities.js b/lib/polyfill/media_capabilities.js index 346e9ba463..211a1311c2 100644 --- a/lib/polyfill/media_capabilities.js +++ b/lib/polyfill/media_capabilities.js @@ -31,11 +31,6 @@ shaka.polyfill.MediaCapabilities = class { shaka.log.debug( 'MediaCapabilities: Native mediaCapabilities support found.'); return; - } else if (!window.MediaSource) { - shaka.log.debug( - 'MediaSource must be available to install mediaCapabilities ', - 'polyfill.'); - return; } if (!navigator.mediaCapabilities) { @@ -64,6 +59,9 @@ shaka.polyfill.MediaCapabilities = class { } if (mediaDecodingConfig.type == 'media-source') { + if (!shaka.util.Platform.supportsMediaSource()) { + return res; + } // Use 'MediaSource.isTypeSupported' to check if the stream is supported. if (mediaDecodingConfig['video']) { const contentType = mediaDecodingConfig['video'].contentType;