Changeset 28171
- Timestamp:
- 04/20/2014 03:52:57 AM (10 years ago)
- Location:
- trunk/src/wp-includes/js
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/mce-view.js
r28144 r28171 612 612 }); 613 613 614 this.player = p. _player;614 this.player = p.player; 615 615 }, 616 616 -
trunk/src/wp-includes/js/mediaelement/wp-mediaelement.css
r28023 r28171 202 202 white-space: nowrap; 203 203 } 204 205 .wp-audio-playlist .me-cannotplay span { 206 padding: 5px 15px; 207 } -
trunk/src/wp-includes/js/mediaelement/wp-playlist.js
r28158 r28171 8 8 this.index = 0; 9 9 this.settings = {}; 10 this.compatMode = $( 'body' ).hasClass( 'wp-admin' ) && $( '#content_ifr' ).length; 10 11 this.data = options.metadata || $.parseJSON( this.$('script').html() ); 11 12 this.playerNode = this.$( this.data.type ); … … 27 28 } 28 29 29 this.playerNode.attr( 'src', this.current.get( 'src' ) ); 30 if ( this.isCompatibleSrc() ) { 31 this.playerNode.attr( 'src', this.current.get( 'src' ) ); 32 } 30 33 31 34 _.bindAll( this, 'bindPlayer', 'bindResetPlayer', 'setPlayer', 'ended', 'clickTrack' ); … … 39 42 40 43 bindPlayer : function (mejs) { 41 this. player= mejs;42 this. player.addEventListener( 'ended', this.ended );44 this.mejs = mejs; 45 this.mejs.addEventListener( 'ended', this.ended ); 43 46 }, 44 47 45 48 bindResetPlayer : function (mejs) { 46 49 this.bindPlayer( mejs ); 47 this.playCurrentSrc(); 48 }, 49 50 setPlayer: function () { 51 if ( this._player ) { 52 this._player.pause(); 53 this._player.remove(); 50 if ( this.isCompatibleSrc() ) { 51 this.playCurrentSrc(); 52 } 53 }, 54 55 isCompatibleSrc: function () { 56 var testNode; 57 58 if ( this.compatMode ) { 59 testNode = $( '<span><source type="' + this.current.get( 'type' ) + '" /></span>' ); 60 61 if ( ! wp.media.mixin.isCompatible( testNode ) ) { 62 this.playerNode.removeAttr( 'src' ); 63 this.playerNode.removeAttr( 'poster' ); 64 return; 65 } 66 } 67 68 return true; 69 }, 70 71 setPlayer: function (force) { 72 if ( this.player ) { 73 this.player.pause(); 74 this.player.remove(); 54 75 this.playerNode = this.$( this.data.type ); 55 this.playerNode.attr( 'src', this.current.get( 'src' ) ); 76 } 77 78 if (force) { 79 if ( this.isCompatibleSrc() ) { 80 this.playerNode.attr( 'src', this.current.get( 'src' ) ); 81 } 56 82 this.settings.success = this.bindResetPlayer; 57 83 } 84 58 85 /** 59 86 * This is also our bridge to the outside world 60 87 */ 61 this. _player = new MediaElementPlayer( this.playerNode.get(0), this.settings );88 this.player = new MediaElementPlayer( this.playerNode.get(0), this.settings ); 62 89 }, 63 90 64 91 playCurrentSrc : function () { 65 92 this.renderCurrent(); 66 this. player.setSrc( this.playerNode.attr( 'src' ) );67 this. player.load();68 this. player.play();93 this.mejs.setSrc( this.playerNode.attr( 'src' ) ); 94 this.mejs.load(); 95 this.mejs.play(); 69 96 }, 70 97 … … 135 162 136 163 loadCurrent : function () { 137 var last = this.playerNode.attr( 'src' ) .split('.').pop(),164 var last = this.playerNode.attr( 'src' ) && this.playerNode.attr( 'src' ).split('.').pop(), 138 165 current = this.current.get( 'src' ).split('.').pop(); 139 166 140 this. player.pause();167 this.mejs && this.mejs.pause(); 141 168 142 169 if ( last !== current ) { 143 this.setPlayer( );144 } else {170 this.setPlayer( true ); 171 } else if ( this.isCompatibleSrc() ) { 145 172 this.playerNode.attr( 'src', this.current.get( 'src' ) ); 146 173 this.playCurrentSrc();
Note: See TracChangeset
for help on using the changeset viewer.