/** * Content object * @markdown <p>A "content" is what we see, e.g. the name of the video. You can add a category to sort content objects (videos, music) in folders.</p> <p>Example:</p> var myContent = new econda.media.Content({ name: "My Skater Video", category: "/News/Sports" }); var tracker = new econda.media.MediaTracker({ content: myContent, duration: 120 }); // or as a shorthand version... var tracker = new econda.media.MediaTracker({ content: { name: "My Skater Video", category: "/News/Sports" } duration: 120 }); * * @class econda.media.Content * @extends econda.base.Object */ econda.media.Content = function(cfg) { cfg = cfg || {}; /** * Private properties collection * @property {Object} __p * @private */ var __p = { /** * @cfg {String} name * Name of content, may NOT contains slashes */ name: null, /** * @cfg {Array} categories * Array of econda.media.Category objects */ category: [] }; /** * Handle non object config values as value for property... * @property {String} __defaultProperty * @private */ this.__defaultProperty = "name"; /** * Set name property of content object * @method * @param {String} name New name value */ this.setName = function(name) { __p["name"] = name; return this; }; /** * Get current value of name property * @method * @return {String} The nmae */ this.getName = function() { return __p["name"]; }; /** * Add category * @method * @param {String/econda.media.Category} */ this.setCategory = function(category) { __p["category"] = new econda.media.Category(category); return this; }; /** * Get associated category object. * @method * @return {econda.media.Category} */ this.getCategory = function() { return __p["category"]; }; /** * Returns category path + name as string * @method * @return {String} e.g. "/ProductVideos/MyVideo" or "MyVideo" (if there's no category assigned) */ this.toString = function() { var cat = this.getCategory(); if(cat != null) { ret = cat.toString() + "/" + this.getName(); } else { ret = this.getName(); } return ret; }; // Constructor return this.setup(cfg, __p); }; econda.media.Content.prototype = new econda.base.Object("name");