return true;
}
+
+ /**
+ * Checks if current browser supports the HLS and MPEG-DASH media
+ * streaming formats. Most browsers get this from Media Source Extensions.
+ * Safari on iOS, doesn't support MPEG-DASH at all.
+ *
+ * Note, the check here is not 100% accurate!
+ *
+ * Also we assume that users of Firefox/Chrome/Safari do not use the ancient versions of browsers.
+ * We check the exact version for IE/Edge though. We know that there are still users of very old
+ * versions that are afraid to upgrade or have slow IT department.
+ *
+ * Resources:
+ * https://developer.mozilla.org/en-US/docs/Web/API/Media_Source_Extensions_API
+ * https://caniuse.com/#search=mpeg-dash
+ * https://caniuse.com/#search=hls
+ *
+ * @param string $extension
+ * @return bool
+ */
+ public static function supports_media_source_extensions(string $extension) : bool {
+ // Not supported in IE below 11.0.
+ if (self::is_ie() && !self::check_ie_version('11.0')) {
+ return false;
+ }
+
+ if ($extension == '.mpd') {
+ // Not supported in Safari on iOS.
+ if (self::is_safari_ios()) {
+ return false;
+ }
+ }
+
+ return true;
+ }
}