diff --git a/src/js/media/views/attachment/details.js b/src/js/media/views/attachment/details.js index 8317dbdfdada5..80f871b87ed76 100644 --- a/src/js/media/views/attachment/details.js +++ b/src/js/media/views/attachment/details.js @@ -266,8 +266,7 @@ Details = Attachment.extend(/** @lends wp.media.view.Attachment.Details.prototyp wp.media.mixin.removeAllPlayers(); this.$( 'audio, video' ).each( function (i, elem) { - var el = wp.media.view.MediaDetails.prepareSrc( elem ); - new window.MediaElementPlayer( el, wp.media.mixin.mejsSettings ); + new window.MediaElementPlayer( elem, wp.media.mixin.mejsSettings ); } ); } }); diff --git a/src/js/media/views/audio-details.js b/src/js/media/views/audio-details.js index afafca3080673..b51580cbbd338 100644 --- a/src/js/media/views/audio-details.js +++ b/src/js/media/views/audio-details.js @@ -25,7 +25,7 @@ AudioDetails = MediaDetails.extend(/** @lends wp.media.view.AudioDetails.prototy if ( audio.is(':hidden') ) { audio.show(); } - this.media = MediaDetails.prepareSrc( audio.get(0) ); + this.media = audio.get(0); } else { audio.hide(); this.media = false; diff --git a/src/js/media/views/media-details.js b/src/js/media/views/media-details.js index 5fdeb64a05cd1..13dd9ee51db73 100644 --- a/src/js/media/views/media-details.js +++ b/src/js/media/views/media-details.js @@ -180,24 +180,15 @@ MediaDetails = AttachmentDisplay.extend(/** @lends wp.media.view.MediaDetails.pr this.$( '.embed-media-settings' ).scrollTop( 0 ); } },/** @lends wp.media.view.MediaDetails */{ - instances : 0, /** - * When multiple players in the DOM contain the same src, things get weird. + * Formerly appended a cache-busting query arg to each media source. * - * @param {HTMLElement} elem The HTML element containing the media sources to be prepared. - * @return {HTMLElement} The prepared element. + * @deprecated 7.3.0 Returns the element unchanged. + * + * @param {HTMLElement} elem The HTML element containing the media sources. + * @return {HTMLElement} The unchanged element. */ prepareSrc : function( elem ) { - var i = MediaDetails.instances++; - _.each( $( elem ).find( 'source' ), function( source ) { - source.src = [ - source.src, - source.src.indexOf('?') > -1 ? '&' : '?', - '_=', - i - ].join(''); - } ); - return elem; } }); diff --git a/src/js/media/views/video-details.js b/src/js/media/views/video-details.js index ac5c91e3c634f..532173d2ade84 100644 --- a/src/js/media/views/video-details.js +++ b/src/js/media/views/video-details.js @@ -27,7 +27,7 @@ VideoDetails = MediaDetails.extend(/** @lends wp.media.view.VideoDetails.prototy } if ( ! video.hasClass( 'youtube-video' ) && ! video.hasClass( 'vimeo-video' ) ) { - this.media = MediaDetails.prepareSrc( video.get(0) ); + this.media = video.get(0); } else { this.media = video.get(0); } diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index 4cd69ade6cbb7..fa6f1d20e7393 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -3683,8 +3683,7 @@ function wp_audio_shortcode( $attr, $content = '' ) { } $type = wp_check_filetype( $atts[ $fallback ], wp_get_mime_types() ); - $url = add_query_arg( '_', $instance, $atts[ $fallback ] ); - $html .= sprintf( $source, $type['type'], esc_url( $url ) ); + $html .= sprintf( $source, $type['type'], esc_url( $atts[ $fallback ] ) ); } } @@ -3966,8 +3965,7 @@ function wp_video_shortcode( $attr, $content = '' ) { } else { $type = wp_check_filetype( $atts[ $fallback ], wp_get_mime_types() ); } - $url = add_query_arg( '_', $instance, $atts[ $fallback ] ); - $html .= sprintf( $source, $type['type'], esc_url( $url ) ); + $html .= sprintf( $source, $type['type'], esc_url( $atts[ $fallback ] ) ); } } diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php index af84065113267..261ec42846e58 100644 --- a/tests/phpunit/tests/media.php +++ b/tests/phpunit/tests/media.php @@ -1550,7 +1550,7 @@ static function ( $html, $attr, $content, $id ) use ( &$instance ) { $expected = '