From 290d61138c84170dc71e7f190f6c97b827aa7a21 Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Wed, 24 Jul 2013 05:52:49 +0000 Subject: [PATCH] Fix some sizing issues with video embeds, and improve video/audio embed shortcode flexibility. * `loop`, `autoplay`, and `preload` are now available via the shortcode. Use them non-annoyingly, please! * Attributes that pass through the filters are now proper key/value pairs, not an array of `key="value"` strings. * `preload` defaults to `metadata` for videos. This fixes the vertical video preview and Safari ogv/webm playback issues. * Wrap a div around video embeds to combat a ME.js issue with responsive width=100% themes. Props kovshenin. Fixes #24134, #24798. git-svn-id: http://core.svn.wordpress.org/trunk@24789 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/media.php | 65 +++++++++++++++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 15 deletions(-) diff --git a/wp-includes/media.php b/wp-includes/media.php index 9b5d6a8cc1..f5c0d68cc2 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -856,7 +856,12 @@ function wp_audio_shortcode( $attr ) { $audio = null; $default_types = wp_get_audio_extensions(); - $defaults_atts = array( 'src' => '' ); + $defaults_atts = array( + 'src' => '', + 'loop' => '', + 'autoplay' => '', + 'preload' => 'none' + ); foreach ( $default_types as $type ) $defaults_atts[$type] = ''; @@ -900,11 +905,25 @@ function wp_audio_shortcode( $attr ) { } $atts = array( - sprintf( 'class="%s"', apply_filters( 'wp_audio_shortcode_class', 'wp-audio-shortcode' ) ), - sprintf( 'id="audio-%d-%d"', $post_id, $instances ), + 'class' => apply_filters( 'wp_audio_shortcode_class', 'wp-audio-shortcode' ), + 'id' => sprintf( 'audio-%d-%d', $post_id, $instances ), + 'loop' => $loop, + 'autoplay' => $autoplay, + 'preload' => $preload, ); - $html = sprintf( '