diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php
index 025c24e5ec..478dcb004f 100644
--- a/src/wp-admin/includes/ajax-actions.php
+++ b/src/wp-admin/includes/ajax-actions.php
@@ -2652,8 +2652,26 @@ function wp_ajax_parse_embed() {
) );
}
- // TODO: needed?
- $parsed = do_shortcode( $parsed );
+ if ( has_shortcode( $parsed, 'audio' ) || has_shortcode( $parsed, 'video' ) ) {
+ $styles = '';
+ $mce_styles = wp_media_mce_styles();
+ foreach ( $mce_styles as $style ) {
+ $styles .= sprintf( '', $style );
+ }
+
+ $html = do_shortcode( $parsed );
+
+ global $wp_scripts;
+ if ( ! empty( $wp_scripts ) ) {
+ $wp_scripts->done = array();
+ }
+ ob_start();
+ wp_print_scripts( 'wp-mediaelement' );
+ $scripts = ob_get_clean();
+
+ $parsed = $styles . $html . $scripts;
+ }
+
if ( ! empty( $no_ssl_support ) || ( is_ssl() && ( preg_match( '%<(iframe|script|embed) [^>]*src="http://%', $parsed ) ||
preg_match( '%]*href="http://%', $parsed ) ) ) ) {
diff --git a/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css b/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css
index 5ac753f93c..2b5763a819 100644
--- a/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css
+++ b/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css
@@ -193,7 +193,6 @@ video,
embed {
display: -moz-inline-stack;
display: inline-block;
- max-width: 100%;
}
audio {
diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php
index c327008410..a7000b8726 100644
--- a/src/wp-includes/media.php
+++ b/src/wp-includes/media.php
@@ -3256,3 +3256,29 @@ function attachment_url_to_postid( $url ) {
return (int) $post_id;
}
}
+
+/**
+ * Return the URls for CSS files used in an