diff -r 7c1d08cf6956 -r e1baacb52075 src/js/model.js --- a/src/js/model.js Fri Sep 14 10:38:04 2012 +0900 +++ b/src/js/model.js Wed Sep 19 14:11:49 2012 +0900 @@ -364,7 +364,7 @@ this.contents = new IriSP.Model.List(this.source.directory); this.contents.addIds(this.id); } else { - this.contents = this.source.directory.getElement(this.id); + this.contents = this.source.getElement(this.id); } } @@ -450,6 +450,23 @@ IriSP.Model.Media.prototype = new IriSP.Model.Element(); +/* Default functions to be overriden by players */ + +IriSP.Model.Media.prototype.getCurrentTime = function() { return new IriSP.Model.Time(0); } + +IriSP.Model.Media.prototype.getVolume = function() { return .5; } + +IriSP.Model.Media.prototype.getPaused = function() { return true; } + +IriSP.Model.Media.prototype.getMuted = function() { return false; } + +IriSP.Model.Media.prototype.setCurrentTime + = IriSP.Model.Media.prototype.setVolume + = IriSP.Model.Media.prototype.setMuted + = IriSP.Model.Media.prototype.play + = IriSP.Model.Media.prototype.pause + = function() {} + IriSP.Model.Media.prototype.setDuration = function(_durationMs) { this.duration.setMilliseconds(_durationMs); } @@ -647,6 +664,23 @@ } } +/* Default functions to be overriden by players */ + +IriSP.Model.Mashup.prototype.getCurrentTime = function() { return new IriSP.Model.Time(0); } + +IriSP.Model.Mashup.prototype.getVolume = function() { return .5; } + +IriSP.Model.Mashup.prototype.getPaused = function() { return true; } + +IriSP.Model.Mashup.prototype.getMuted = function() { return false; } + +IriSP.Model.Mashup.prototype.setCurrentTime + = IriSP.Model.Mashup.prototype.setVolume + = IriSP.Model.Mashup.prototype.setMuted + = IriSP.Model.Mashup.prototype.play + = IriSP.Model.Mashup.prototype.pause + = function() {} + /* */ IriSP.Model.Source = function(_config) { @@ -768,6 +802,23 @@ } } +IriSP.Model.Source.prototype.getCurrentMedia = function(_opts) { + if (typeof this.currentMedia === "undefined") { + if (_opts.is_mashup) { + var _mashups = this.getMashups(); + if (_mashups.length) { + this.currentMedia = _mashups[0]; + } + } else { + var _medias = this.getMedias(); + if (_medias.length) { + _media = _medias[0]; + } + } + } + return this.currentMedia; +} + IriSP.Model.Source.prototype.merge = function(_source) { var _this = this; _source.forEach(function(_value, _key) {