diff --git a/src/hls.js b/src/hls.js index 7b1b1eeae76..c2b45d73cb3 100644 --- a/src/hls.js +++ b/src/hls.js @@ -27,9 +27,18 @@ class Hls { static isSupported() { window.MediaSource = window.MediaSource || window.WebKitMediaSource; - return (window.MediaSource && - typeof window.MediaSource.isTypeSupported === 'function' && - window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')); + window.SourceBuffer = window.SourceBuffer || window.WebKitSourceBuffer; + + const isTypeSupported = window.MediaSource && + typeof window.MediaSource.isTypeSupported === 'function' && + window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'); + const hasSupportedSourceBuffer = window.SourceBuffer && window.SourceBuffer.prototype && + typeof window.SourceBuffer.prototype.appendBuffer === 'function' && + typeof window.SourceBuffer.prototype.remove === 'function'; + const isSafari = navigator.vendor && navigator.vendor.indexOf('Apple') > -1; + + // safari does not expose SourceBuffer globally so checking SourceBuffer.prototype is impossible + return isTypeSupported && (hasSupportedSourceBuffer || isSafari); } static get Events() {