3 * Copyright (c) 2013, Intel Corporation.
5 * This program is licensed under the terms and conditions of the
6 * Apache License, version 2.0. The full text of the Apache License is at
7 * http://www.apache.org/licenses/LICENSE-2.0
11 ImagePlayer = function()
16 ImagePlayer.prototype.play = function()
18 console.log("MediaPlayer in ImagePlayer::play");
19 if (this.playerControls.paused)
20 this.playerControls.play();
23 ImagePlayer.prototype.pause = function()
25 if (!this.playerControls.paused)
26 this.playerControls.pause();
29 ImagePlayer.prototype.playing = function()
31 return !(this.playerControls.paused);
34 ImagePlayer.prototype.next = function()
38 if (this.content.length > (this.listIndex + 1))
43 this.load(this.listIndex);
47 ImagePlayer.prototype.previous = function()
51 if (this.listIndex > 0 )
54 this.listIndex = this.content.length - 1;
56 this.load(this.listIndex);
60 ImagePlayer.prototype.onContentLoaded = function()
66 if (localStorage.prevImage && localStorage.prevImage !== "undefined")
68 for (var i = 0; i < this.content.length; i++)
70 if (this.content[i].contentURI === localStorage.prevImage)
72 console.log("MediaPlayer: using previous image " + localStorage.prevImage);
81 console.log("MediaPlayer: using first image " + this.content[this.listIndex].contentURI);
82 this.load(this.listIndex);
88 console.log("MediaPlayer: Error when parsing imageContent");
92 ImagePlayer.prototype.load = function(index)
94 this.listIndex = index;
96 if (!this.content[this.listIndex].remoteFile)
98 localStorage.prevImage = this.content[this.listIndex].contentURI;
102 localStorage.prevImage = undefined;
105 $("#imagePlayer").css("background", "url(" + this.content[this.listIndex].contentURI + ") no-repeat center");
106 $("#imagePlayer").css("background-size", "contain");
109 ImagePlayer.prototype.makeListItem = function(j, k)
111 var canvasH = mediaListItemH * 0.95 ;
113 for (var i = j; (i < (j+k) && i < this.content.length); i++)
115 var artistText = {"text" : this.content[i].title, "xLoc" : canvasH + 20, "yLoc" : canvasH / 2.5 , "zLoc" : 0};
116 var trackText = {"text" : " ", "xLoc" : canvasH + 20, "yLoc" : canvasH / 1.1 , "zLoc" : 0};
118 this.makeListBar(imgIcon, i, artistText, trackText);
120 // Set callback function for the new list item
121 $("#" + this.type + "CanvasNum" + i).click(function () {
125 imagePlayer.load($(this).parent().parent().index());
126 $("#imageMediaList").hide();
130 console.log("MediaPlayer: load image error: " + err.message);