Class TMediaData
The TMediaData object is used to manage track and advertisement metadata.
Basic functions are to:
- Format metadata to normalize fields & generate fields.
- Keep list short list of recently processed metadata.
- Provide centralized triggering of metadata events.
Defined in: <class.mediadata.js>.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
Construct a new TMediaData object.
|
| Field Attributes | Field Name and Description |
|---|---|
|
The URL where cover pictures are stored online.
|
|
|
The maximum number of media items to store in the history array.
|
|
|
Subscribe to the onData event to handle any new metadata that arrives.
|
|
|
Subscribe to the onHistoryLoaded event to be notified once all history data has been loaded.
|
| Method Attributes | Method Name and Description |
|---|---|
|
Retrieve current advertisement.
|
|
|
Retrieve last advertisement processed.
|
|
|
getMediaHistory(limit, mediatypes)
Retrieve items from history array.
|
Field Detail
{string}
coverpicture_url
The URL where cover pictures are stored online.
{int}
history_max
The maximum number of media items to store in the history array.
- Default Value:
- 20
{YUI_EVENT}
onData
Subscribe to the onData event to handle any new metadata that arrives.
Arguments passed back to the event handler function are:
Arguments passed back to the event handler function are:
- metadata - Media metadata array, containing either Track information or Ad-information.
{YUI_EVENT}
onHistoryLoaded
Subscribe to the onHistoryLoaded event to be notified once all history data has been loaded.
No arguments are passed back to event handler function.
No arguments are passed back to event handler function.
Method Detail
{array}
getCurrentAd()
Retrieve current advertisement.
- Returns:
- {array} Mediadata array of CURRENT advertisement. Null if none or advertisemented ended.
{array}
getLastAd()
Retrieve last advertisement processed.
- Returns:
- {array} Mediadata array of last advertisement processed. Null if none were processed yet.
{array}
getMediaHistory(limit, mediatypes)
Retrieve items from history array.
var md = new TMetaData();
var list = md.getMediaHistory(10,"A,S,N");
for(i = 0; i < list.length; i++)
alert('songtype: '+list[i]['songtype']+', title:'+list[i]['title']);
- Parameters:
- {int} limit
- The maximum number of items to return.
- {string} mediatypes
- Comma-delimited list of mediatypes (songtype) to return. Default is A,S
- Returns:
- {array} List of media items as array.