Index: src/wp-includes/js/mce-view.js
===================================================================
--- src/wp-includes/js/mce-view.js	(revision 28157)
+++ src/wp-includes/js/mce-view.js	(working copy)
@@ -428,9 +428,31 @@
 			this.players = [];
 			this.shortcode = options.shortcode;
 			_.bindAll( this, 'setPlayer' );
+			this.fetch();
 			$(this).on( 'ready', this.setPlayer );
 		},
 
+		fetch: function () {
+			var ids = [], allowed = this.allowedExts( this.shortcode.tag );
+
+			_.each( this.shortcode.attrs.named, function (value, name) {
+				if ( -1 !== $.inArray( name, allowed ) && value.match(/^[0-9]+$/) ) {
+					ids.push( parseInt( value, 10 ) );
+				}
+			} );
+
+			if ( ids.length ) {
+				if ( 'video' === this.shortcode.tag
+					&& this.shortcode.attrs.named.poster.match(/^[0-9]+$/) ) {
+					ids.push( this.shortcode.attrs.named.poster );
+				}
+				this.attachments = wp.media.query( { post__in: ids } );
+				this.dfd = this.attachments.more().done( _.bind( this.render, this ) );
+			} else {
+				this.dfd = false;
+			}
+		},
+
 		/**
 		 * Creates the player instance for the current node
 		 *
@@ -446,6 +468,10 @@
 				return;
 			}
 
+			if ( this.dfd && 'pending' === this.dfd.state() && ! this.attachments.length ) {
+				return;
+			}
+
 			var self = this,
 				media,
 				firefox = this.ua.is( 'ff' ),
@@ -487,11 +513,21 @@
 		 * @returns {string}
 		 */
 		getHtml: function() {
-			var attrs = _.defaults(
+			if ( this.dfd && 'pending' === this.dfd.state() && ! this.attachments.length ) {
+				return;
+			}
+
+			var options, attrs = _.defaults(
 				this.shortcode.attrs.named,
 				wp.media[ this.shortcode.tag ].defaults
 			);
-			return this.template({ model: attrs });
+
+			options = {
+				model: attrs,
+				attachments: this.attachments.toJSON()
+			};
+
+			return this.template( options );
 		},
 
 		unbind: function() {
Index: src/wp-includes/js/media-audiovideo.js
===================================================================
--- src/wp-includes/js/media-audiovideo.js	(revision 28157)
+++ src/wp-includes/js/media-audiovideo.js	(working copy)
@@ -26,6 +26,12 @@
 			}
 		},
 
+		allowedExts: function( type ) {
+			return _.filter( _.keys( wp.media.view.settings.embedMimes ), function (key) {
+				return 0 === wp.media.view.settings.embedMimes[ key ].indexOf( type );
+			} );
+		},
+
 		/**
 		 * Utility to identify the user's browser
 		 */
@@ -309,10 +315,39 @@
 	 * @augments Backbone.Model
 	 */
 	media.model.PostMedia = Backbone.Model.extend({
-		initialize: function() {
-			this.attachment = false;
+		initialize: function( attributes ) {
+			this.attachments = false;
+			this.params = attributes;
+			this.type = this.params.context;
+
+			this.getIds( attributes );
+			this.on( 'change', this.reQuery, this );
 		},
 
+		reQuery: function () {
+			this.params = this.attributes;
+			this.getIds( this.params );
+		},
+
+		getIds: function (attributes) {
+			var ids = [], allowed = media.mixin.allowedExts( this.type );
+
+			_.each( attributes, function (value, name) {
+				if ( -1 !== $.inArray( name, allowed ) && value.match(/^[0-9]+$/) ) {
+					ids.push( parseInt( value, 10 ) );
+				}
+			} );
+
+			if ( ids.length ) {
+				if ( 'video' === this.type
+					&& attributes.poster.toString().match(/^[0-9]+$/) ) {
+					ids.push( attributes.poster );
+				}
+				this.attachments = wp.media.query( { post__in: ids } );
+				this.dfd = this.attachments.more();
+			}
+		},
+
 		setSource: function( attachment ) {
 			this.attachment = attachment;
 			this.extension = attachment.get( 'filename' ).split('.').pop();
@@ -322,7 +357,7 @@
 			}
 
 			if ( _.contains( wp.media.view.settings.embedExts, this.extension ) ) {
-				this.set( this.extension, this.attachment.get( 'url' ) );
+				this.set( this.extension, this.attachment.get( 'id' ) );
 			} else {
 				this.unset( this.extension );
 			}
@@ -416,6 +451,8 @@
 			this.cancelText = options.cancelText;
 			this.addText = options.addText;
 
+			options.metadata.context = this.defaults.id;
+
 			this.media = new media.model.PostMedia( options.metadata );
 			this.options.selection = new media.model.Selection( this.media.attachment, { multiple: false } );
 			media.view.MediaFrame.Select.prototype.initialize.apply( this, arguments );
@@ -436,7 +473,7 @@
 			var view = new this.DetailsView({
 				controller: this,
 				model: this.state().media,
-				attachment: this.state().media.attachment
+				attachments: this.state().media.attachments.toJSON()
 			}).render();
 
 			this.content.set( view );
@@ -668,7 +705,7 @@
 			this.setPrimaryButton( l10n.videoSelectPosterImageTitle, function( controller, state ) {
 				var attachment = state.get( 'selection' ).single();
 
-				controller.media.set( 'poster', attachment.get( 'url' ) );
+				controller.media.set( 'poster', attachment.get( 'id' ) );
 				state.trigger( 'set-poster-image', controller.media.toJSON() );
 			} );
 		},
Index: src/wp-includes/js/media-editor.js
===================================================================
--- src/wp-includes/js/media-editor.js	(revision 28157)
+++ src/wp-includes/js/media-editor.js	(working copy)
@@ -190,7 +190,7 @@
 
 			if ( 'video' === type ) {
 				if ( attachment.image && -1 === attachment.image.src.indexOf( attachment.icon ) ) {
-					shortcode.poster = attachment.image.src;
+					shortcode.poster = attachment.image.id;
 				}
 
 				if ( attachment.width ) {
@@ -205,7 +205,7 @@
 			extension = attachment.filename.split('.').pop();
 
 			if ( _.contains( wp.media.view.settings.embedExts, extension ) ) {
-				shortcode[extension] = attachment.url;
+				shortcode[extension] = attachment.id;
 			} else {
 				// Render unsupported audio and video files as links.
 				return wp.media.string.link( props );
Index: src/wp-includes/media-template.php
===================================================================
--- src/wp-includes/media-template.php	(revision 28157)
+++ src/wp-includes/media-template.php	(working copy)
@@ -16,6 +16,7 @@
 function wp_underscore_audio_template() {
 	$audio_types = wp_get_audio_extensions();
 ?>
+<# var resolvedSrc; #>
 <audio controls
 	class="wp-audio-shortcode"
 	width="{{ _.isUndefined( data.model.width ) ? 400 : data.model.width }}"
@@ -27,13 +28,17 @@
 	}
 	<?php endforeach ?>#>
 >
-	<# if ( ! _.isEmpty( data.model.src ) ) { #>
-	<source src="{{ data.model.src }}" type="{{ wp.media.view.settings.embedMimes[ data.model.src.split('.').pop() ] }}" />
+	<# if ( ! _.isEmpty( data.model.src ) ) {
+		resolvedSrc = data.model.src.match(/^[0-9]+$/) ? _.findWhere( data.attachments, { id: parseInt( data.model.src, 10 ) } ).url : data.model.src;
+	#>
+	<source src="{{ resolvedSrc }}" type="{{ wp.media.view.settings.embedMimes[ data.model.src.split('.').pop() ] }}" />
 	<# } #>
 
 	<?php foreach ( $audio_types as $type ):
-	?><# if ( ! _.isEmpty( data.model.<?php echo $type ?> ) ) { #>
-	<source src="{{ data.model.<?php echo $type ?> }}" type="{{ wp.media.view.settings.embedMimes[ '<?php echo $type ?>' ] }}" />
+	?><# if ( ! _.isEmpty( data.model.<?php echo $type ?> ) ) {
+		resolvedSrc = data.model.<?php echo $type ?>.match(/^[0-9]+$/) ? _.findWhere( data.attachments, { id: parseInt( data.model.<?php echo $type ?>, 10 ) } ).url : data.model.<?php echo $type ?>;
+	#>
+	<source src="{{ resolvedSrc }}" type="{{ wp.media.view.settings.embedMimes[ '<?php echo $type ?>' ] }}" />
 	<# } #>
 	<?php endforeach;
 ?></audio>
@@ -49,9 +54,11 @@
 function wp_underscore_video_template() {
 	$video_types = wp_get_video_extensions();
 ?>
-<#  var w, h, settings = wp.media.view.settings,
+<#  var w, h, settings = wp.media.view.settings, resolvedSrc,
 		isYouTube = ! _.isEmpty( data.model.src ) && data.model.src.match(/youtube|youtu\.be/);
 
+	console.log( data );
+
 	if ( settings.contentWidth && data.model.width >= settings.contentWidth ) {
 		w = settings.contentWidth;
 	} else {
@@ -69,19 +76,12 @@
 	class="wp-video-shortcode{{ isYouTube ? ' youtube-video' : '' }}"
 	width="{{ w }}"
 	height="{{ h }}"
-	<?php
-	$props = array( 'poster' => '', 'preload' => 'metadata' );
-	foreach ( $props as $key => $value ):
-		if ( empty( $value ) ) {
-		?><#
-		if ( ! _.isUndefined( data.model.<?php echo $key ?> ) && data.model.<?php echo $key ?> ) {
-			#> <?php echo $key ?>="{{ data.model.<?php echo $key ?> }}"<#
-		} #>
-		<?php } else {
-			echo $key ?>="{{ _.isUndefined( data.model.<?php echo $key ?> ) ? '<?php echo $value ?>' : data.model.<?php echo $key ?> }}"<?php
-		}
-	endforeach;
-	?><#
+	<# if ( ! _.isUndefined( data.model.poster ) && data.model.poster ) {
+		resolvedSrc = data.model.poster.match(/^[0-9]+$/) ? _.findWhere( data.attachments, { id: parseInt( data.model.poster, 10 ) } ).url : data.model.poster;
+		#> poster="{{ resolvedSrc }}"<#
+	} #>
+	metadata="{{ _.isUndefined( data.model.preload ) ? 'metadata' : data.model.preload }}"
+	<#
 	<?php foreach ( array( 'autoplay', 'loop' ) as $attr ):
 	?> if ( ! _.isUndefined( data.model.<?php echo $attr ?> ) && data.model.<?php echo $attr ?> ) {
 		#> <?php echo $attr ?><#
@@ -91,14 +91,18 @@
 	<# if ( ! _.isEmpty( data.model.src ) ) {
 		if ( isYouTube ) { #>
 		<source src="{{ data.model.src }}" type="video/youtube" />
-		<# } else { #>
-		<source src="{{ data.model.src }}" type="{{ settings.embedMimes[ data.model.src.split('.').pop() ] }}" />
+		<# } else {
+			resolvedSrc = data.model.src.match(/^[0-9]+$/) ? _.findWhere( data.attachments, { id: parseInt( data.model.src, 10 ) } ).url : data.model.src;
+		#>
+		<source src="{{ resolvedSrc }}" type="{{ settings.embedMimes[ data.model.src.split('.').pop() ] }}" />
 		<# }
 	} #>
 
 	<?php foreach ( $video_types as $type ):
-	?><# if ( data.model.<?php echo $type ?> ) { #>
-	<source src="{{ data.model.<?php echo $type ?> }}" type="{{ settings.embedMimes[ '<?php echo $type ?>' ] }}" />
+	?><# if ( data.model.<?php echo $type ?> ) {
+		resolvedSrc = data.model.<?php echo $type ?>.match(/^[0-9]+$/) ? _.findWhere( data.attachments, { id: parseInt( data.model.<?php echo $type ?>, 10 ) } ).url : data.model.<?php echo $type ?>;
+	#>
+	<source src="{{ resolvedSrc }}" type="{{ settings.embedMimes[ '<?php echo $type ?>' ] }}" />
 	<# } #>
 	<?php endforeach; ?>
 	{{{ data.model.content }}}
@@ -812,7 +816,14 @@
 				#>
 				<label class="setting">
 					<span>SRC</span>
+					<# if ( data.model.src.match(/^[0-9]+$/) ) {
+						resolvedSrc = _.findWhere( data.attachments, {id: parseInt( data.model.src, 10 )} ).url;
+					#>
+					<input type="text" disabled="disabled" value="{{ resolvedSrc }}" />
+					<input type="hidden" data-setting="src" value="{{ data.model.src }}" />
+					<# } else { #>
 					<input type="text" disabled="disabled" data-setting="src" value="{{ data.model.src }}" />
+					<# } #>
 					<a class="remove-setting"><?php _e( 'Remove' ); ?></a>
 				</label>
 				<# } #>
@@ -826,8 +837,14 @@
 				#>
 				<label class="setting">
 					<span><?php echo strtoupper( $type ) ?></span>
+					<# if ( data.model.<?php echo $type ?>.match(/^[0-9]+$/) ) {
+						resolvedSrc = _.findWhere( data.attachments, {id: parseInt( data.model.<?php echo $type ?>, 10 )} ).url;
+					#>
+					<input type="text" disabled="disabled" value="{{ resolvedSrc }}" />
+					<input type="hidden" data-setting="<?php echo $type ?>" value="{{ data.model.<?php echo $type ?> }}" />
+					<# } else { #>
 					<input type="text" disabled="disabled" data-setting="<?php echo $type ?>" value="{{ data.model.<?php echo $type ?> }}" />
-					<a class="remove-setting"><?php _e( 'Remove' ); ?></a>
+					<# } #><a class="remove-setting"><?php _e( 'Remove' ); ?></a>
 				</label>
 				<# } #>
 				<?php endforeach ?>
@@ -867,7 +884,7 @@
 	</script>
 
 	<script type="text/html" id="tmpl-video-details">
-		<# var ext, html5types = {
+		<# var resolvedSrc, ext, html5types = {
 			mp4: wp.media.view.settings.embedMimes.mp4,
 			ogv: wp.media.view.settings.embedMimes.ogv,
 			webm: wp.media.view.settings.embedMimes.webm
@@ -897,7 +914,14 @@
 				#>
 				<label class="setting">
 					<span>SRC</span>
+					<# if ( data.model.src.match(/^[0-9]+$/) ) {
+						resolvedSrc = _.findWhere( data.attachments, {id: parseInt( data.model.src, 10 )} ).url;
+					#>
+					<input type="text" disabled="disabled" value="{{ resolvedSrc }}" />
+					<input type="hidden" data-setting="src" value="{{ data.model.src }}" />
+					<# } else { #>
 					<input type="text" disabled="disabled" data-setting="src" value="{{ data.model.src }}" />
+					<# } #>
 					<a class="remove-setting"><?php _e( 'Remove' ); ?></a>
 				</label>
 				<# } #>
@@ -909,7 +933,14 @@
 				#>
 				<label class="setting">
 					<span><?php echo strtoupper( $type ) ?></span>
+					<# if ( data.model.<?php echo $type ?>.match(/^[0-9]+$/) ) {
+						resolvedSrc = _.findWhere( data.attachments, {id: parseInt( data.model.<?php echo $type ?>, 10 )} ).url;
+					#>
+					<input type="text" disabled="disabled" value="{{ resolvedSrc }}" />
+					<input type="hidden" data-setting="<?php echo $type ?>" value="{{ data.model.<?php echo $type ?> }}" />
+					<# } else { #>
 					<input type="text" disabled="disabled" data-setting="<?php echo $type ?>" value="{{ data.model.<?php echo $type ?> }}" />
+					<# } #>
 					<a class="remove-setting"><?php _e( 'Remove' ); ?></a>
 				</label>
 				<# } #>
@@ -930,7 +961,14 @@
 				<# if ( ! _.isEmpty( data.model.poster ) ) { #>
 				<label class="setting">
 					<span><?php _e( 'Poster Image' ); ?></span>
+					<# if ( data.model.poster.match(/^[0-9]+$/) ) {
+						resolvedSrc = _.findWhere( data.attachments, {id: parseInt( data.model.poster, 10 )} ).url;
+					#>
+					<input type="text" disabled="disabled" value="{{ resolvedSrc }}" />
+					<input type="hidden" data-setting="poster" value="{{ data.model.poster }}" />
+					<# } else { #>
 					<input type="text" disabled="disabled" data-setting="poster" value="{{ data.model.poster }}" />
+					<# } #>
 					<a class="remove-setting"><?php _e( 'Remove' ); ?></a>
 				</label>
 				<# } #>
Index: src/wp-includes/media.php
===================================================================
--- src/wp-includes/media.php	(revision 28157)
+++ src/wp-includes/media.php	(working copy)
@@ -1713,6 +1713,10 @@
 
 	$primary = false;
 	if ( ! empty( $src ) ) {
+		if ( is_numeric( $src ) ) {
+			$src = get_attached_file( $src );
+		}
+
 		if ( ! preg_match( $yt_pattern, $src ) ) {
 			$type = wp_check_filetype( $src, wp_get_mime_types() );
 			if ( ! in_array( strtolower( $type['ext'] ), $default_types ) ) {
@@ -1724,6 +1728,13 @@
 	} else {
 		foreach ( $default_types as $ext ) {
 			if ( ! empty( $$ext ) ) {
+				if ( is_numeric( $$ext ) ) {
+					$$ext = get_attached_file( $$ext );
+					if ( empty( $$ext ) ) {
+						continue;
+					}
+				}
+
 				$type = wp_check_filetype( $$ext, wp_get_mime_types() );
 				if ( strtolower( $type['ext'] ) === $ext )
 					$primary = true;
@@ -2615,15 +2626,16 @@
 		$id = get_post_thumbnail_id( $attachment->ID );
 		if ( ! empty( $id ) ) {
 			list( $src, $width, $height ) = wp_get_attachment_image_src( $id, 'full' );
-			$response['image'] = compact( 'src', 'width', 'height' );
+			$response['image'] = compact( 'id', 'src', 'width', 'height' );
 			list( $src, $width, $height ) = wp_get_attachment_image_src( $id, 'thumbnail' );
-			$response['thumb'] = compact( 'src', 'width', 'height' );
+			$response['thumb'] = compact( 'id', 'src', 'width', 'height' );
 		} else {
+			$id = 0;
 			$src = wp_mime_type_icon( $attachment->ID );
 			$width = 48;
 			$height = 64;
-			$response['image'] = compact( 'src', 'width', 'height' );
-			$response['thumb'] = compact( 'src', 'width', 'height' );
+			$response['image'] = compact( 'id', 'src', 'width', 'height' );
+			$response['thumb'] = compact( 'id', 'src', 'width', 'height' );
 		}
 	}
 
