From 3d8e31fb82cc1485176c89d27b736bcd9d2444ba Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Wed, 29 Oct 2014 00:47:24 +0000 Subject: [PATCH] Don't hardcode `height` for videos - this was a workaround for MediaElement internals causing problems. Responsive videos now work properly and don't cause extra whitespace. Fixes MediaElement by hand in the interim: https://github.com/johndyer/mediaelement/pull/1337 Video playlists were completely broken by this. Fixes #30078. Built from https://develop.svn.wordpress.org/trunk@30082 git-svn-id: http://core.svn.wordpress.org/trunk@30082 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/js/mediaelement/mediaelement-and-player.min.js | 2 +- wp-includes/js/mediaelement/wp-mediaelement.css | 4 ++++ wp-includes/media.php | 7 ++----- wp-includes/version.php | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/wp-includes/js/mediaelement/mediaelement-and-player.min.js b/wp-includes/js/mediaelement/mediaelement-and-player.min.js index 2b5cf6089d..7d8305be7c 100644 --- a/wp-includes/js/mediaelement/mediaelement-and-player.min.js +++ b/wp-includes/js/mediaelement/mediaelement-and-player.min.js @@ -102,7 +102,7 @@ c.options.pauseOtherPlayers&&!m.paused&&!m.ended&&m.pause();m.hasFocus=false}c.h c.updateCurrent();if(!c.isFullScreen){c.setPlayerSize(c.width,c.height);c.setControlsSize()}},false);setTimeout(function(){c.setPlayerSize(c.width,c.height);c.setControlsSize()},50);c.globalBind("resize",function(){c.isFullScreen||mejs.MediaFeatures.hasTrueNativeFullScreen&&document.webkitIsFullScreen||c.setPlayerSize(c.width,c.height);c.setControlsSize()});c.media.pluginType=="youtube"&&c.options.autoplay&&c.container.find(".mejs-overlay-play").hide()}d&&a.pluginType=="native"&&c.play();if(c.options.success)typeof c.options.success== "string"?window[c.options.success](c.media,c.domNode,c):c.options.success(c.media,c.domNode,c)}},handleError:function(a){this.controls.hide();this.options.error&&this.options.error(a)},setPlayerSize:function(a,b){if(!this.options.setDimensions)return false;if(typeof a!="undefined")this.width=a;if(typeof b!="undefined")this.height=b;if(this.height.toString().indexOf("%")>0||this.$node.css("max-width")==="100%"||this.$node[0].currentStyle&&this.$node[0].currentStyle.maxWidth==="100%"){var c=this.isVideo? this.media.videoWidth&&this.media.videoWidth>0?this.media.videoWidth:this.media.getAttribute("width")!==null?this.media.getAttribute("width"):this.options.defaultVideoWidth:this.options.defaultAudioWidth,e=this.isVideo?this.media.videoHeight&&this.media.videoHeight>0?this.media.videoHeight:this.media.getAttribute("height")!==null?this.media.getAttribute("height"):this.options.defaultVideoHeight:this.options.defaultAudioHeight,d=this.container.parent().closest(":visible").width(),g=this.container.parent().closest(":visible").height(); -c=this.isVideo||!this.options.autosizeProgress?parseInt(d*e/c,10):e;if(isNaN(c)||g!=0&&c>g)c=g;if(this.container.parent()[0].tagName.toLowerCase()==="body"){d=f(window).width();c=f(window).height()}if(c!=0&&d!=0){this.container.width(d).height(c);this.$media.add(this.container.find(".mejs-shim")).width("100%").height("100%");this.isVideo&&this.media.setVideoSize&&this.media.setVideoSize(d,c);this.layers.children(".mejs-layer").width("100%").height("100%")}}else{this.container.width(this.width).height(this.height); +c=this.isVideo||!this.options.autosizeProgress?parseInt(d*e/c,10):e;if(isNaN(c))c=g;if(this.container.parent()[0].tagName.toLowerCase()==="body"){d=f(window).width();c=f(window).height()}if(c!=0&&d!=0){this.container.width(d).height(c);this.$media.add(this.container.find(".mejs-shim")).width("100%").height("100%");this.isVideo&&this.media.setVideoSize&&this.media.setVideoSize(d,c);this.layers.children(".mejs-layer").width("100%").height("100%")}}else{this.container.width(this.width).height(this.height); this.layers.children(".mejs-layer").width(this.width).height(this.height)}d=this.layers.find(".mejs-overlay-play");g=d.find(".mejs-overlay-button");d.height(this.container.height()-this.controls.height());g.css("margin-top","-"+(g.height()/2-this.controls.height()/2).toString()+"px")},setControlsSize:function(){var a=0,b=0,c=this.controls.find(".mejs-time-rail"),e=this.controls.find(".mejs-time-total");this.controls.find(".mejs-time-current");this.controls.find(".mejs-time-loaded");var d=c.siblings(), g=d.last(),k=null;if(!(!this.container.is(":visible")||!c.length||!c.is(":visible"))){if(this.options&&!this.options.autosizeProgress)b=parseInt(c.css("width"));if(b===0||!b){d.each(function(){var j=f(this);if(j.css("position")!="absolute"&&j.is(":visible"))a+=f(this).outerWidth(true)});b=this.controls.width()-a-(c.outerWidth(true)-c.width())}do{c.width(b);e.width(b-(e.outerWidth(true)-e.width()));if(g.css("position")!="absolute"){k=g.position();b--}}while(k!=null&&k.top>0&&b>0);this.setProgressRail&& this.setProgressRail();this.setCurrentRail&&this.setCurrentRail()}},buildposter:function(a,b,c,e){var d=f('
').appendTo(c);b=a.$media.attr("poster");if(a.options.poster!=="")b=a.options.poster;b!==""&&b!=null?this.setPoster(b):d.hide();e.addEventListener("play",function(){d.hide()},false);a.options.showPosterWhenEnded&&a.options.autoRewind&&e.addEventListener("ended",function(){d.show()},false)},setPoster:function(a){var b=this.container.find(".mejs-poster"), diff --git a/wp-includes/js/mediaelement/wp-mediaelement.css b/wp-includes/js/mediaelement/wp-mediaelement.css index 577908c481..65fc8eaff4 100644 --- a/wp-includes/js/mediaelement/wp-mediaelement.css +++ b/wp-includes/js/mediaelement/wp-mediaelement.css @@ -97,6 +97,10 @@ height: auto; } +.wp_attachment_holder .wp-video { + margin-top: 18px; +} + video.wp-video-shortcode, .wp-video-shortcode video { max-width: 100%; diff --git a/wp-includes/media.php b/wp-includes/media.php index 31f5306ee3..81cb1e8af2 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -1855,14 +1855,11 @@ function wp_video_shortcode( $attr, $content = '' ) { } $html .= ''; - $width_rule = $height_rule = ''; + $width_rule = ''; if ( ! empty( $atts['width'] ) ) { $width_rule = sprintf( 'width: %dpx; ', $atts['width'] ); } - if ( ! empty( $atts['height'] ) ) { - $height_rule = sprintf( 'height: %dpx; ', $atts['height'] ); - } - $output = sprintf( '
%s
', $width_rule, $height_rule, $html ); + $output = sprintf( '
%s
', $width_rule, $html ); /** * Filter the output of the video shortcode. diff --git a/wp-includes/version.php b/wp-includes/version.php index 3ebfcfdcc2..242ce6da28 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.1-alpha-30081'; +$wp_version = '4.1-alpha-30082'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.