Make WordPress Core

Changeset 28364


Ignore:
Timestamp:
05/11/2014 02:06:36 AM (12 years ago)
Author:
wonderboymusic
Message:

When pausing "all" players attached to MCE views, don't reach into global scope and pause "every" player. Only pause the players bound to MCE views.

Fixes #27971.

Location:
trunk/src/wp-includes/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/mce-view.js

    r28358 r28364  
    372372                                frame, data, callback;
    373373
    374                         wp.media.mixin.pauseAllPlayers();
     374                        $( document ).trigger( 'media:edit' );
    375375
    376376                        data = window.decodeURIComponent( $( node ).attr('data-wpview-text') );
     
    408408                        this.players = [];
    409409                        this.shortcode = options.shortcode;
    410                         _.bindAll( this, 'setPlayer' );
    411                         $(this).on( 'ready', this.setPlayer );
     410                        _.bindAll( this, 'setPlayer', 'pausePlayers' );
     411                        $( this ).on( 'ready', this.setPlayer );
     412                        $( 'body' ).on( 'click', '.wp-switch-editor', this.pausePlayers );
     413                        $( document ).on( 'media:edit', this.pausePlayers );
    412414                },
    413415
     
    525527                        this.attachments = [];
    526528                        this.shortcode = options.shortcode;
     529
     530                        $( 'body' ).on( 'click', '.wp-switch-editor', this.pausePlayers );
     531                        $( document ).on( 'media:edit', this.pausePlayers );
     532
    527533                        this.fetch();
    528534                },
     
    688694                        unbind: function() {
    689695                                var self = this;
    690                                 this.pauseAllPlayers();
    691696                                _.each( this.players, function ( player ) {
     697                                        player.pause();
    692698                                        self.removePlayer( player );
    693699                                } );
  • trunk/src/wp-includes/js/media-audiovideo.js

    r28358 r28364  
    2525                                }
    2626                        }
     27                },
     28
     29                /**
     30                 * Pauses the current object's instances of MediaElementPlayer
     31                 */
     32                pausePlayers: function() {
     33                        _.each( this.players, function (player) {
     34                                player.pause();
     35                        } );
    2736                },
    2837
     
    169178                unsetPlayers : function() {
    170179                        if ( this.players && this.players.length ) {
    171                                 wp.media.mixin.pauseAllPlayers();
    172180                                _.each( this.players, function (player) {
     181                                        player.pause();
    173182                                        wp.media.mixin.removePlayer( player );
    174183                                } );
     
    912921        function init() {
    913922                $(document.body)
    914                         .on( 'click', '.wp-switch-editor', wp.media.mixin.pauseAllPlayers )
    915923                        .on( 'click', '.add-media-source', function( e ) {
    916924                                media.frame.lastMime = $( e.currentTarget ).data( 'mime' );
Note: See TracChangeset for help on using the changeset viewer.