]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/media-audiovideo.js
WordPress 4.5
[autoinstalls/wordpress.git] / wp-includes / js / media-audiovideo.js
index 5c64097c9d2dd8e4f5235b96ef5df6c125a321b8..e37a22189fac3f58c0bf4b9ed7279b21931b8a56 100644 (file)
@@ -728,14 +728,17 @@ MediaDetails = AttachmentDisplay.extend({
                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() {
@@ -792,13 +795,15 @@ MediaDetails = AttachmentDisplay.extend({
         * @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 {