diff --git a/wp-includes/js/media-views.js b/wp-includes/js/media-views.js
index 86f7472329..a14a57b042 100644
--- a/wp-includes/js/media-views.js
+++ b/wp-includes/js/media-views.js
@@ -462,9 +462,12 @@
},
canEmbed: function( attachment ) {
- var type = attachment.get('type');
- if ( type !== 'audio' && type !== 'video' )
- return false;
+ // If uploading, we know the filename but not the mime type.
+ if ( ! attachment.get('uploading') ) {
+ var type = attachment.get('type');
+ if ( type !== 'audio' && type !== 'video' )
+ return false;
+ }
return _.contains( media.view.settings.embedExts, attachment.get('filename').split('.').pop() );
},
diff --git a/wp-includes/media-template.php b/wp-includes/media-template.php
index b5b03d6629..6af7dc5f32 100644
--- a/wp-includes/media-template.php
+++ b/wp-includes/media-template.php
@@ -297,14 +297,9 @@ function wp_print_media_templates() {
data-user-setting="urlbutton"
<# } #>>
- <# if ( data.model.canEmbed && 'audio' === data.type ) { #>
+ <# if ( data.model.canEmbed ) { #>
-