
Index: wp-includes/js/media-views.js
===================================================================
--- wp-includes/js/media-views.js	(revision 23403)
+++ wp-includes/js/media-views.js	(working copy)
@@ -4283,7 +4283,62 @@
 	 */
 	media.view.EmbedLink = media.view.Settings.extend({
 		className: 'embed-link-settings',
-		template:  media.template('embed-link-settings')
+		template:  media.template('embed-link-settings'),
+
+		initialize: function() {
+			this.model.on( 'change:url', this.updateoEmbed, this );
+		},
+
+		updateoEmbed: function() {
+			var oembedURL = this.model.get('url'),
+			context = this.$el,
+			mainInput = context.parents('.media-embed'),
+			postID = media.view.settings.post.id;
+
+			$('.setting.title', context).show();
+			$('.embed-container', context).hide();
+			// clear out previous results
+			$('.embed-container .embed-preview', context).html('');
+
+			// only proceed with embed if the field contains more than 6 characters
+			if (oembedURL.length < 6)
+				return;
+
+			// show spinner
+			$('.spinner', mainInput).show();
+
+			setTimeout(function () {
+				// check if they haven't typed in 500 ms
+				if ( $('.embed-url input', mainInput).val() != oembedURL )
+					return;
+
+				$.ajax({
+					type : 'post',
+					dataType : 'json',
+					url : ajaxurl,
+					data : {
+						'action': 'media-oembed',
+						'oembed_url': oembedURL,
+						'post_id': postID
+						// 'media_ajax_nonce': window.media_ajax_data.ajax_nonce
+					},
+					success: function (response) {
+						// hide spinner
+						$('.spinner', mainInput).hide();
+						// if we have a response id
+						if (typeof response.result !== 'undefined' && response.result) {
+							// show our embed wrapper
+							$('.embed-container', context).show();
+							// hide title input
+							$('.setting.title', context).hide();
+							// and populate our results from ajax response
+							$('.embed-container .embed-preview', context).html(response.result);
+						}
+					}
+				});
+			}, 500);
+		}
+
 	});

 	/**
Index: wp-includes/media-template.php
===================================================================
--- wp-includes/media-template.php	(revision 23403)
+++ wp-includes/media-template.php	(working copy)
@@ -375,10 +375,22 @@
 	</script>

 	<script type="text/html" id="tmpl-embed-link-settings">
-		<label class="setting">
+		<label class="setting title">
 			<span><?php _e('Title'); ?></span>
 			<input type="text" class="alignment" data-setting="title" />
 		</label>
+		<div class="embed-container" style="display: none;">
+			<div class="embed-preview">
+			</div>
+			<label class="setting embed-width">
+				<span><?php _e('Width'); ?></span>
+				<input type="text" class="alignment" data-setting="embed-width" />
+			</label>
+			<label class="setting embed-height">
+				<span><?php _e('Height'); ?></span>
+				<input type="text" class="alignment" data-setting="embed-height" />
+			</label>
+		</div>
 	</script>

 	<script type="text/html" id="tmpl-embed-image-settings">

Index: wp-admin/admin-ajax.php
===================================================================
--- wp-admin/admin-ajax.php	(revision 23403)
+++ wp-admin/admin-ajax.php	(working copy)
@@ -56,7 +56,7 @@
 	'save-widget', 'set-post-thumbnail', 'date_format', 'time_format', 'wp-fullscreen-save-post',
 	'wp-remove-post-lock', 'dismiss-wp-pointer', 'upload-attachment', 'get-attachment',
 	'query-attachments', 'save-attachment', 'save-attachment-compat', 'send-link-to-editor',
-	'send-attachment-to-editor', 'save-attachment-order', 'heartbeat',
+	'send-attachment-to-editor', 'save-attachment-order', 'heartbeat', 'media-oembed'
 );

 // Register core Ajax calls.
Index: wp-admin/includes/ajax-actions.php
===================================================================
--- wp-admin/includes/ajax-actions.php	(revision 23403)
+++ wp-admin/includes/ajax-actions.php	(working copy)
@@ -2081,7 +2081,7 @@
 		$screen_id = sanitize_key($_POST['screenid']);
 	else
 		$screen_id = 'site';
-
+
 	if ( ! empty($_POST['data']) ) {
 		$data = (array) $_POST['data'];
 		// todo: how much to sanitize and preset and what to leave to be accessed from $data or $_POST..?
@@ -2107,3 +2107,41 @@

 	wp_send_json($response);
 }
+
+/**
+ * Handles our oEmbed ajax request
+ */
+function wp_ajax_media_oembed() {
+
+	// @TODO verify our nonce
+	// if ( ! ( isset( $_REQUEST['media_ajax_data'], $_REQUEST['oembed_url'] ) && wp_verify_nonce( $_REQUEST['media_ajax_data'], 'ajax_nonce' ) ) )
+	// 	die();
+
+	// sanitize our search string
+	$oembed_string = sanitize_text_field( $_REQUEST['oembed_url'] );
+
+	$return = false;
+
+	if ( !empty( $oembed_string ) ) {
+		global $post, $wp_embed;
+
+		$oembed_url = esc_url( $oembed_string );
+		// Post ID is needed to check for embeds
+		$post = get_post( isset( $_REQUEST['post_id'] ) ? $_REQUEST['post_id'] : 0 );
+		// ping WordPress for an embed
+		$check_embed = $wp_embed->run_shortcode( '[embed]'. $oembed_url .'[/embed]' );
+		// fallback that WordPress creates when no oEmbed was found
+		$fallback = $wp_embed->maybe_make_link( $oembed_url );
+
+		if ( $check_embed && $check_embed != $fallback )
+			// Embed data
+			$return = $check_embed;
+		else
+			// no oEmbeds were found
+			$return = false;
+	}
+
+	// send back our encoded data
+	echo json_encode( array( 'result' => $return ) );
+	die();
+}
