integration/js/model.js
changeset 143 3a2f9993c6cb
parent 141 f1b68efb360a
child 144 57f1d252b8f9
equal deleted inserted replaced
142:b1b624f81f22 143:3a2f9993c6cb
   546     this.elementType = 'playable';
   546     this.elementType = 'playable';
   547     this.currentTime = new Model.Time();
   547     this.currentTime = new Model.Time();
   548     this.volume = .5;
   548     this.volume = .5;
   549     this.paused = true;
   549     this.paused = true;
   550     this.muted = false;
   550     this.muted = false;
       
   551     this.loadedMetadata = false;
   551     var _this = this;
   552     var _this = this;
   552     this.on("play", function() {
   553     this.on("play", function() {
   553         _this.paused = false;
   554         _this.paused = false;
   554     });
   555     });
   555     this.on("pause", function() {
   556     this.on("pause", function() {
   570             _a.playing = true;
   571             _a.playing = true;
   571             _a.trigger("enter");
   572             _a.trigger("enter");
   572             _this.trigger("enter-annotation",_a);
   573             _this.trigger("enter-annotation",_a);
   573         });
   574         });
   574     });
   575     });
       
   576     this.on("loadedmetadata", function() {
       
   577         _this.loadedMetadata = true;
       
   578     })
   575 }
   579 }
   576 
   580 
   577 Model.Playable.prototype = new Model.Element();
   581 Model.Playable.prototype = new Model.Element();
   578 
   582 
   579 Model.Playable.prototype.getCurrentTime = function() { 
   583 Model.Playable.prototype.getCurrentTime = function() { 
   812     this.on("add", this._updateTimes);
   816     this.on("add", this._updateTimes);
   813     this.on("remove", this._updateTimes);
   817     this.on("remove", this._updateTimes);
   814 }
   818 }
   815 
   819 
   816 Model.Mashup.prototype = new Model.Playable();
   820 Model.Mashup.prototype = new Model.Playable();
   817 
       
   818 Model.Mashup.prototype.checkLoaded = function() {
       
   819     var loaded = !!this.segments.length;
       
   820     this.getMedias().forEach(function(_m) {
       
   821         loaded = loaded && _m.loaded;
       
   822     });
       
   823     this.loaded = loaded;
       
   824     if (loaded) {
       
   825         this.trigger("loadedmetadata");
       
   826     }
       
   827 }
       
   828 
   821 
   829 Model.Mashup.prototype.updateTimes = function() {
   822 Model.Mashup.prototype.updateTimes = function() {
   830     var _time = 0;
   823     var _time = 0;
   831     this.segments.forEach(function(_segment) {
   824     this.segments.forEach(function(_segment) {
   832         _segment.setBegin(_time);
   825         _segment.setBegin(_time);