diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index 0f784868ac..42ca1e2d6c 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -2470,7 +2470,7 @@ function attachment_submitbox_metadata() { if ( ! empty( $meta['bitrate'] ) ) : ?>
<# } #> + <# if ( data.fileLength ) { #> +
{{ data.fileLength }}
+ <# } #> + <# if ( ! data.uploading && data.can.remove ) { #> <# } #> @@ -281,25 +285,52 @@ function wp_print_media_templates() {
diff --git a/wp-includes/media.php b/wp-includes/media.php index 1362f78bbb..9b5d6a8cc1 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -1699,6 +1699,11 @@ function wp_prepare_attachment_for_js( $attachment ) { $response['height'] = (int) $meta['height']; } + if ( $meta && ( 'audio' === $type || 'video' === $type ) ) { + if ( isset( $meta['length_formatted'] ) ) + $response['fileLength'] = $meta['length_formatted']; + } + if ( function_exists('get_compat_media_markup') ) $response['compat'] = get_compat_media_markup( $attachment->ID, array( 'in_modal' => true ) ); @@ -1753,6 +1758,7 @@ function wp_enqueue_media( $args = array() ) { 'id' => 0, ), 'defaultProps' => $props, + 'embedExts' => array_merge( wp_get_audio_extensions(), wp_get_video_extensions() ), ); $post = null;