src/js/model.js
branchplayers-as-widgets
changeset 959 ee11ed1b739e
parent 957 4da0a5740b6c
child 964 d7d56ea2d0a6
equal deleted inserted replaced
958:2aa7fdb0762a 959:ee11ed1b739e
   450 
   450 
   451 IriSP.Model.Media.prototype = new IriSP.Model.Element();
   451 IriSP.Model.Media.prototype = new IriSP.Model.Element();
   452 
   452 
   453 /* Default functions to be overriden by players */
   453 /* Default functions to be overriden by players */
   454 
   454 
   455 IriSP.Model.Media.prototype.getCurrentTime = function() { return 0; }
   455 IriSP.Model.Media.prototype.getCurrentTime = function() {  return new IriSP.Model.Time(0); }
   456 
   456 
   457 IriSP.Model.Media.prototype.getVolume = function() { return .5; }
   457 IriSP.Model.Media.prototype.getVolume = function() { return .5; }
   458 
   458 
   459 IriSP.Model.Media.prototype.getPaused = function() { return true; }
   459 IriSP.Model.Media.prototype.getPaused = function() { return true; }
   460 
   460 
   661         return _annotation.getMedia();
   661         return _annotation.getMedia();
   662     } else {
   662     } else {
   663         return undefined;
   663         return undefined;
   664     }
   664     }
   665 }
   665 }
       
   666 
       
   667 /* Default functions to be overriden by players */
       
   668 
       
   669 IriSP.Model.Mashup.prototype.getCurrentTime = function() { return new IriSP.Model.Time(0); }
       
   670 
       
   671 IriSP.Model.Mashup.prototype.getVolume = function() { return .5; }
       
   672 
       
   673 IriSP.Model.Mashup.prototype.getPaused = function() { return true; }
       
   674 
       
   675 IriSP.Model.Mashup.prototype.getMuted = function() { return false; }
       
   676 
       
   677 IriSP.Model.Mashup.prototype.setCurrentTime
       
   678     = IriSP.Model.Mashup.prototype.setVolume
       
   679     = IriSP.Model.Mashup.prototype.setMuted
       
   680     = IriSP.Model.Mashup.prototype.play
       
   681     = IriSP.Model.Mashup.prototype.pause
       
   682     = function() {}
   666 
   683 
   667 /* */
   684 /* */
   668 
   685 
   669 IriSP.Model.Source = function(_config) {
   686 IriSP.Model.Source = function(_config) {
   670     this.status = IriSP.Model._SOURCE_STATUS_EMPTY;
   687     this.status = IriSP.Model._SOURCE_STATUS_EMPTY;
   784         return this.currentMedia.duration;
   801         return this.currentMedia.duration;
   785     }
   802     }
   786 }
   803 }
   787 
   804 
   788 IriSP.Model.Source.prototype.getCurrentMedia = function(_opts) {
   805 IriSP.Model.Source.prototype.getCurrentMedia = function(_opts) {
   789     if (typeof _opts === "undefined") {
   806     if (typeof this.currentMedia === "undefined") {
   790         var _opts = {};
   807         if (_opts.is_mashup) {
   791     }
       
   792     if (typeof this.currentMedia === "undefined" || _opts.override) {
       
   793         if (_opts.mashup) {
       
   794             var _mashups = this.getMashups();
   808             var _mashups = this.getMashups();
   795             if (_mashups.length) {
   809             if (_mashups.length) {
   796                 this.currentMedia = _mashups[0];
   810                 this.currentMedia = _mashups[0];
   797             }
   811             }
   798         } else {
   812         } else {