Skip to content

Commit

Permalink
External Libraries: Update MediaElement.js to version 4.2.17.
Browse files Browse the repository at this point in the history
This is a minor bug fix release and the latest in the 4.x branch.

A full list of changes can be found on the library’s GitHub: https://github.com/mediaelement/mediaelement/releases/tag/4.2.17.

While this is not the latest version (the 5.x branch is), further testing needs to be done to confirm compatibility in WordPress. #56320 has been opened to explore this.

Props cdbessig, desrosj.
Fixes #56319.
Built from https://develop.svn.wordpress.org/trunk@54354


git-svn-id: https://core.svn.wordpress.org/trunk@53913 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
desrosj committed Sep 29, 2022
1 parent 6bc681d commit de4253c
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 30 deletions.
55 changes: 34 additions & 21 deletions wp-includes/js/mediaelement/mediaelement-and-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de

var mejs = {};

mejs.version = '4.2.16';
mejs.version = '4.2.17';

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'],
Expand Down Expand Up @@ -1307,7 +1307,7 @@ Object.assign(_player2.default.prototype, {
return;
}

if (t.options.useFakeFullscreen === false && Features.IS_IOS && Features.HAS_IOS_FULLSCREEN && typeof t.media.originalNode.webkitEnterFullscreen === 'function' && t.media.originalNode.canPlayType((0, _media.getTypeFromFile)(t.media.getSrc()))) {
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();
return;
}
Expand Down Expand Up @@ -2943,15 +2943,15 @@ _mejs2.default.TrackFormatParser = {

dfxp: {
parse: function parse(trackText) {
trackText = $(trackText).filter('tt');
var container = trackText.firstChild,
var trackElem = _document2.default.adoptNode(new DOMParser().parseFromString(trackText, 'application/xml').documentElement),
container = trackElem.querySelector('div'),
lines = container.querySelectorAll('p'),
styleNode = trackText.getElementById('' + container.attr('style')),
styleNode = _document2.default.getElementById(container.getAttribute('style')),
entries = [];

var styles = void 0;

if (styleNode.length) {
if (styleNode) {
styleNode.removeAttribute('id');
var attributes = styleNode.attributes;
if (attributes.length) {
Expand All @@ -2971,23 +2971,23 @@ _mejs2.default.TrackFormatParser = {
text: null
};

if (lines.eq(_i16).attr('begin')) {
_temp.start = (0, _time.convertSMPTEtoSeconds)(lines.eq(_i16).attr('begin'));
if (lines[_i16].getAttribute('begin')) {
_temp.start = (0, _time.convertSMPTEtoSeconds)(lines[_i16].getAttribute('begin'));
}
if (!_temp.start && lines.eq(_i16 - 1).attr('end')) {
_temp.start = (0, _time.convertSMPTEtoSeconds)(lines.eq(_i16 - 1).attr('end'));
if (!_temp.start && lines[_i16 - 1].getAttribute('end')) {
_temp.start = (0, _time.convertSMPTEtoSeconds)(lines[_i16 - 1].getAttribute('end'));
}
if (lines.eq(_i16).attr('end')) {
_temp.stop = (0, _time.convertSMPTEtoSeconds)(lines.eq(_i16).attr('end'));
if (lines[_i16].getAttribute('end')) {
_temp.stop = (0, _time.convertSMPTEtoSeconds)(lines[_i16].getAttribute('end'));
}
if (!_temp.stop && lines.eq(_i16 + 1).attr('begin')) {
_temp.stop = (0, _time.convertSMPTEtoSeconds)(lines.eq(_i16 + 1).attr('begin'));
if (!_temp.stop && lines[_i16 + 1].getAttribute('begin')) {
_temp.stop = (0, _time.convertSMPTEtoSeconds)(lines[_i16 + 1].getAttribute('begin'));
}

if (styles) {
style = '';
for (var _style in styles) {
style += _style + ':' + styles[_style] + ';';
style += _style + ': ' + styles[_style] + ';';
}
}
if (style) {
Expand All @@ -2996,7 +2996,7 @@ _mejs2.default.TrackFormatParser = {
if (_temp.start === 0) {
_temp.start = 0.200;
}
_temp.text = lines.eq(_i16).innerHTML.trim().replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, "<a href='$1' target='_blank'>$1</a>");
_temp.text = lines[_i16].innerHTML.trim().replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_| !:, .; ]*[-A-Z0-9+&@#\/%=~_|])/ig, "<a href='$1' target='_blank'>$1</a>");
entries.push(_temp);
}
return entries;
Expand Down Expand Up @@ -3224,6 +3224,7 @@ Object.assign(_player2.default.prototype, {
(0, _dom.removeClass)(mute, t.options.classPrefix + 'mute');
(0, _dom.addClass)(mute, t.options.classPrefix + 'unmute');
} else {

positionVolumeHandle(media.volume);
(0, _dom.removeClass)(mute, t.options.classPrefix + 'unmute');
(0, _dom.addClass)(mute, t.options.classPrefix + 'mute');
Expand Down Expand Up @@ -3344,7 +3345,6 @@ Object.assign(_player2.default.prototype, {
rendered = true;
if (player.options.startVolume === 0 || media.originalNode.muted) {
media.setMuted(true);
player.options.startVolume = 0;
}
media.setVolume(player.options.startVolume);
t.setControlsSize();
Expand All @@ -3358,6 +3358,9 @@ Object.assign(_player2.default.prototype, {
if (player.options.startVolume === 0 || media.originalNode.muted) {
media.setMuted(true);
}
if (player.options.startVolume === 0) {
player.options.startVolume = 0;
}
media.setVolume(player.options.startVolume);
t.setControlsSize();
}
Expand All @@ -3367,7 +3370,9 @@ Object.assign(_player2.default.prototype, {

if (player.options.startVolume === 0 || media.originalNode.muted) {
media.setMuted(true);
player.options.startVolume = 0;
if (player.options.startVolume === 0) {
player.options.startVolume = 0;
}
toggleMute();
}

Expand Down Expand Up @@ -3994,7 +3999,7 @@ var MediaElementPlayer = function () {
var t = this,
autoplayAttr = domNode.getAttribute('autoplay'),
autoplay = !(autoplayAttr === undefined || autoplayAttr === null || autoplayAttr === 'false'),
isNative = media.rendererName !== null && /(native|html5)/i.test(t.media.rendererName);
isNative = media.rendererName !== null && /(native|html5)/i.test(media.rendererName);

if (t.getElement(t.controls)) {
t.enableControls();
Expand Down Expand Up @@ -4433,6 +4438,9 @@ var MediaElementPlayer = function () {
}
}(),
aspectRatio = function () {
if (!t.options.enableAutosize) {
return t.initialAspectRatio;
}
var ratio = 1;
if (!t.isVideo) {
return ratio;
Expand Down Expand Up @@ -5230,7 +5238,9 @@ var MediaElementPlayer = function () {

if (_typeof(t.getElement(t.container)) === 'object') {
var offscreen = t.getElement(t.container).parentNode.querySelector('.' + t.options.classPrefix + 'offscreen');
offscreen.remove();
if (offscreen) {
offscreen.remove();
}
t.getElement(t.container).remove();
}
t.globalUnbind('resize', t.globalResizeCallback);
Expand Down Expand Up @@ -7255,6 +7265,7 @@ var YouTubeIframeRenderer = {
videoId: videoId,
height: height,
width: width,
host: youtube.options.youtube && youtube.options.youtube.nocookie ? 'https://www.youtube-nocookie.com' : undefined,
playerVars: Object.assign({
controls: 0,
rel: 0,
Expand Down Expand Up @@ -8065,8 +8076,10 @@ function getTypeFromFile(url) {
var mime = 'video/mp4';

if (normalizedExt) {
if (~['mp4', 'm4v', 'ogg', 'ogv', 'webm', 'flv', 'mpeg', 'mov'].indexOf(normalizedExt)) {
if (~['mp4', 'm4v', 'ogg', 'ogv', 'webm', 'flv', 'mpeg'].indexOf(normalizedExt)) {
mime = 'video/' + normalizedExt;
} else if ('mov' === normalizedExt) {
mime = 'video/quicktime';
} else if (~['mp3', 'oga', 'wav', 'mid', 'midi'].indexOf(normalizedExt)) {
mime = 'audio/' + normalizedExt;
}
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/js/mediaelement/mediaelement-and-player.min.js

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions wp-includes/js/mediaelement/mediaelement.js
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de

var mejs = {};

mejs.version = '4.2.16';
mejs.version = '4.2.17';

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'],
Expand Down Expand Up @@ -2962,6 +2962,7 @@ var YouTubeIframeRenderer = {
videoId: videoId,
height: height,
width: width,
host: youtube.options.youtube && youtube.options.youtube.nocookie ? 'https://www.youtube-nocookie.com' : undefined,
playerVars: Object.assign({
controls: 0,
rel: 0,
Expand Down Expand Up @@ -3772,8 +3773,10 @@ function getTypeFromFile(url) {
var mime = 'video/mp4';

if (normalizedExt) {
if (~['mp4', 'm4v', 'ogg', 'ogv', 'webm', 'flv', 'mpeg', 'mov'].indexOf(normalizedExt)) {
if (~['mp4', 'm4v', 'ogg', 'ogv', 'webm', 'flv', 'mpeg'].indexOf(normalizedExt)) {
mime = 'video/' + normalizedExt;
} else if ('mov' === normalizedExt) {
mime = 'video/quicktime';
} else if (~['mp3', 'oga', 'wav', 'mid', 'midi'].indexOf(normalizedExt)) {
mime = 'audio/' + normalizedExt;
}
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/js/mediaelement/mediaelement.min.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions wp-includes/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -996,8 +996,8 @@ function wp_default_scripts( $scripts ) {

$scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array( 'jquery' ), false, 1 );

$scripts->add( 'mediaelement', false, array( 'jquery', 'mediaelement-core', 'mediaelement-migrate' ), '4.2.16', 1 );
$scripts->add( 'mediaelement-core', "/wp-includes/js/mediaelement/mediaelement-and-player$suffix.js", array(), '4.2.16', 1 );
$scripts->add( 'mediaelement', false, array( 'jquery', 'mediaelement-core', 'mediaelement-migrate' ), '4.2.17', 1 );
$scripts->add( 'mediaelement-core', "/wp-includes/js/mediaelement/mediaelement-and-player$suffix.js", array(), '4.2.17', 1 );
$scripts->add( 'mediaelement-migrate', "/wp-includes/js/mediaelement/mediaelement-migrate$suffix.js", array(), false, 1 );

did_action( 'init' ) && $scripts->add_inline_script(
Expand Down Expand Up @@ -1087,7 +1087,7 @@ function wp_default_scripts( $scripts ) {
'before'
);

$scripts->add( 'mediaelement-vimeo', '/wp-includes/js/mediaelement/renderers/vimeo.min.js', array( 'mediaelement' ), '4.2.16', 1 );
$scripts->add( 'mediaelement-vimeo', '/wp-includes/js/mediaelement/renderers/vimeo.min.js', array( 'mediaelement' ), '4.2.17', 1 );
$scripts->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement$suffix.js", array( 'mediaelement' ), false, 1 );
$mejs_settings = array(
'pluginPath' => includes_url( 'js/mediaelement/', 'relative' ),
Expand Down Expand Up @@ -1550,7 +1550,7 @@ function wp_default_styles( $styles ) {
// External libraries and friends.
$styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.8' );
$styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array( 'dashicons' ) );
$styles->add( 'mediaelement', '/wp-includes/js/mediaelement/mediaelementplayer-legacy.min.css', array(), '4.2.16' );
$styles->add( 'mediaelement', '/wp-includes/js/mediaelement/mediaelementplayer-legacy.min.css', array(), '4.2.17' );
$styles->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement$suffix.css", array( 'mediaelement' ) );
$styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array( 'dashicons' ) );
$styles->add( 'wp-codemirror', '/wp-includes/js/codemirror/codemirror.min.css', array(), '5.29.1-alpha-ee20357' );
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.1-beta2-54353';
$wp_version = '6.1-beta2-54354';

/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
Expand Down

0 comments on commit de4253c

Please sign in to comment.