Beispiel #1
0
 this.root.promise.done(_.bind(function() {
     var contentUrl = this.root.getLink('ev:Contents/Get'),
         contentUrlTemplate = contentUrl && new URITemplate(contentUrl.href),
         video, encoding;
     // If the contentId has changed, we need to fetch the
     // relevant content for it's default encoding
     if (this.model.changed.contentId) {
         this.encoding.clear();
         // Only fetch is model is not new, i.e. wasn't cleared
         if (!this.model.isNew() && contentUrlTemplate) {
             video = new Video({}, {
                 href: contentUrlTemplate.expand({
                     id: this.model.get('contentId')
                 })
             });
             video.fetch()
             .always(_.bind(function(response) {
                 encoding = video.getEmbedded('ev:Encodings/Default');
                 this.encoding.set(encoding && encoding.attributes || {});
                 // Note this will trigger another change
                 this.encoding.updateSettingsModel(this.model);
                 // Picker model is a copy so need to update that as well
                 this.encoding.updateSettingsModel(this.picker.model);
                 this.updateField();
             }, this));
         }
     } else {
         if (!this.model.isNew()) {
             this.updateField();
         }
     }
 }, this));
Beispiel #2
0
 this.root.promise.done(_.bind(function() {
     var contentUrl = this.root.getLink('ev:Contents/Get'),
         contentUrlTemplate = contentUrl && new URITemplate(contentUrl.href),
         video, encoding;
     if (!this.model.isNew() && contentUrlTemplate && this.model.get('contentId')) {
         video = new Video({}, {
             href: contentUrlTemplate.expand({
                 id: this.model.get('contentId')
             })
         });
         video.fetch()
         .done(_.bind(function(response) {
             encoding = video.getEmbedded('ev:Encodings/Default');
             this.encoding.set(encoding.attributes);
         }, this));
     }
 }, this));