From 93c8d2277b6b2f1cbdb95f450f4df3326ba4a13d Mon Sep 17 00:00:00 2001 From: Brad Simpson Date: Wed, 21 Oct 2026 16:57:38 -0600 Subject: [PATCH] Update: MediaElement.js to 7.1.0 (fixes #351) --- README.md | 2 +- less/mediaelementplayer.less | 12 +++++++ libraries/README.md | 5 ++- libraries/mediaelement-and-player.js | 51 ++++++++++++++++------------ 4 files changed, 44 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index b3339e37..7ea41bca 100755 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ **Media** is a *presentation component* bundled with the [Adapt framework](https://github.com/adaptlearning/adapt_framework). This plugin is an HTML5 media playback component for both audio and video. -The component uses [MediaElement.js (v7.0.7)](http://mediaelementjs.com/), a player with a number of useful features including subtitles and accessible (and CSS-skinnable) controls. [MediaElement.js](https://github.com/johndyer/mediaelement) carries the MIT license compatible with Adapt. +The component uses [MediaElement.js (v7.1.0)](http://mediaelementjs.com/), a player with a number of useful features including subtitles and accessible (and CSS-skinnable) controls. [MediaElement.js](https://github.com/johndyer/mediaelement) carries the MIT license compatible with Adapt. For playing YouTube and Vimeo videos, use the dedicated [YouTube](https://github.com/adaptlearning/adapt-youtube) or [Vimeo](https://github.com/adaptlearning/adapt-vimeo) plugins instead. These formats are no longer supported by the Media plugin. diff --git a/less/mediaelementplayer.less b/less/mediaelementplayer.less index 6e1c7d05..8ff4b722 100644 --- a/less/mediaelementplayer.less +++ b/less/mediaelementplayer.less @@ -86,6 +86,18 @@ Reference: http://blog.rrwd.nl/2015/04/04/the-screen-reader-text-class-why-and-h z-index: 1000; } +.mejs__container-fullscreen video { + height: 100vh !important; + left: 50% !important; + object-fit: contain; + position: fixed !important; + top: 50% !important; + -webkit-transform: translate(-50%, -50%) !important; + -ms-transform: translate(-50%, -50%) !important; + transform: translate(-50%, -50%) !important; + width: 100vw !important; +} + /* Start: LAYERS */ .mejs__background { left: 0; diff --git a/libraries/README.md b/libraries/README.md index 67137d27..ff1ce196 100644 --- a/libraries/README.md +++ b/libraries/README.md @@ -2,9 +2,8 @@ ## mediaelement-and-player.js -** +** Contains the following PRs that may or may not be currently part of the master branch. -* svg4everyone remove define variable for umd header: -* Remove fullscreen fix for Chrome version <17. Original issue: Applies fix from +* svg4everyone remove define variable for umd header: . Without it, the library fails to load wherever RequireJS is present, which includes every Adapt course. diff --git a/libraries/mediaelement-and-player.js b/libraries/mediaelement-and-player.js index af09f8be..6b45b610 100644 --- a/libraries/mediaelement-and-player.js +++ b/libraries/mediaelement-and-player.js @@ -1118,7 +1118,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de var mejs = {}; -mejs.version = '7.0.7'; +mejs.version = '7.1.0'; mejs.html5media = { properties: ['volume', 'src', 'currentTime', 'muted', 'duration', 'paused', 'ended', 'buffered', 'error', 'networkState', 'readyState', 'seeking', 'seekable', 'currentSrc', 'preload', 'bufferedBytes', 'bufferedTime', 'initialTime', 'startOffsetTime', 'defaultPlaybackRate', 'playbackRate', 'played', 'autoplay', 'loop', 'controls'], @@ -1253,10 +1253,6 @@ _mejs2.default.Renderers = renderer; },{"8":8}],10:[function(_dereq_,module,exports){ 'use strict'; -var _window = _dereq_(3); - -var _window2 = _interopRequireDefault(_window); - var _document = _dereq_(2); var _document2 = _interopRequireDefault(_document); @@ -1405,8 +1401,8 @@ Object.assign(_player2.default.prototype, { return; } - if (t.options.useFakeFullscreen === false && (Features.IS_IOS || Features.IS_SAFARI) && Features.HAS_IOS_FULLSCREEN && typeof t.media.originalNode.webkitEnterFullscreen === 'function' && t.media.originalNode.canPlayType((0, _media.getTypeFromFile)(t.media.getSrc()))) { - t.media.originalNode.webkitEnterFullscreen(); + if (t.options.useFakeFullscreen === false && (Features.IS_IOS || Features.IS_SAFARI) && Features.HAS_IOS_FULLSCREEN && typeof t.node.webkitEnterFullscreen === 'function' && t.node.canPlayType((0, _media.getTypeFromFile)(t.media.getSrc()))) { + t.node.webkitEnterFullscreen(); return; } @@ -1423,16 +1419,7 @@ Object.assign(_player2.default.prototype, { t.getElement(t.container).style.width = '100%'; t.getElement(t.container).style.height = '100%'; - t.containerSizeTimeout = setTimeout(function () { - t.getElement(t.container).style.width = '100%'; - t.getElement(t.container).style.height = '100%'; - t.setControlsSize(); - }, 500); - - if (isNative) { - t.node.style.width = '100%'; - t.node.style.height = '100%'; - } else { + if (isNative) {} else { var elements = t.getElement(t.container).querySelectorAll('embed, object, video'), _total = elements.length; for (var i = 0; i < _total; i++) { @@ -1441,7 +1428,7 @@ Object.assign(_player2.default.prototype, { } } - if (t.options.setDimensions && typeof t.media.setSize === 'function') { + if (t.options.setDimensions && typeof t.media.setSize === 'function' && !isNative) { t.media.setSize(screen.width, screen.height); } @@ -1457,8 +1444,14 @@ Object.assign(_player2.default.prototype, { (0, _dom.addClass)(t.fullscreenBtn, t.options.classPrefix + 'unfullscreen'); } - t.setControlsSize(); t.isFullScreen = true; + t.setControlsSize(); + + if (!isNative) { + requestAnimationFrame(function () { + t.setPlayerSize(screen.width, screen.height); + }); + } var zoomFactor = Math.min(screen.width / t.width, screen.height / t.height), captionText = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'captions-text'); @@ -1523,6 +1516,8 @@ Object.assign(_player2.default.prototype, { t.setControlsSize(); t.isFullScreen = false; + t.setPlayerSize(t.normalWidth, t.normalHeight); + var captionText = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'captions-text'); if (captionText) { captionText.style.fontSize = ''; @@ -1534,7 +1529,7 @@ Object.assign(_player2.default.prototype, { } }); -},{"17":17,"2":2,"24":24,"25":25,"26":26,"27":27,"28":28,"3":3,"6":6}],11:[function(_dereq_,module,exports){ +},{"17":17,"2":2,"24":24,"25":25,"26":26,"27":27,"28":28,"6":6}],11:[function(_dereq_,module,exports){ 'use strict'; var _document = _dereq_(2); @@ -4254,13 +4249,14 @@ var MediaElementPlayer = function () { }, 0); t.globalResizeCallback = function () { - if (!(t.isFullScreen || _constants.HAS_TRUE_NATIVE_FULLSCREEN && _document2.default.webkitIsFullScreen)) { + if (t.isFullScreen || _constants.HAS_TRUE_NATIVE_FULLSCREEN && _document2.default.webkitIsFullScreen) { + t.setPlayerSize(screen.width, screen.height); + } else { t.setPlayerSize(t.width, t.height); } t.setControlsSize(); }; - t.globalBind('resize', t.globalResizeCallback); } @@ -4347,6 +4343,11 @@ var MediaElementPlayer = function () { t.height = height; } + if (t.isFullScreen || _constants.HAS_TRUE_NATIVE_FULLSCREEN && _document2.default.webkitIsFullScreen) { + t.setDimensions(t.width, t.height); + return; + } + switch (t.options.stretching) { case 'fill': if (t.isVideo) { @@ -4611,6 +4612,12 @@ var MediaElementPlayer = function () { t.getElement(t.container).style.width = width; t.getElement(t.container).style.height = height; + var isNative = t.media.rendererName !== null && /(html5|native)/i.test(t.media.rendererName); + if ((t.isFullScreen || _constants.HAS_TRUE_NATIVE_FULLSCREEN && _document2.default.webkitIsFullScreen) && !isNative) { + t.node.style.width = width; + t.node.style.height = height; + } + var layers = t.getElement(t.layers).children; for (var i = 0, total = layers.length; i < total; i++) { layers[i].style.width = width;