diff --git a/src/wp-includes/js/media-views.js b/src/wp-includes/js/media-views.js
index a1b9bb5211..862ec7bf59 100644
--- a/src/wp-includes/js/media-views.js
+++ b/src/wp-includes/js/media-views.js
@@ -6237,7 +6237,6 @@
close : function() {
this.mejs.pause();
- this.remove();
},
player : function (mejs) {
@@ -6302,7 +6301,6 @@
close : function() {
this.mejs.pause();
- this.remove();
},
player : function (mejs) {
@@ -6310,7 +6308,7 @@
},
render: function() {
- var self = this, settings = {
+ var video, self = this, settings = {
success : this.player
};
@@ -6321,7 +6319,14 @@
media.view.Settings.AttachmentDisplay.prototype.render.apply( this, arguments );
setTimeout( function() { self.resetFocus(); }, 10 );
- new MediaElementPlayer( this.$('.wp-video-shortcode').get(0), settings );
+ video = this.$('.wp-video-shortcode').get(0);
+ video.src = [
+ video.src,
+ video.src.indexOf('?') > -1 ? '&' : '?',
+ (new Date()).getTime()
+ ].join('');
+
+ new MediaElementPlayer( video, settings );
return this;
},
diff --git a/src/wp-includes/js/tinymce/plugins/wpgallery/plugin.js b/src/wp-includes/js/tinymce/plugins/wpgallery/plugin.js
index 75ef53d6e0..cb73983d89 100644
--- a/src/wp-includes/js/tinymce/plugins/wpgallery/plugin.js
+++ b/src/wp-includes/js/tinymce/plugins/wpgallery/plugin.js
@@ -94,16 +94,24 @@ tinymce.PluginManager.add('wpgallery', function( editor ) {
});
} else if ( editor.dom.hasClass( node, 'wp-video' ) ) {
frame = wp.media.video.edit( data );
+ frame.on( 'close', function () {
+ frame.detach();
+ } );
frame.state( 'video-details' ).on( 'update replace', function ( selection ) {
var shortcode = wp.media.video.shortcode( selection );
editor.dom.setAttrib( node, 'data-wp-media', window.encodeURIComponent( shortcode ) );
+ frame.detach();
} );
frame.open();
} else if ( editor.dom.hasClass( node, 'wp-audio' ) ) {
frame = wp.media.audio.edit( data );
+ frame.on( 'close', function () {
+ frame.detach();
+ } );
frame.state( 'audio-details' ).on( 'update replace', function ( selection ) {
var shortcode = wp.media.audio.shortcode( selection );
editor.dom.setAttrib( node, 'data-wp-media', window.encodeURIComponent( shortcode ) );
+ frame.detach();
} );
frame.open();
} else {
diff --git a/src/wp-includes/media-template.php b/src/wp-includes/media-template.php
index 2a233da76a..8fcbb0831e 100644
--- a/src/wp-includes/media-template.php
+++ b/src/wp-includes/media-template.php
@@ -650,27 +650,21 @@ function wp_print_media_templates() {