Skip to content

Commit

Permalink
MDL-63453 media_videojs: Upgrade Video.JS to 7.6.5.
Browse files Browse the repository at this point in the history
Upgrade videojs media player to version 7.6.5 as well
as a general update this adds MPEG-DASH and HLS playlist
support to the Video.JS media player.
  • Loading branch information
Matt Porritt authored and Matt Porritt committed Sep 25, 2019
1 parent 4487612 commit 411bbe6
Show file tree
Hide file tree
Showing 29 changed files with 14,979 additions and 16,506 deletions.
4 changes: 4 additions & 0 deletions lib/classes/filetypes.php
Expand Up @@ -152,6 +152,8 @@ protected static function get_default_types() {
'mw' => array('type' => 'application/maple', 'icon' => 'math'),
'mws' => array('type' => 'application/maple', 'icon' => 'math'),
'm3u' => array('type' => 'audio/x-mpegurl', 'icon' => 'mp3', 'groups' => array('audio'), 'string' => 'audio'),
'm3u8' => array('type' => 'application/x-mpegURL', 'icon' => 'mpeg',
'groups' => array('video', 'web_video'), 'string' => 'video'),
'mp3' => array('type' => 'audio/mp3', 'icon' => 'mp3', 'groups' => array('audio', 'html_audio', 'web_audio'),
'string' => 'audio'),
'mp4' => array('type' => 'video/mp4', 'icon' => 'mpeg', 'groups' => array('html_video', 'video', 'web_video'),
Expand All @@ -162,6 +164,8 @@ protected static function get_default_types() {
'string' => 'audio'),
'mpeg' => array('type' => 'video/mpeg', 'icon' => 'mpeg', 'groups' => array('video', 'web_video'),
'string' => 'video'),
'mpd' => array('type' => 'application/dash+xml', 'icon' => 'mpeg',
'groups' => array('video', 'web_video'), 'string' => 'video'),
'mpe' => array('type' => 'video/mpeg', 'icon' => 'mpeg', 'groups' => array('video', 'web_video'),
'string' => 'video'),
'mpg' => array('type' => 'video/mpeg', 'icon' => 'mpeg', 'groups' => array('video', 'web_video'),
Expand Down
35 changes: 35 additions & 0 deletions lib/classes/useragent.php
Expand Up @@ -1165,4 +1165,39 @@ public static function supports_html5($extension) {

return true;
}

/**
* Checks if current browser supports the HLS and MPEG-DASH video
* 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
*
* @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 is iOS on Safari.
if (self::is_safari_ios()) {
return false;
}
}

return true;
}
}
2 changes: 1 addition & 1 deletion media/player/videojs/amd/build/video-lazy.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion media/player/videojs/amd/build/video-lazy.min.js.map

Large diffs are not rendered by default.

0 comments on commit 411bbe6

Please sign in to comment.