this.on( 'media:setting:remove', wp.media.mixin.unsetPlayers, this );
this.on( 'media:setting:remove', this.render );
this.on( 'media:setting:remove', this.setPlayer );
- this.events = _.extend( this.events, {
+
+ AttachmentDisplay.prototype.initialize.apply( this, arguments );
+ },
+
+ events: function(){
+ return _.extend( {
'click .remove-setting' : 'removeSetting',
'change .content-track' : 'setTracks',
'click .remove-track' : 'setTracks',
'click .add-media-source' : 'addSource'
- } );
-
- AttachmentDisplay.prototype.initialize.apply( this, arguments );
+ }, AttachmentDisplay.prototype.events );
},
prepare: function() {
* @global MediaElementPlayer
*/
setPlayer : function() {
- var baseSettings;
+ var baseSettings, src;
if ( this.players.length || ! this.media || this.scriptXhr ) {
return;
}
- if ( this.model.get( 'src' ).indexOf( 'vimeo' ) > -1 && ! ( 'Froogaloop' in window ) ) {
+ src = this.model.get( 'src' );
+
+ if ( src && src.indexOf( 'vimeo' ) > -1 && ! ( 'Froogaloop' in window ) ) {
baseSettings = wp.media.mixin.mejsSettings;
this.scriptXhr = $.getScript( baseSettings.pluginPath + 'froogaloop.min.js', _.bind( this.loadPlayer, this ) );
} else {