Changeset 27538
- Timestamp:
- 03/14/2014 01:47:24 PM (11 years ago)
- Location:
- trunk/src/wp-includes/js
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/media-editor.js
r27537 r27538 305 305 window.mejs.players[p].pause(); 306 306 } 307 } 308 }, 309 310 /** 311 * Override the MediaElement method for removing a player. 312 * MediaElement tries to pull the audio/video tag out of 313 * its container and re-add it to the DOM. 314 */ 315 removePlayer: function() { 316 var t = this.player, featureIndex, feature; 317 318 // invoke features cleanup 319 for ( featureIndex in t.options.features ) { 320 feature = t.options.features[featureIndex]; 321 if ( t['clean' + feature] ) { 322 try { 323 t['clean' + feature](t); 324 } catch (e) {} 325 } 326 } 327 328 if ( ! t.isDynamic ) { 329 t.$node.remove(); 330 } 331 332 if ( 'native' !== t.media.pluginType ) { 333 t.media.remove(); 334 } 335 336 delete window.mejs.players[t.id]; 337 338 t.container.remove(); 339 t.globalUnbind(); 340 delete t.node.player; 341 }, 342 343 /** 344 * Allows any class that has set 'player' to a MediaElementPlayer 345 * instance to remove the player when listening to events. 346 * 347 * Examples: modal closes, shortcode properties are removed, etc. 348 */ 349 unsetPlayer : function() { 350 if ( this.player ) { 351 wp.media.mixin.pauseAllPlayers(); 352 wp.media.mixin.removePlayer.apply( this ); 353 this.player = false; 307 354 } 308 355 } -
trunk/src/wp-includes/js/media-views.js
r27535 r27538 6548 6548 media.view.MediaDetails = media.view.Settings.AttachmentDisplay.extend({ 6549 6549 initialize: function() { 6550 _.bindAll(this, 'success' , 'unsetPlayer');6551 6552 this.listenTo( this.controller, 'close', this.unsetPlayer );6550 _.bindAll(this, 'success'); 6551 6552 this.listenTo( this.controller, 'close', media.mixin.unsetPlayer ); 6553 6553 this.on( 'ready', this.setPlayer ); 6554 this.on( 'media:setting:remove', this.unsetPlayer);6554 this.on( 'media:setting:remove', media.mixin.unsetPlayer, this ); 6555 6555 this.on( 'media:setting:remove', this.render ); 6556 6556 this.on( 'media:setting:remove', this.setPlayer ); … … 6605 6605 setMedia : function () { 6606 6606 return this; 6607 },6608 6609 /**6610 * Override the MediaElement method for removing a player.6611 * MediaElement tries to pull the audio/video tag out of6612 * its container and re-add it to the DOM.6613 */6614 removePlayer: function() {6615 var t = this.player, featureIndex, feature;6616 6617 // invoke features cleanup6618 for ( featureIndex in t.options.features ) {6619 feature = t.options.features[featureIndex];6620 if ( t['clean' + feature] ) {6621 try {6622 t['clean' + feature](t);6623 } catch (e) {}6624 }6625 }6626 6627 if ( ! t.isDynamic ) {6628 t.$node.remove();6629 }6630 6631 if ( 'native' !== t.media.pluginType ) {6632 t.media.remove();6633 }6634 6635 delete window.mejs.players[t.id];6636 6637 t.container.remove();6638 t.globalUnbind();6639 delete t.node.player;6640 },6641 6642 unsetPlayer : function() {6643 if ( this.player ) {6644 if ( _.isUndefined( this.mejs.pluginType ) ) {6645 this.mejs.pause();6646 }6647 this.removePlayer();6648 this.player = false;6649 }6650 6607 }, 6651 6608
Note: See TracChangeset
for help on using the changeset viewer.