Ticket #27892: 27892.diff
File 27892.diff, 2.5 KB (added by , 10 years ago) |
---|
-
src/wp-includes/js/mediaelement/wp-playlist.js
7 7 initialize : function (options) { 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 ); 12 13 … … 26 27 this.renderTracks(); 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' ); 32 35 … … 44 47 45 48 bindResetPlayer : function (mejs) { 46 49 this.bindPlayer( mejs ); 47 this.playCurrentSrc(); 50 if ( this.isCompatibleSrc() ) { 51 this.playCurrentSrc(); 52 } 48 53 }, 49 54 50 setPlayer: function () { 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) { 51 72 if ( this._player ) { 52 73 this._player.pause(); 53 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 */ … … 134 161 }, 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.player && this.player.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(); 147 174 }