+
+ Extends
+ minplayer.display.
+
+
+ This class provides the scroll functionality for the playlists.
+
+We can calculate how the scrollbar controls the playlist using the
+following diagram / equations.
+ ___ ____________
+ | | |\
+ | | list | \
+ | | |y \
+ | | | \
+ | |____________| \ _ _____
+ | | |\ | | |
+ | | | \ | | |
+ | | | \ | |x |
+ | | | \ | | |
+ | | | \|_|_ |
+ | | | | | | |
+ l | window | | | h w
+ | | | |_|_| |
+ | | | /| | |
+ | | | / | | |
+ | | | / v| | |
+ | | | / | | |
+ | |____________|/ |_|____|
+ | | | /
+ | | | /
+ | | | /
+ | | | /
+ |__|____________|/
+
+ l - The list height.
+ h - Handle Bar height.
+ w - Window height.
+ x - The distance from top of window to the top of the handle.
+ y - The disatnce from the top of the list to the top of the window.
+ v - The distance from bottom of window to the bottom of the handle.
+
+ jQuery UI provides "v". We already know "l", "h", "w". We can then
+ calculate the relationship between the scroll bar handle position to the
+ list position using the following equations.
+
+ x = (w - (v + h))
+ y = ((l - w)/(w - h)) * x
+
+ -- or --
+
+ y = ((l - w)/(w - h)) * (w - (v + h))
+
+ We can statically calculate the ((l - w)/(w - h)) as a ratio and use
+ that to speed up calculations as follows.
+
+ ratio = ((l - w)/(w - h));
+
+ So, our translation equations are as follows...
+
+ y = ratio * (w - (v + h))
+ v = w - (h + (y / ratio))
+
+
+ Defined in: osmplayer.scroll.js.
+
+
1// Add a way to instanciate using jQuery prototype.
+ 2if(!jQuery.fn.osmplayer){
+ 3
+ 4/**
+ 5 * @constructor
+ 6 *
+ 7 * Define a jQuery osmplayer prototype.
+ 8 *
+ 9 * @param {object} options The options for this jQuery prototype.
+ 10 * @return {Array} jQuery object.
+ 11 */
+ 12jQuery.fn.osmplayer=function(options){
+ 13returnjQuery(this).each(function(){
+ 14options=options||{};
+ 15options.id=options.id||$(this).attr('id')||Math.random();
+ 16if(!minplayer.plugins[options.id]){
+ 17options.template=options.template||'default';
+ 18if(osmplayer[options.template]){
+ 19newosmplayer[options.template](jQuery(this),options);
+ 20}
+ 21else{
+ 22newosmplayer(jQuery(this),options);
+ 23}
+ 24}
+ 25});
+ 26};
+ 27}
+ 28
+ 29/**
+ 30 * @constructor
+ 31 * @extends minplayer
+ 32 * @class The main osmplayer class.
+ 33 *
+ 34 * <p><strong>Usage:</strong>
+ 35 * <pre><code>
+ 36 *
+ 37 * // Create a media player.
+ 38 * var player = jQuery("#player").osmplayer({
+ 39 *
+ 40 * });
+ 41 *
+ 42 * </code></pre>
+ 43 * </p>
+ 44 *
+ 45 * @param {object} context The jQuery context.
+ 46 * @param {object} options This components options.
+ 47 */
+ 48osmplayer=function(context,options){
+ 49
+ 50// Derive from minplayer
+ 51minplayer.call(this,context,options);
+ 52};
+ 53
+ 54/** Derive from minplayer. */
+ 55osmplayer.prototype=newminplayer();
+ 56
+ 57/** Reset the constructor. */
+ 58osmplayer.prototype.constructor=osmplayer;
+ 59
+ 60/**
+ 61 * Creates a new plugin within this context.
+ 62 *
+ 63 * @param {string} name The name of the plugin you wish to create.
+ 64 * @param {object} base The base object for this plugin.
+ 65 * @param {object} context The context which you would like to create.
+ 66 * @return {object} The new plugin object.
+ 67 */
+ 68osmplayer.prototype.create=function(name,base,context){
+ 69returnminplayer.prototype.create.call(this,name,'osmplayer',context);
+ 70};
+ 71
+ 72/**
+ 73 * @see minplayer.plugin.construct
+ 74 */
+ 75osmplayer.prototype.construct=function(){
+ 76
+ 77// Make sure we provide default options...
+ 78this.options=jQuery.extend({
+ 79playlist:'',
+ 80swfplayer:'minplayer/flash/minplayer.swf'
+ 81},this.options);
+ 82
+ 83// Call the minplayer display constructor.
+ 84minplayer.prototype.construct.call(this);
+ 85
+ 86/** The play queue and index. */
+ 87this.playQueue=[];
+ 88this.playIndex=0;
+ 89
+ 90/** The playlist for this media player. */
+ 91this.playlist=this.create('playlist','osmplayer');
+ 92
+ 93// Bind when the playlists loads a node.
+ 94this.playlist.bind('nodeLoad',(function(player){
+ 95returnfunction(event,data){
+ 96
+ 97// Load this node.
+ 98player.loadNode(data);
+ 99};
+100})(this));
+101};
+102
+103/**
+104 * Gets the full screen element.
+105 *
+106 * @return {object} The element that will go into fullscreen.
+107 */
+108osmplayer.prototype.fullScreenElement=function(){
+109returnthis.elements.minplayer;
+110};
+111
+112/**
+113 * The load node function.
+114 *
+115 * @param {object} node A media node object.
+116 */
+117osmplayer.prototype.loadNode=function(node){
+118if(node.mediafiles){
+119
+120// Load the media files.
+121varmedia=node.mediafiles.media;
+122if(media){
+123this.playQueue.length=0;
+124this.playQueue=[];
+125this.playIndex=0;
+126this.addToQueue(media.intro);
+127this.addToQueue(media.commercial);
+128this.addToQueue(media.prereel);
+129this.addToQueue(media.media);
+130this.addToQueue(media.postreel);
+131}
+132
+133// Load the preview image.
+134this.options.preview=osmplayer.getImage(node.mediafiles.image,'preview');
+135this.playLoader.loadPreview();
+136
+137// Play the next media
+138this.playNext();
+139}
+140};
+141
+142/**
+143 * Adds a file to the play queue.
+144 *
+145 * @param {object} file The file to add to the queue.
+146 */
+147osmplayer.prototype.addToQueue=function(file){
+148if(file){
+149this.playQueue.push(this.getFile(file));
+150}
+151};
+152
+153/**
+154 * Returns a valid media file for this browser.
+155 *
+156 * @param {object} file The file object.
+157 * @return {object} The best media file.
+158 */
+159osmplayer.prototype.getFile=function(file){
+160if(file){
+161vartype=typeoffile;
+162if(((type==='object')||(type==='array'))&&file[0]){
+163file=this.getBestMedia(file);
+164}
+165}
+166returnfile;
+167};
+168
+169/**
+170 * Returns the media file with the lowest weight value provided an array of
+171 * media files.
+172 *
+173 * @param {object} files The media files to play.
+174 * @return {object} The best media file.
+175 */
+176osmplayer.prototype.getBestMedia=function(files){
+177varmFile=null;
+178vari=files.length;
+179while(i--){
+180vartempFile=newminplayer.file(files[i]);
+181if(!mFile||(tempFile.priority>mFile.priority)){
+182mFile=tempFile;
+183}
+184}
+185returnmFile;
+186};
+187
+188/**
+189 * Plays the next media file in the queue.
+190 */
+191osmplayer.prototype.playNext=function(){
+192if(this.playQueue.length>this.playIndex){
+193this.load(this.playQueue[this.playIndex]);
+194this.playIndex++;
+195}
+196elseif(this.options.repeat){
+197this.playIndex=0;
+198this.playNext();
+199}
+200else{
+201// If there is no playlist, and no repeat, we will
+202// just seek to the beginning and pause.
+203this.options.autostart=false;
+204this.playIndex=0;
+205this.playNext();
+206}
+207};
+208
+209/**
+210 * Returns an image provided image array.
+211 *
+212 * @param {object} images The images to search for.
+213 * @param {string} type The type of image to look for.
+214 * @return {object} The best image match.
+215 */
+216osmplayer.getImage=function(images,type){
+217varimage='';
+218
+219if(images){
+220
+221// If the image type exists, then just use that one.
+222if(images[type]){
+223image=images[type];
+224}
+225else{
+226
+227// Or, just pick the first one available.
+228for(typeinimages){
+229if(images.hasOwnProperty(type)){
+230image=images[type];
+231break;
+232}
+233}
+234}
+235}
+236
+237// Return the image path.
+238return(typeofimage==='string')?image:image.path;
+239};
+240
\ No newline at end of file
diff --git a/doc/symbols/src/src_osmplayer.pager.js.html b/doc/symbols/src/src_osmplayer.pager.js.html
new file mode 100644
index 00000000..835d5643
--- /dev/null
+++ b/doc/symbols/src/src_osmplayer.pager.js.html
@@ -0,0 +1,55 @@
+
\ No newline at end of file
diff --git a/doc/symbols/src/src_osmplayer.parser.asx.js.html b/doc/symbols/src/src_osmplayer.parser.asx.js.html
new file mode 100644
index 00000000..2d3f99e3
--- /dev/null
+++ b/doc/symbols/src/src_osmplayer.parser.asx.js.html
@@ -0,0 +1,52 @@
+
1/** The osmplayer namespace. */
+ 2varosmplayer=osmplayer||{};
+ 3
+ 4/** The parser object. */
+ 5osmplayer.parser=osmplayer.parser||{};
+ 6
+ 7/**
+ 8 * The asx parser object.
+ 9 *
+ 10 * @return {object} The asx parser.
+ 11 **/
+ 12osmplayer.parser.asx={
+ 13
+ 14// The priority for this parser.
+ 15priority:8,
+ 16
+ 17// Return if this is a valid youtube feed.
+ 18valid:function(feed){
+ 19feed=feed.replace(/(.*)\??(.*)/i,'$1');
+ 20returnfeed.match(/\.asx$/i)!==null;
+ 21},
+ 22
+ 23// Returns the type of request to make.
+ 24getType:function(feed){
+ 25return'xml';
+ 26},
+ 27
+ 28// Returns the feed provided the start and numItems.
+ 29getFeed:function(feed,start,numItems){
+ 30returnfeed;
+ 31},
+ 32
+ 33// Parse the feed.
+ 34parse:function(data){
+ 35varplaylist={
+ 36total_rows:0,
+ 37nodes:[]
+ 38};
+ 39jQuery('asx entry',data).each(function(index){
+ 40osmplayer.parser.rss.addRSSItem(playlist,$(this));
+ 41});
+ 42returnplaylist;
+ 43}
+ 44};
+ 45
\ No newline at end of file
diff --git a/doc/symbols/src/src_osmplayer.parser.default.js.html b/doc/symbols/src/src_osmplayer.parser.default.js.html
new file mode 100644
index 00000000..9bbc9567
--- /dev/null
+++ b/doc/symbols/src/src_osmplayer.parser.default.js.html
@@ -0,0 +1,47 @@
+
1/** The osmplayer namespace. */
+ 2varosmplayer=osmplayer||{};
+ 3
+ 4/** The parser object. */
+ 5osmplayer.parser=osmplayer.parser||{};
+ 6
+ 7/**
+ 8 * The default parser object.
+ 9 *
+ 10 * @return {object} The default parser.
+ 11 **/
+ 12osmplayer.parser['default']={
+ 13
+ 14// The priority for this parser.
+ 15priority:1,
+ 16
+ 17// This parser is always valid.
+ 18valid:function(feed){
+ 19returntrue;
+ 20},
+ 21
+ 22// Returns the type of request to make.
+ 23getType:function(feed){
+ 24return'json';
+ 25},
+ 26
+ 27// Returns the feed provided the start and numItems.
+ 28getFeed:function(feed,start,numItems){
+ 29feed=feed.replace(/(.*)\??(.*)/i,'$1');
+ 30feed+='?start-index='+start;
+ 31feed+='&max-results='+numItems;
+ 32returnfeed;
+ 33},
+ 34
+ 35// Parse the feed.
+ 36parse:function(data){
+ 37returndata;
+ 38}
+ 39};
+ 40
\ No newline at end of file
diff --git a/doc/symbols/src/src_osmplayer.parser.rss.js.html b/doc/symbols/src/src_osmplayer.parser.rss.js.html
new file mode 100644
index 00000000..49f03538
--- /dev/null
+++ b/doc/symbols/src/src_osmplayer.parser.rss.js.html
@@ -0,0 +1,73 @@
+
1/** The osmplayer namespace. */
+ 2varosmplayer=osmplayer||{};
+ 3
+ 4/** The parser object. */
+ 5osmplayer.parser=osmplayer.parser||{};
+ 6
+ 7/**
+ 8 * The rss parser object.
+ 9 *
+ 10 * @return {object} The rss parser.
+ 11 **/
+ 12osmplayer.parser.rss={
+ 13
+ 14// The priority for this parser.
+ 15priority:8,
+ 16
+ 17// Return if this is a valid youtube feed.
+ 18valid:function(feed){
+ 19feed=feed.replace(/(.*)\??(.*)/i,'$1');
+ 20returnfeed.match(/\.rss$/i)!==null;
+ 21},
+ 22
+ 23// Returns the type of request to make.
+ 24getType:function(feed){
+ 25return'xml';
+ 26},
+ 27
+ 28// Returns the feed provided the start and numItems.
+ 29getFeed:function(feed,start,numItems){
+ 30returnfeed;
+ 31},
+ 32
+ 33// Parse the feed.
+ 34parse:function(data){
+ 35varplaylist={
+ 36total_rows:0,
+ 37nodes:[]
+ 38};
+ 39jQuery('rss channel',data).find('item').each(function(index){
+ 40osmplayer.parser.rss.addRSSItem(playlist,$(this));
+ 41});
+ 42returnplaylist;
+ 43},
+ 44
+ 45// Parse an RSS item.
+ 46addRSSItem:function(playlist,item){
+ 47playlist.total_rows++;
+ 48playlist.nodes.push({
+ 49title:item.find('title').text(),
+ 50description:item.find('annotation').text(),
+ 51mediafiles:{
+ 52image:{
+ 53'image':{
+ 54path:item.find('image').text()
+ 55}
+ 56},
+ 57media:{
+ 58'media':{
+ 59path:item.find('location').text()
+ 60}
+ 61}
+ 62}
+ 63});
+ 64}
+ 65};
+ 66
\ No newline at end of file
diff --git a/doc/symbols/src/src_osmplayer.parser.xspf.js.html b/doc/symbols/src/src_osmplayer.parser.xspf.js.html
new file mode 100644
index 00000000..3d191504
--- /dev/null
+++ b/doc/symbols/src/src_osmplayer.parser.xspf.js.html
@@ -0,0 +1,52 @@
+
1/** The osmplayer namespace. */
+ 2varosmplayer=osmplayer||{};
+ 3
+ 4/** The parser object. */
+ 5osmplayer.parser=osmplayer.parser||{};
+ 6
+ 7/**
+ 8 * The xsfp parser object.
+ 9 *
+ 10 * @return {object} The xsfp parser.
+ 11 **/
+ 12osmplayer.parser.xsfp={
+ 13
+ 14// The priority for this parser.
+ 15priority:8,
+ 16
+ 17// Return if this is a valid youtube feed.
+ 18valid:function(feed){
+ 19feed=feed.replace(/(.*)\??(.*)/i,'$1');
+ 20returnfeed.match(/\.xml$/i)!==null;
+ 21},
+ 22
+ 23// Returns the type of request to make.
+ 24getType:function(feed){
+ 25return'xml';
+ 26},
+ 27
+ 28// Returns the feed provided the start and numItems.
+ 29getFeed:function(feed,start,numItems){
+ 30returnfeed;
+ 31},
+ 32
+ 33// Parse the feed.
+ 34parse:function(data){
+ 35varplaylist={
+ 36total_rows:0,
+ 37nodes:[]
+ 38};
+ 39jQuery('playlist trackList track',data).each(function(index){
+ 40osmplayer.parser.rss.addRSSItem(playlist,$(this));
+ 41});
+ 42returnplaylist;
+ 43}
+ 44};
+ 45
\ No newline at end of file
diff --git a/doc/symbols/src/src_osmplayer.parser.youtube.js.html b/doc/symbols/src/src_osmplayer.parser.youtube.js.html
new file mode 100644
index 00000000..a8e984d2
--- /dev/null
+++ b/doc/symbols/src/src_osmplayer.parser.youtube.js.html
@@ -0,0 +1,79 @@
+
1/** The osmplayer namespace. */
+ 2varosmplayer=osmplayer||{};
+ 3
+ 4/** The parser object. */
+ 5osmplayer.parser=osmplayer.parser||{};
+ 6
+ 7/**
+ 8 * The youtube parser object.
+ 9 *
+ 10 * @return {object} The youtube parser.
+ 11 **/
+ 12osmplayer.parser.youtube={
+ 13
+ 14// The priority for this parser.
+ 15priority:10,
+ 16
+ 17// Return if this is a valid youtube feed.
+ 18valid:function(feed){
+ 19return(feed.search(/^http(s)?\:\/\/gdata\.youtube\.com/i)===0);
+ 20},
+ 21
+ 22// Returns the type of request to make.
+ 23getType:function(feed){
+ 24return'jsonp';
+ 25},
+ 26
+ 27// Returns the feed provided the start and numItems.
+ 28getFeed:function(feed,start,numItems){
+ 29feed=feed.replace(/(.*)\??(.*)/i,'$1');
+ 30feed+='?start-index='+(start+1);
+ 31feed+='&max-results='+(numItems);
+ 32feed+='&v=2&alt=jsonc';
+ 33returnfeed;
+ 34},
+ 35
+ 36// Parse the feed.
+ 37parse:function(data){
+ 38data=data.data;
+ 39varplaylist={
+ 40total_rows:data.totalItems,
+ 41nodes:[]
+ 42};
+ 43
+ 44// Iterate through the items and parse it.
+ 45for(varindexindata.items){
+ 46varitem=data.items[index];
+ 47playlist.nodes.push({
+ 48title:item.title,
+ 49description:item.description,
+ 50mediafiles:{
+ 51image:{
+ 52'thumbnail':{
+ 53path:item.thumbnail.sqDefault
+ 54},
+ 55'image':{
+ 56path:item.thumbnail.hqDefault
+ 57}
+ 58},
+ 59media:{
+ 60'media':{
+ 61player:'youtube',
+ 62id:item.id
+ 63}
+ 64}
+ 65}
+ 66});
+ 67}
+ 68
+ 69returnplaylist;
+ 70}
+ 71};
+ 72
\ No newline at end of file
diff --git a/doc/symbols/src/src_osmplayer.playlist.js.html b/doc/symbols/src/src_osmplayer.playlist.js.html
new file mode 100644
index 00000000..217027d3
--- /dev/null
+++ b/doc/symbols/src/src_osmplayer.playlist.js.html
@@ -0,0 +1,368 @@
+
1/** The osmplayer namespace. */
+ 2varosmplayer=osmplayer||{};
+ 3
+ 4/**
+ 5 * @constructor
+ 6 * @extends minplayer.display
+ 7 * @class This class creates the playlist functionality for the minplayer.
+ 8 *
+ 9 * @param {object} context The jQuery context.
+ 10 * @param {object} options This components options.
+ 11 */
+ 12osmplayer.playlist=function(context,options){
+ 13
+ 14// Derive from display
+ 15minplayer.display.call(this,'playlist',context,options);
+ 16};
+ 17
+ 18/** Derive from minplayer.display. */
+ 19osmplayer.playlist.prototype=newminplayer.display();
+ 20
+ 21/** Reset the constructor. */
+ 22osmplayer.playlist.prototype.constructor=osmplayer.playlist;
+ 23
+ 24/**
+ 25 * @see minplayer.plugin#construct
+ 26 */
+ 27osmplayer.playlist.prototype.construct=function(){
+ 28
+ 29// Make sure we provide default options...
+ 30this.options=jQuery.extend({
+ 31vertical:true,
+ 32playlist:'',
+ 33pageLimit:10,
+ 34shuffle:false
+ 35},this.options);
+ 36
+ 37// Call the minplayer plugin constructor.
+ 38minplayer.display.prototype.construct.call(this);
+ 39
+ 40/** The nodes within this playlist. */
+ 41this.nodes=[];
+ 42
+ 43// Current page.
+ 44this.page=-1;
+ 45
+ 46// The total amount of nodes.
+ 47this.totalItems=0;
+ 48
+ 49// The current loaded item index.
+ 50this.currentItem=0;
+ 51
+ 52// The play queue.
+ 53this.queue=[];
+ 54
+ 55// The queue position.
+ 56this.queuepos=0;
+ 57
+ 58// The current playlist.
+ 59this.playlist=this.options.playlist;
+ 60
+ 61// Create the scroll bar.
+ 62this.scroll=this.create('scroll','osmplayer');
+ 63
+ 64// Create the pager.
+ 65this.pager=this.create('pager','osmplayer');
+ 66this.pager.bind('nextPage',(function(playlist){
+ 67returnfunction(event){
+ 68playlist.nextPage();
+ 69};
+ 70})(this));
+ 71this.pager.bind('prevPage',(function(playlist){
+ 72returnfunction(event){
+ 73playlist.prevPage();
+ 74};
+ 75})(this));
+ 76
+ 77// Get the media.
+ 78this.get('media',function(media){
+ 79media.bind('ended',(function(playlist){
+ 80returnfunction(event){
+ 81playlist.next();
+ 82};
+ 83})(this));
+ 84});
+ 85
+ 86// Load the playlist.
+ 87this.load(0,0);
+ 88};
+ 89
+ 90/**
+ 91 * Sets the playlist.
+ 92 *
+ 93 * @param {object} playlist The playlist object.
+ 94 * @param {integer} loadIndex The index of the item to load.
+ 95 */
+ 96osmplayer.playlist.prototype.set=function(playlist,loadIndex){
+ 97
+ 98// Check to make sure the playlist is an object.
+ 99if(typeofplaylist!=='object'){
+100this.trigger('error','Playlist must be an object to set');
+101return;
+102}
+103
+104// Check to make sure the playlist has correct format.
+105if(!playlist.hasOwnProperty('total_rows')){
+106this.trigger('error','Unknown playlist format.');
+107return;
+108}
+109
+110// Make sure the playlist has some rows.
+111if(playlist.total_rows&&playlist.nodes.length){
+112
+113// Set the total rows.
+114this.totalItems=playlist.total_rows;
+115this.currentItem=0;
+116
+117// Show or hide the next page if there is or is not a next page.
+118if(((this.page+1)*this.options.pageLimit)>=this.totalItems){
+119this.pager.nextPage.hide();
+120}
+121else{
+122this.pager.nextPage.show();
+123}
+124
+125varteaser=null;
+126varnumNodes=playlist.nodes.length;
+127this.scroll.elements.list.empty();
+128this.nodes=[];
+129
+130// Iterate through all the nodes.
+131for(varindex=0;index<numNodes;index++){
+132
+133// Create the teaser object.
+134teaser=this.create('teaser','osmplayer',this.scroll.elements.list);
+135teaser.setNode(playlist.nodes[index]);
+136teaser.bind('nodeLoad',(function(playlist,index){
+137returnfunction(event,data){
+138playlist.loadItem(index);
+139};
+140})(this,index));
+141
+142// Add this to our nodes array.
+143this.nodes.push(teaser);
+144
+145// If the index is equal to the loadIndex.
+146if(loadIndex===index){
+147this.loadItem(index);
+148}
+149}
+150
+151// Refresh the sizes.
+152this.scroll.refresh();
+153
+154// Trigger that the playlist has loaded.
+155this.trigger('playlistLoad',playlist);
+156}
+157};
+158
+159/**
+160 * Stores the current playlist state in the queue.
+161 */
+162osmplayer.playlist.prototype.setQueue=function(){
+163
+164// Add this item to the queue.
+165this.queue.push({
+166page:this.page,
+167item:this.currentItem
+168});
+169
+170// Store the current queue position.
+171this.queuepos=this.queue.length;
+172};
+173
+174/**
+175 * Loads the next item.
+176 */
+177osmplayer.playlist.prototype.next=function(){
+178varitem=0,page=this.page;
+179
+180// See if we are at the front of the queue.
+181if(this.queuepos>=this.queue.length){
+182
+183// If this is shuffle, then load a random item.
+184if(this.options.shuffle){
+185item=Math.floor(Math.random()*this.totalItems);
+186page=Math.floor(item/this.options.pageLimit);
+187item=item%this.options.pageLimit;
+188this.load(page,item);
+189}
+190else{
+191
+192// Otherwise, increment the current item by one.
+193item=(this.currentItem+1);
+194if(item>=this.nodes.length){
+195this.load(page+1,0);
+196}
+197else{
+198this.loadItem(item);
+199}
+200}
+201}
+202else{
+203
+204// Load the next item in the queue.
+205this.queuepos=this.queuepos+1;
+206varcurrentQueue=this.queue[this.queuepos];
+207this.load(currentQueue.page,currentQueue.item);
+208}
+209};
+210
+211/**
+212 * Loads the previous item.
+213 */
+214osmplayer.playlist.prototype.prev=function(){
+215
+216// Move back into the queue.
+217this.queuepos=this.queuepos-1;
+218this.queuepos=(this.queuepos<0)?0:this.queuepos;
+219varcurrentQueue=this.queue[this.queuepos];
+220if(currentQueue){
+221this.load(currentQueue.page,currentQueue.item);
+222}
+223};
+224
+225/**
+226 * Loads a playlist node.
+227 *
+228 * @param {number} index The index of the item you would like to load.
+229 */
+230osmplayer.playlist.prototype.loadItem=function(index){
+231if(index<this.nodes.length){
+232this.setQueue();
+233
+234// Get the teaser at the current index and deselect it.
+235varteaser=this.nodes[this.currentItem];
+236teaser.select(false);
+237this.currentItem=index;
+238
+239// Get the new teaser and select it.
+240teaser=this.nodes[index];
+241teaser.select(true);
+242this.trigger('nodeLoad',teaser.node);
+243}
+244};
+245
+246/**
+247 * Loads the next page.
+248 *
+249 * @param {integer} loadIndex The index of the item to load.
+250 */
+251osmplayer.playlist.prototype.nextPage=function(loadIndex){
+252this.load(this.page+1,loadIndex);
+253};
+254
+255/**
+256 * Loads the previous page.
+257 *
+258 * @param {integer} loadIndex The index of the item to load.
+259 */
+260osmplayer.playlist.prototype.prevPage=function(loadIndex){
+261this.load(this.page-1,loadIndex);
+262};
+263
+264/**
+265 * Loads a playlist.
+266 *
+267 * @param {integer} page The page to load.
+268 * @param {integer} loadIndex The index of the item to load.
+269 */
+270osmplayer.playlist.prototype.load=function(page,loadIndex){
+271
+272// If the playlist and pages are the same, then no need to load.
+273if((this.playlist==this.options.playlist)&&(page==this.page)){
+274this.loadItem(loadIndex);
+275}
+276
+277// Set the new playlist.
+278this.playlist=this.options.playlist;
+279
+280// If the playlist is an object, then go ahead and set it.
+281if(typeofthis.playlist=='object'){
+282this.set(this.playlist);
+283this.playlist=this.playlist.endpoint;
+284return;
+285}
+286
+287// Say that we are busy.
+288if(this.scroll.elements.playlist_busy){
+289this.scroll.elements.playlist_busy.show();
+290}
+291
+292// Normalize the page.
+293page=page||0;
+294page=(page<0)?0:page;
+295
+296// Set the queue.
+297this.setQueue();
+298
+299// Set the new page.
+300this.page=page;
+301
+302// Hide or show the page based on if we are on the first page.
+303if(this.page==0){
+304this.pager.prevPage.hide();
+305}
+306else{
+307this.pager.prevPage.show();
+308}
+309
+310// Get the highest priority parser.
+311varparser=osmplayer.parser['default'];
+312for(varnameinosmplayer.parser){
+313if(osmplayer.parser[name].valid(this.playlist)){
+314if(osmplayer.parser[name].priority>parser.priority){
+315parser=osmplayer.parser[name];
+316}
+317}
+318}
+319
+320// The start index.
+321varstart=this.page*this.options.pageLimit;
+322
+323// Get the feed from the parser.
+324varfeed=parser.getFeed(
+325this.playlist,
+326start,
+327this.options.pageLimit
+328);
+329
+330// Build our request.
+331varrequest={
+332type:'GET',
+333url:feed,
+334success:(function(playlist){
+335returnfunction(data){
+336if(playlist.scroll.elements.playlist_busy){
+337playlist.scroll.elements.playlist_busy.hide();
+338}
+339playlist.set(parser.parse(data),loadIndex);
+340};
+341})(this),
+342error:(function(playlist){
+343returnfunction(XMLHttpRequest,textStatus,errorThrown){
+344if(playlist.scroll.elements.playlist_busy){
+345playlist.scroll.elements.playlist_busy.hide();
+346}
+347playlist.trigger('error',textStatus);
+348}
+349})(this)
+350};
+351
+352// Set the data if applicable.
+353vardataType='';
+354if(dataType=parser.getType()){
+355request.dataType=dataType;
+356}
+357
+358// Perform an ajax callback.
+359jQuery.ajax(request);
+360};
+361
\ No newline at end of file
diff --git a/doc/symbols/src/src_osmplayer.scroll.js.html b/doc/symbols/src/src_osmplayer.scroll.js.html
new file mode 100644
index 00000000..381f6140
--- /dev/null
+++ b/doc/symbols/src/src_osmplayer.scroll.js.html
@@ -0,0 +1,232 @@
+
1/** The osmplayer namespace. */
+ 2varosmplayer=osmplayer||{};
+ 3
+ 4/**
+ 5 * @constructor
+ 6 * @extends minplayer.display
+ 7 * @class This class provides the scroll functionality for the playlists.
+ 8 *
+ 9 * We can calculate how the scrollbar controls the playlist using the
+ 10 * following diagram / equations.
+ 11 * ___ ____________
+ 12 * | | |\
+ 13 * | | list | \
+ 14 * | | |y \
+ 15 * | | | \
+ 16 * | |____________| \ _ _____
+ 17 * | | |\ | | |
+ 18 * | | | \ | | |
+ 19 * | | | \ | |x |
+ 20 * | | | \ | | |
+ 21 * | | | \|_|_ |
+ 22 * | | | | | | |
+ 23 * l | window | | | h w
+ 24 * | | | |_|_| |
+ 25 * | | | /| | |
+ 26 * | | | / | | |
+ 27 * | | | / v| | |
+ 28 * | | | / | | |
+ 29 * | |____________|/ |_|____|
+ 30 * | | | /
+ 31 * | | | /
+ 32 * | | | /
+ 33 * | | | /
+ 34 * |__|____________|/
+ 35 *
+ 36 * l - The list height.
+ 37 * h - Handle Bar height.
+ 38 * w - Window height.
+ 39 * x - The distance from top of window to the top of the handle.
+ 40 * y - The disatnce from the top of the list to the top of the window.
+ 41 * v - The distance from bottom of window to the bottom of the handle.
+ 42 *
+ 43 * jQuery UI provides "v". We already know "l", "h", "w". We can then
+ 44 * calculate the relationship between the scroll bar handle position to the
+ 45 * list position using the following equations.
+ 46 *
+ 47 * x = (w - (v + h))
+ 48 * y = ((l - w)/(w - h)) * x
+ 49 *
+ 50 * -- or --
+ 51 *
+ 52 * y = ((l - w)/(w - h)) * (w - (v + h))
+ 53 *
+ 54 * We can statically calculate the ((l - w)/(w - h)) as a ratio and use
+ 55 * that to speed up calculations as follows.
+ 56 *
+ 57 * ratio = ((l - w)/(w - h));
+ 58 *
+ 59 * So, our translation equations are as follows...
+ 60 *
+ 61 * y = ratio * (w - (v + h))
+ 62 * v = w - (h + (y / ratio))
+ 63 *
+ 64 * @param {object} context The jQuery context.
+ 65 * @param {object} options This components options.
+ 66 */
+ 67osmplayer.scroll=function(context,options){
+ 68
+ 69// Derive from display
+ 70minplayer.display.call(this,'scroll',context,options);
+ 71};
+ 72
+ 73/** Derive from minplayer.display. */
+ 74osmplayer.scroll.prototype=newminplayer.display();
+ 75
+ 76/** Reset the constructor. */
+ 77osmplayer.scroll.prototype.constructor=osmplayer.scroll;
+ 78
+ 79/**
+ 80 * @see minplayer.plugin#construct
+ 81 */
+ 82osmplayer.scroll.prototype.construct=function(){
+ 83
+ 84// Make sure we provide default options...
+ 85this.options=jQuery.extend({
+ 86vertical:true,
+ 87hysteresis:40,
+ 88scrollSpeed:20,
+ 89scrollMode:'auto'
+ 90},this.options);
+ 91
+ 92// Call the minplayer plugin constructor.
+ 93minplayer.display.prototype.construct.call(this);
+ 94
+ 95this.getMousePos=function(event){
+ 96return(event.pageY-this.display.offset().top);
+ 97};
+ 98this.getPos=function(handlePos){
+ 99returnthis.ratio*(this.scrollSize-(handlePos+this.handleSize));
+100};
+101this.getHandlePos=function(pos){
+102returnthis.scrollSize-(this.handleSize+(pos/this.ratio));
+103};
+104
+105// If they have a scroll bar.
+106if(this.elements.scroll){
+107
+108// Get the values of our variables.
+109this.scrollSize=this.elements.scroll.height();
+110this.handleSize=17;
+111this.scrollTop=(this.scrollSize-this.handleSize);
+112this.scrollMid=this.scrollSize/2;
+113this.mousePos=0;
+114
+115// Refresh the scroll.
+116this.refresh();
+117
+118// Create the scroll bar slider control.
+119this.scroll=this.elements.scroll.slider({
+120orientation:'vertical',
+121max:this.scrollSize,
+122value:this.scrollTop,
+123slide:(function(scroll){
+124returnfunction(event,ui){
+125
+126// Get the new position.
+127varpos=scroll.getPos(ui.value);
+128
+129// Ensure it doesn't go over the limits.
+130if(pos<0){
+131pos=0;
+132scroll.scroll.slider('option','value',scroll.scrollTop);
+133}
+134
+135// Set our list position.
+136scroll.elements.list.css('marginTop',-pos+'px');
+137
+138// Return false to stop the scrolling.
+139return(pos>0);
+140};
+141})(this)
+142});
+143
+144// If they wish to have auto scroll mode.
+145if(this.options.scrollMode=='auto'){
+146
+147// Bind to the mouse events.
+148this.elements.list.bind('mousemove',(function(scroll){
+149
+150// Return our event function.
+151returnfunction(event){
+152event.preventDefault();
+153scroll.mousePos=(event.pageY-scroll.display.offset().top);
+154};
+155
+156})(this)).bind('mouseenter',(function(scroll){
+157
+158// Return our event function.
+159returnfunction(event){
+160event.preventDefault();
+161scroll.scrolling=true;
+162setTimeout(functionsetScroll(){
+163if(scroll.scrolling){
+164
+165// Get the delta.
+166vardelta=scroll.mousePos-scroll.scrollMid;
+167
+168// Determine if we are within our hysteresis.
+169if(Math.abs(delta)>scroll.options.hysteresis){
+170
+171// Get the hysteresis and delta.
+172varhyst=scroll.options.hysteresis;
+173hyst*=(delta>0)?-1:0;
+174delta=(scroll.options.scrollSpeed*(delta+hyst));
+175delta/=scroll.scrollMid;
+176
+177// Get the scroll position.
+178varpos=scroll.elements.list.css('marginTop');
+179pos=parseFloat(pos)-delta;
+180pos=(pos>0)?0:pos;
+181
+182// Get the maximum top position.
+183vartop=-scroll.listSize+scroll.scrollSize;
+184pos=(pos<top)?top:pos;
+185
+186// Set the new scroll position.
+187scroll.elements.list.css('marginTop',pos+'px');
+188
+189// Set the scroll position.
+190pos=scroll.getHandlePos(-pos);
+191scroll.scroll.slider('option','value',pos);
+192}
+193
+194// Set timeout to try again.
+195setTimeout(setScroll,20);
+196}
+197},20);
+198};
+199
+200})(this)).bind('mouseleave',(function(scroll){
+201
+202// Return our event function.
+203returnfunction(event){
+204event.preventDefault();
+205scroll.scrolling=false;
+206};
+207
+208})(this));
+209}
+210}
+211};
+212
+213/**
+214 * Refresh all the variables that may change.
+215 */
+216osmplayer.scroll.prototype.refresh=function(){
+217this.listSize=this.elements.list.height();
+218this.ratio=(this.listSize-this.scrollSize);
+219this.ratio/=(this.scrollSize-this.handleSize);
+220if(this.scroll){
+221this.elements.list.css('marginTop','0px');
+222this.scroll.slider('option','value',this.getHandlePos(0));
+223}
+224};
+225
\ No newline at end of file
diff --git a/doc/symbols/src/src_osmplayer.teaser.js.html b/doc/symbols/src/src_osmplayer.teaser.js.html
new file mode 100644
index 00000000..e7fca7b5
--- /dev/null
+++ b/doc/symbols/src/src_osmplayer.teaser.js.html
@@ -0,0 +1,74 @@
+
1/** The osmplayer namespace. */
+ 2varosmplayer=osmplayer||{};
+ 3
+ 4/**
+ 5 * @constructor
+ 6 * @extends minplayer.display
+ 7 * @class This class provides teaser functionality.
+ 8 *
+ 9 * @param {object} context The jQuery context.
+ 10 * @param {object} options This components options.
+ 11 */
+ 12osmplayer.teaser=function(context,options){
+ 13
+ 14/** The preview image. */
+ 15this.preview=null;
+ 16
+ 17// Derive from display
+ 18minplayer.display.call(this,'teaser',context,options);
+ 19};
+ 20
+ 21/** Derive from minplayer.display. */
+ 22osmplayer.teaser.prototype=newminplayer.display();
+ 23
+ 24/** Reset the constructor. */
+ 25osmplayer.teaser.prototype.constructor=osmplayer.teaser;
+ 26
+ 27/**
+ 28 * Selects the teaser.
+ 29 *
+ 30 * @param {boolean} selected TRUE if selected, FALSE otherwise.
+ 31 */
+ 32osmplayer.teaser.prototype.select=function(selected){
+ 33};
+ 34
+ 35/**
+ 36 * Sets the node.
+ 37 *
+ 38 * @param {object} node The node object to set.
+ 39 */
+ 40osmplayer.teaser.prototype.setNode=function(node){
+ 41
+ 42// Add this to the node info for this teaser.
+ 43this.node=node;
+ 44
+ 45// Set the title of the teaser.
+ 46if(this.elements.title){
+ 47this.elements.title.text(node.title);
+ 48}
+ 49
+ 50// Load the thumbnail image if it exists.
+ 51varimage=osmplayer.getImage(node.mediafiles.image,'thumbnail');
+ 52if(image){
+ 53if(this.elements.image){
+ 54this.preview=newminplayer.image(this.elements.image);
+ 55this.preview.load(image);
+ 56}
+ 57}
+ 58
+ 59// Bind when they click on this teaser.
+ 60this.display.unbind('click').click((function(teaser){
+ 61returnfunction(event){
+ 62event.preventDefault();
+ 63teaser.trigger('nodeLoad',teaser.node);
+ 64};
+ 65})(this));
+ 66};
+ 67
\ No newline at end of file
diff --git a/getplaylist.php b/getplaylist.php
deleted file mode 100755
index d3719929..00000000
--- a/getplaylist.php
+++ /dev/null
@@ -1,12 +0,0 @@
-getPlaylist();
-?>
\ No newline at end of file
diff --git a/index.html b/index.html
index 825b5763..a937216e 100644
--- a/index.html
+++ b/index.html
@@ -1,184 +1,59 @@
-
+
Open Standard Media (OSM) Player: PHP Demo
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
Below are some examples of the minPlayer in action. It is creating a common API to interact with all different types of players, including Vimeo and YouTube.