if (item.Type.indexOf("video") == 0)
{
content.type = "VIDEO";
+ content.artists = new Array();
+ content.artists[0] = "Unknown";
content.duration = item.Duration;
content.width = item.Width;
content.height = item.Height;
item.Type.indexOf("music") == 0)
{
content.type = "AUDIO";
+ content.album = item.Album ? item.Album : "Unknown";
+ content.coverArt = musicIcon;
+ content.artists = new Array();
+ content.artists[0] = item.Artist ? item.Artist : "Unknown";
content.bitrate = item.SampleRate;
content.duration = item.Duration;
}
content.height = item.Height;
content.orientation = "NORMAL";
}
-
}
- console.log(">>> Tizen Content >>> " + JSON.stringify(content));
return content;
}
-/* example below displays the first picture found on the first media player available */
-/************************************** DLNA sample code ****************************************/
-
function browseCallback(medias)
{
- console.log("MediaServer browseCallback");
+ console.log("MediaPlayer: MediaServer has called browseCallback");
console.log("found " + medias.length + " medias.");
for (var i=0; i<medias.length; i++)
{
console.log("MediaServer findAllCallback");
console.log("found " + medias.length + " medias.");
- var content = [];
+
+ var itemsAdded = 0;
for (var i=0; i < medias.length; i++)
{
var current = convertMediaServerContent(medias[i]);
- if (current.type == "IMAGE")
- content.push(current);
- else
- console.log("BJONES failed to push content, not == IMAGE");
+ if (current)
+ {
+ switch(current.type)
+ {
+ case "AUDIO":
+ console.log("MediaPlayer: Remote server found audio " + current);
+ audioContent.push(current);
+ console.log("MediaPlayer: Remote added audiocontent now = " + audioContent);
+ itemsAdded += 1;
+ break;
+ case "VIDEO":
+ console.log("MediaPlayer: Remote server found video " + current);
+ videoContent.push(current);
+ console.log("MediaPlayer: Remote added videocontent now = " + videoContent);
+ itemsAdded += 1;
+ break;
+ case "IMAGE":
+ console.log("MediaPlayer: Remote server found image " + current);
+ imageContent.push(current);
+ console.log("MediaPlayer: Remote added imagecontent now = " + imageContent);
+ itemsAdded += 1;
+ break;
+ default:
+ console.log("MediaPlayer: Remote media failed to push content, not == AUDIO/VIDEO/IMAGE");
+ }
+ }
}
- imageContent = content;
- console.log("MediaPlayer image content changed, added " + content.length + " new items");
+ fillMediaList(audioContent);
}
function foundMediaServer(srv)
{
- console.log("New MediaServer Found");
+ console.log("MediaPlayer: New MediaServer Found");
console.log("MediaServer id: " + srv.id);
console.log("MediaServer friendlyName: " + srv.friendlyName);
if (srv.root)
{
- console.log("MediaServer root folder: " + srv.root.id);
+ console.log("MediaPlayer: MediaServer root folder: " + srv.root.id);
srv.browse(srv.root.id, "+DisplayName", 0, 0, browseCallback);
srv.find(srv.root.id, "*", "+DisplayName", 0, 0, findAllCallback);
}
var iconWidth;
var padding;
var contentType = "AUDIO";
-var audioContent;
-var videoContent;
-var imageContent;
+var audioContent = new Array();
+var videoContent = new Array();
+var imageContent = new Array();
var currentContent;
var currentPlayer;
var currentPlayerType = "AUDIO";
{
case "AUDIO":
currentCTX.drawImage(audioContent[i].coverArt, 0, 0, canvasH, canvasH );
+ console.log("contentList[i] = " + contentList[i]);
+ console.log("title = " + contentList[i].title);
+ console.log("artist = " + contentList[i].artists[0]);
var trackText = new TextObject(currentCTX,{"text" : contentList[i].title, "xLoc" : canvasH + 20, "yLoc" : canvasH / 2.5 , "zLoc" : 0});
var artistText = new TextObject(currentCTX,{"text" : contentList[i].artists[0], "xLoc" : canvasH + 20, "yLoc" : canvasH / 1.1 , "zLoc" : 0});
break;
case "VIDEO":
+ console.log("contentList[i] = " + contentList[i]);
+ console.log("title = " + contentList[i].title);
+ console.log("artist = " + contentList[i].artists[0]);
currentCTX.drawImage(vidIcon, 0, 0, canvasH, canvasH );
var artistText = new TextObject(currentCTX,{"text" : contentList[i].artists[0], "xLoc" : canvasH + 20, "yLoc" : canvasH / 2.5 , "zLoc" : 0});
var trackText = new TextObject(currentCTX,{"text" : contentList[i].title, "xLoc" : canvasH + 20, "yLoc" : canvasH / 1.1 , "zLoc" : 0});
{
try
{
- audioContent = content;
+ audioContent = audioContent.concat(content);
+ console.log("MediaPlayer: AudioContent added local, now has = " + audioContent);
sortByAlpha(audioContent);
$("#audioSrc").attr("src", audioContent[0].contentURI);
case "VIDEO":
if (!emptyContent)
{
- videoContent = content;
+ videoContent = videoContent.concat(content);
+ console.log("MediaPlayer: VideoContent added local, now has = " + videoContent);
$("#videoSrc").attr("src", videoContent[0].contentURI);
}
contentType = "IMAGE";
case "IMAGE":
if (!emptyContent)
{
- imageContent = content;
+ imageContent = imageContent.concat(content);
+ console.log("MediaPlayer: ImageContent added local, now has = " + imageContent);
$("#imagePlayer").css("background", "url(" + imageContent[0].contentURI + ") no-repeat center");
$("#imagePlayer").css("background-size", "contain");
}
$("#mediaList").fadeOut(300);
else
{
- fillMediaList(currentContent);
$("#mediaList").fadeIn(300);
}
}
currentPlayerControls = document.getElementById("audioPlayer");
currentPlayerType = "AUDIO";
currentContent = audioContent;
+ fillMediaList(currentContent);
showMediaMenu();
break;
currentPlayerControls = document.getElementById("videoPlayer");
currentPlayerType = "VIDEO";
currentContent = videoContent;
+ fillMediaList(currentContent);
showMediaMenu();
break;
currentPlayerControls = imageControls;
currentPlayerType = "IMAGE";
currentContent = imageContent;
+ fillMediaList(currentContent);
showMediaMenu();
break;
default:
+* Fri Sep 13 2013 brianjjones <brian.j.jones@intel.com> submit/tizen/20130913.011212@023d5e5
+- Adding DLNA browsing support. MediaPlayer will now show files found on remote servers
+
* Thu Sep 12 2013 brianjjones <brian.j.jones@intel.com> submit/tizen/20130909.164827@ee8af51
- Adding a listener for DriverMode. If it receives a value > 0 it will pause playing video.