From 043ba1b221379da5532605ee4c32799cd69b4925 Mon Sep 17 00:00:00 2001 From: Ruslan Kabalin Date: Thu, 3 Oct 2019 17:40:40 +0100 Subject: [PATCH] MDL-56549 lib: Add flac audio extension to html5 support list. This is now supported by most browsers: https://en.wikipedia.org/wiki/HTML5_audio https://caniuse.com/#feat=flac --- lib/classes/useragent.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/classes/useragent.php b/lib/classes/useragent.php index bcf2cc9a74b..c8d708565b5 100644 --- a/lib/classes/useragent.php +++ b/lib/classes/useragent.php @@ -1123,8 +1123,7 @@ class core_useragent { $extension = strtolower($extension); $supportedvideo = array('m4v', 'webm', 'ogv', 'mp4', 'mov'); - $supportedaudio = array('ogg', 'oga', 'aac', 'm4a', 'mp3', 'wav'); - // TODO MDL-56549 Flac will be supported in Firefox 51 in January 2017. + $supportedaudio = array('ogg', 'oga', 'aac', 'm4a', 'mp3', 'wav', 'flac'); // Basic extension support. if (!in_array($extension, $supportedvideo) && !in_array($extension, $supportedaudio)) { @@ -1158,6 +1157,11 @@ class core_useragent { if ($isogg && (self::is_ie() || self::is_edge() || self::is_safari() || self::is_safari_ios())) { return false; } + // FLAC is not supported in IE and Edge (below 16.0). + if ($extension === 'flac' && + (self::is_ie() || (self::is_edge() && !self::check_edge_version('16.0')))) { + return false; + } // Wave is not supported in IE. if ($extension === 'wav' && self::is_ie()) { return false;