* http://www.apache.org/licenses/LICENSE-2.0
*
*/
+var stopConnectionSearch = undefined;
+var remoteMediaPreviouslyLoaded = false;
function convertMediaServerContent(item)
{
content.storageType = "EXTERNAL";
}
- else {
+ else
+ {
content.editableAttributes = [];
content.name = content.title;
content.contentURI = item.URLs[0];
content.mimeType = item.MIMEType;
content.size = item.Size;
content.rating = 0;
+ content.remoteFile = true;
+
if (item.Type.indexOf("video") == 0)
{
content.type = "VIDEO";
console.log("MediaServer findAllCallback");
console.log("found " + medias.length + " medias.");
+ clearInterval(stopConnectionSearch);
+ stopConnectionSearch = undefined;
+
var itemsAdded = 0;
for (var i=0; i < medias.length; i++)
imageMediaListLoaded = false;
}
+function restartMedia (medias)
+{
+ clearInterval(stopConnectionSearch);
+ loadPrevVideo = true;
+ $("#videoSrc").attr("src", videoContent[videoIndex].contentURI);
+}
+
function foundMediaServer(srv)
{
console.log("MediaPlayer: New MediaServer Found");
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);
+
+ if (stopConnectionSearch !== undefined)
+ clearInterval(stopConnectionSearch);
+
+ stopConnectionSearch = setInterval(function(){console.log("MediaPlayer searching for remote media..."); tizen.mediaserver.scanNetwork(foundMediaServer);}, 3000);
}
else
console.log("MediaServer not browsable");
}
+
+function reconnectServer(srv)
+{
+ if (srv.root)
+ {
+ srv.find(srv.root.id, "*", "+DisplayName", 0, 0, restartMedia);
+ stopConnectionSearch = setInterval(function(){console.log("MediaPlayer searching for remote media for reconnect..."); tizen.mediaserver.scanNetwork(reconnectServer);}, 1000);
+ }
+ else
+ console.log("MediaServer not reloadable");
+}