diff --git a/src/wp-admin/css/media.css b/src/wp-admin/css/media.css index 7d1a80ac31..71015d00ca 100644 --- a/src/wp-admin/css/media.css +++ b/src/wp-admin/css/media.css @@ -640,6 +640,15 @@ span.imgedit-scale-warn { padding: 2px 10px; } +audio, video { + display: inline-block; + max-width: 100%; +} + +.mejs-container { + width: 100%; +} + /* =Media Queries -------------------------------------------------------------- */ diff --git a/src/wp-admin/includes/media.php b/src/wp-admin/includes/media.php index d3f49e4484..e31edd7f49 100644 --- a/src/wp-admin/includes/media.php +++ b/src/wp-admin/includes/media.php @@ -2640,20 +2640,17 @@ function edit_form_image_editor( $post ) { maybe_regenerate_attachment_metadata( $post ); $meta = wp_get_attachment_metadata( $attachment_id ); - $w = ! empty( $meta['width'] ) ? min( $meta['width'], 600 ) : 0; - $h = 0; - if ( ! empty( $meta['height'] ) ) - $h = $meta['height']; - if ( $h && $w < $meta['width'] ) + $w = ! empty( $meta['width'] ) ? min( $meta['width'], 640 ) : 0; + $h = ! empty( $meta['height'] ) ? $meta['height'] : 0; + if ( $h && $w < $meta['width'] ) { $h = round( ( $meta['height'] * $w ) / $meta['width'] ); + } $attr = array( 'src' => $att_url ); - - if ( ! empty( $meta['width' ] ) ) + if ( ! empty( $w ) && ! empty( $h ) ) { $attr['width'] = $w; - - if ( ! empty( $meta['height'] ) ) $attr['height'] = $h; + } echo wp_video_shortcode( $attr ); diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index a87ffd334e..41a85a8532 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -1058,7 +1058,13 @@ function wp_get_playlist( $attr, $type ) { || $images; $outer = 22; // default padding and border of wrapper + + $default_width = 640; + $default_height = 360; + $theme_width = $content_width - $outer; + $theme_height = round( ( $default_height * $theme_width ) / $default_width ); + $data = compact( 'type', 'style' ); // don't pass strings to JSON, will be truthy in JS @@ -1090,9 +1096,15 @@ function wp_get_playlist( $attr, $type ) { } if ( 'video' === $type ) { - $width = empty( $meta['width'] ) ? 640 : $meta['width']; - $height = empty( $meta['height'] ) ? 360 : $meta['height']; - $theme_height = round( ( $height * $theme_width ) / $width ); + if ( ! empty( $meta['width'] ) && ! empty( $meta['height'] ) ) { + $width = $meta['width']; + $height = $meta['height']; + $theme_height = round( ( $height * $theme_width ) / $width ); + } else { + $width = $default_width; + $height = $default_height; + } + $track['dimensions'] = array( 'original' => compact( 'width', 'height' ), 'resized' => array( @@ -1165,7 +1177,11 @@ function wp_get_playlist( $attr, $type ) {
- < controls="controls" preload="metadata" width="">> + < controls="controls" preload="metadata" width="">>