summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsmarttv-client/CSS/Main.css3
-rw-r--r--smarttv-client/Javascript/Buttons.js1
-rwxr-xr-xsmarttv-client/Javascript/Config.js64
-rwxr-xr-xsmarttv-client/Javascript/Data.js2
-rwxr-xr-xsmarttv-client/Javascript/Display.js173
-rw-r--r--smarttv-client/Javascript/Epg.js34
-rwxr-xr-xsmarttv-client/Javascript/Main.js872
-rw-r--r--smarttv-client/Javascript/Notify.js1
-rwxr-xr-xsmarttv-client/Javascript/Player.js143
-rwxr-xr-xsmarttv-client/Javascript/Server.js163
-rwxr-xr-xsmarttv-client/config.xml2
11 files changed, 764 insertions, 694 deletions
diff --git a/smarttv-client/CSS/Main.css b/smarttv-client/CSS/Main.css
index 5b8f829..b733c20 100755
--- a/smarttv-client/CSS/Main.css
+++ b/smarttv-client/CSS/Main.css
@@ -130,6 +130,9 @@ body {
padding-right:20px;
background-color: rgba(0,0,0,0.5);
z-index:20;
+ overflow:hidden;
+ text-overflow: ellipsis;
+ white-space : nowrap;
}
diff --git a/smarttv-client/Javascript/Buttons.js b/smarttv-client/Javascript/Buttons.js
index 5c5b3ca..c069670 100644
--- a/smarttv-client/Javascript/Buttons.js
+++ b/smarttv-client/Javascript/Buttons.js
@@ -338,6 +338,7 @@ ButtonHandler.prototype.onInput = function () {
break;
case tvKey.KEY_RETURN:
+ case tvKey.KEY_EXIT:
Buttons.hide();
if (this.returnCallback != null)
this.returnCallback();
diff --git a/smarttv-client/Javascript/Config.js b/smarttv-client/Javascript/Config.js
index a950641..b60d01d 100755
--- a/smarttv-client/Javascript/Config.js
+++ b/smarttv-client/Javascript/Config.js
@@ -14,7 +14,10 @@ var Config = {
skipDuration : 30, // sec
liveChannels : 30,
firstLaunch : false,
-
+ debug : false,
+ usePdlForRecordings : true,
+ uploadJsFile : "",
+
deviceType : 0 // Used to differentiate between browsers and platforms
// 0: Samsung
@@ -90,6 +93,7 @@ Config.doFirstLaunch = function () {
Main.changeState(4);
};
+/*
Config.fetchConfig = function () {
if (this.XHRObj == null) {
this.XHRObj = new XMLHttpRequest();
@@ -107,7 +111,56 @@ Config.fetchConfig = function () {
this.XHRObj.send(null);
}
};
-
+*/
+Config.fetchConfig = function () {
+ $.ajax({
+ url: this.serverUrl + "/widget.conf",
+ type : "GET",
+ success : function(data, status, XHR ) {
+ Main.log ("Parsing config XML now");
+ Main.logToServer("Parsing config XML now");
+ Config.format = $(data).find('format').text();
+
+ Config.tgtBufferBitrate = parseFloat($(data).find('tgtBufferBitrate').text());
+ Config.totalBufferDuration = parseFloat($(data).find('totalBufferDuration').text());
+ Config.initialBuffer = parseFloat($(data).find('initialBuffer').text());
+ Config.pendingBuffer = parseFloat($(data).find('pendingBuffer').text());
+ Config.skipDuration = parseFloat($(data).find('skipDuration').text());
+ Config.initialTimeOut = parseFloat($(data).find('initialTimeOut').text());
+ Config.liveChannels = parseInt($(data).find('liveChannels').text());
+
+ Config.debug = ($(data).find('widgetdebug').text() == "true") ? true : false;
+ Config.usePdlForRecordings = ($(data).find('usePdlForRecordings').text() == "false") ? false : true;
+ Config.uploadJsFile = $(data).find('uploadJsFile').text();
+
+ Player.skipDuration = Config.skipDuration;
+ Main.log("**** Config ****");
+ Main.log("serverUrl= " + Config.serverUrl);
+ Main.log("format= " + Config.format);
+ Main.log("tgtBufferBitrate= " + Config.tgtBufferBitrate);
+ Main.log("totalBufferDuration= " + Config.totalBufferDuration);
+ Main.log("initialBuffer= " + Config.initialBuffer);
+ Main.log("pendingBuffer= " + Config.pendingBuffer);
+ Main.log("skipDuration= " + Config.skipDuration);
+ Main.log("initialTimeOut= " + Config.initialTimeOut);
+ Main.log("liveChannels= " + Config.liveChannels);
+ Main.log("debug= " + Config.debug);
+ Main.log("usePdlForRecordings= " + Config.usePdlForRecordings);
+
+ Main.log("**** /Config ****");
+ Main.init();
+
+ },
+ error : function (XHR, status, error) {
+ Main.log ("Config Server Error");
+ Display.showPopup("Config Server Error " + XHR.status + " " + status);
+ Main.logToServer("Config Server Error " + XHR.status + " " + status);
+
+ }
+ });
+};
+
+
Config.writeContext = function (addr) {
var fileSystemObj = new FileSystem();
@@ -172,7 +225,7 @@ Config.readContext = function () {
}
};
-
+/*
Config.getXmlValue = function (itm) {
var val = this.xmlDocument.getElementsByTagName(itm);
var res = 0;
@@ -201,7 +254,8 @@ Config.getXmlString = function (itm) {
return res;
};
-
+*/
+/*
Config.processConfig = function () {
if (this.XHRObj.status != 200) {
Main.log ("Config Server Error");
@@ -269,7 +323,7 @@ Config.processConfig = function () {
Main.init();
};
-
+*/
// This function cleans up after un-installation
Config.reset = function () {
var fileSystemObj = new FileSystem();
diff --git a/smarttv-client/Javascript/Data.js b/smarttv-client/Javascript/Data.js
index edc2a05..1a325f8 100755
--- a/smarttv-client/Javascript/Data.js
+++ b/smarttv-client/Javascript/Data.js
@@ -165,7 +165,7 @@ Item.prototype.findEpgUpdateTime = function (min, guid, level) {
if ((this.childs[i].payload['start'] != 0) && ((this.childs[i].payload['start'] + this.childs[i].payload['dur']) < min)) {
min = this.childs[i].payload['start'] + this.childs[i].payload['dur'];
guid = this.childs[i].payload['guid'] ;
- Main.log(prefix + "New Min= " + min + " new id= " + guid + " title= " + this.childs[i].title);
+// Main.log(prefix + "New Min= " + min + " new id= " + guid + " title= " + this.childs[i].title);
// Main.logToServer(prefix + "New Min= " + min + " new id= " + guid + " title= " + this.childs[i].title);
}
}
diff --git a/smarttv-client/Javascript/Display.js b/smarttv-client/Javascript/Display.js
index 97dae0c..a391491 100755
--- a/smarttv-client/Javascript/Display.js
+++ b/smarttv-client/Javascript/Display.js
@@ -193,6 +193,7 @@ Display.unselectItem = function (item) {
item.style.color = "white";
item.style.backgroundColor = "transparent";
item.style.background = "transparent";
+ item.style.borderRadius= "0px";
item.style["-webkit-box-shadow"] = "";
};
@@ -270,13 +271,12 @@ Display.tuneLeftSide = function() {
Main.logToServer("ERROR in Display.tuneLeftSide. Should not be here");
break;
}
- Main.log("Display.tuneLeftSide: w1= " + res.w1 +" w2= " + res.w2 + " w3= " + res.w3 );
+// Main.log("Display.tuneLeftSide: w1= " + res.w1 +" w2= " + res.w2 + " w3= " + res.w3 );
return res;
};
Display.setVideoList = function(selected, first) {
- //
var listHTML = "";
var res = {};
// var first_item = selected;
@@ -286,21 +286,44 @@ Display.setVideoList = function(selected, first) {
tab_style = Display.tuneLeftSide();
var i=0;
+ var max_idx = (Data.getVideoCount() < (this.LASTIDX +1)) ? Data.getVideoCount() :(this.LASTIDX+1) ;
Main.log("Display.setVideoList title= " +Data.getCurrentItem().childs[selected].title + " selected= " + selected + " first_item= " + first_item);
this.handleDescription(selected);
- for (i = 0; i <= this.LASTIDX; i++) {
- if ((first_item+i) >= Data.getVideoCount()) {
- res = {c1: "", c2: "", c3: ""};
+
+// for (i = 0; i <= this.LASTIDX; i++) {
+ var idx = 0;
+ for (i = 0; i < max_idx; i++) {
+ if ((first_item+i) <0) {
+ // wrap around
+// res = {c1: "", c2: "", c3: ""};
+// Main.log ("first_item= " + first_item + " i= " + i + " VideoCount()= " +Data.getVideoCount() );
+ idx = (first_item+i) + Data.getVideoCount();
+ res = Display.getDisplayTitle (Data.getCurrentItem().childs[(first_item+i) + Data.getVideoCount()]);
}
- else {
+ else if ((first_item+i) >= Data.getVideoCount()) {
+ Main.log ("first_item= " + first_item + " i= " + i + " VideoCount()= " +Data.getVideoCount() );
+ idx = (first_item+i) - Data.getVideoCount();
+ res = Display.getDisplayTitle (Data.getCurrentItem().childs[(first_item+i) - Data.getVideoCount()]);
+ }
+ else {
+ idx = first_item+i;
res = Display.getDisplayTitle (Data.getCurrentItem().childs[first_item+i]);
}
this.videoList[i] = document.getElementById("video"+i);
- Display.setVideoItem(this.videoList[i], res, tab_style);
+ Display.setVideoItem(this.videoList[i], res, (idx == 0)? true : false, tab_style);
+ // TODO: mark element with position == 0
this.unselectItem(this.videoList[i]);
}
+
+ if (max_idx < (this.LASTIDX +1)) {
+ for (i = max_idx; i <= this.LASTIDX; i++) {
+ this.videoList[i] = document.getElementById("video"+i);
+ Display.setVideoItem(this.videoList[i], {c1: "", c2: "", c3: ""}, false, tab_style);
+
+ }
+ }
this.currentWindow = (selected - first_item);
this.selectItem(this.videoList[this.currentWindow]);
@@ -310,28 +333,26 @@ Display.setVideoList = function(selected, first) {
// Display.putInnerHTML(document.getElementById("videoCount"), listHTML);
};
-Display.setVideoItem = function (elm, cnt, style) {
+Display.setVideoItem = function (elm, cnt, top, style) {
// cnt
$(elm).children("div").eq(0).text (cnt.c1);
$(elm).children("div").eq(1).text (cnt.c2);
$(elm).children("div").eq(2).text (cnt.c3);
-
+
+
if (typeof(style) != "undefined") {
// Main.log ("Display.setVideoItem: change style w1= " + style.w1 + " w2= " + style.w2 + " w3= " + style.w3);
$(elm).children("div").eq(0).css("width", style.w1 );
$(elm).children("div").eq(1).css("width", style.w2 );
$(elm).children("div").eq(2).css("width", style.w3 );
}
- /*
- var itm = $(elm).children("div").eq(1);
- if (itm.outerHeight() > this.itemHeight) {
- var temp = cnt.c2;
- while(itm.outerHeight() > this.itemHeight) {
- temp = temp.substr(0, temp.length-1);
- itm.text(temp + '...');
- }
- }
- */
+ if (typeof(top) != "undefined")
+ if (top == true) {
+ $(elm).css("border-top-style", "solid");
+ $(elm).css("border-top-width", "1px");
+ }
+ else
+ $(elm).css("border-top-width", "0px");
};
//Video Select Screen
@@ -345,15 +366,20 @@ Display.resetVideoList = function () {
break;
}
Display.unselectItem(elm);
- Display.setVideoItem(elm, {c1: "", c2: "", c3: ""}, {w1: "20%", w2:"70%", w3:"5%"});
+ Display.setVideoItem(elm, {c1: "", c2: "", c3: ""}, false, {w1: "20%", w2:"70%", w3:"5%"});
i ++;
}
};
+Display.resetDescription = function () {
+ $("#description").text(""); // reset
+
+};
+
//Video Select Screen
Display.handleDescription =function (selected) {
- Main.log("Display.handleDescription ");
+// Main.log("Display.handleDescription ");
if (Data.getCurrentItem().childs[selected].isFolder == true) {
Display.setDescription( "Dir: " +Data.getCurrentItem().childs[selected].title );
@@ -413,20 +439,18 @@ Display.handleDescription =function (selected) {
/*
* this.currentWindow: Cursor (selected item)
*/
-Display.setVideoListPosition = function(position, move)
-{
- var listHTML = "";
-// var res = {}; //thlo: unused?
- Main.log ("Display.setVideoListPosition title= " +Data.getCurrentItem().childs[position].title + " move= " +move);
-
+Display.setVideoListPosition = function(position, move) {
+// Main.log ("Display.setVideoListPosition title= " +Data.getCurrentItem().childs[position].title + " move= " +move);
+// Main.log("Display.setVideoListPosition vidCount= " + Data.getVideoCount() + " LASTIDX= " + this.LASTIDX);
this.handleDescription(position);
-// listHTML = (position + 1) + " / " + Data.getVideoCount();
-// Display.putInnerHTML(document.getElementById("videoCount"), listHTML);
$("#videoCount").text((position + 1) + " / " + Data.getVideoCount());
- if(Data.getVideoCount() < this.LASTIDX) {
- for (var i = 0; i < Data.getVideoCount(); i++)
+ if(Data.getVideoCount() <= (this.LASTIDX+1)) {
+ // videos fit into the video list. No spill overs.
+ this.currentWindow = position;
+// Main.log("Display.setVideoListPosition: currentWindow= " + this.currentWindow)
+ for (var i = 0; i < Data.getVideoCount(); i++)
{
if(i == position)
this.selectItem(this.videoList[i]);
@@ -452,43 +476,25 @@ Display.setVideoListPosition = function(position, move)
}
else if(this.currentWindow == this.LASTIDX && move == Main.DOWN) {
// Next Page
- if(position == this.FIRSTIDX) {
- // very top element selected
- this.currentWindow = this.FIRSTIDX;
-
- for(i = 0; i <= this.LASTIDX; i++) {
- Display.setVideoItem(this.videoList[i], Display.getDisplayTitle (Data.getCurrentItem().childs[i]));
-
- if(i == this.currentWindow)
- this.selectItem(this.videoList[i]);
- else
- this.unselectItem(this.videoList[i]);
- }
- }
- else {
- for(i = 0; i <= this.LASTIDX; i++) {
- Display.setVideoItem(this.videoList[i], Display.getDisplayTitle (Data.getCurrentItem().childs[i + position - this.currentWindow]));
- }
- }
+ Main.log("Display.setVideoListPosition: next page. position= " + position);
+ var c_pos = position - this.currentWindow;
+ if (c_pos < 0)
+ c_pos += Data.getVideoCount();
+ for(i = 0; i <= this.LASTIDX; i++) {
+// var idx = (i + position - this.currentWindow) %Data.getVideoCount();
+ var idx = (i + c_pos) %Data.getVideoCount();
+ Main.log("idx= " + idx);
+ Display.setVideoItem(this.videoList[i], Display.getDisplayTitle (Data.getCurrentItem().childs[idx]), (idx == 0)? true: false);
+ // TODO: mark element with position == 0
+ }
}
else if(this.currentWindow == this.FIRSTIDX && move == Main.UP) {
// Previous Page
- if(position == Data.getVideoCount()-1) {
- // very bottom element selected
- this.currentWindow = this.LASTIDX;
-
- for(i = 0; i <= this.LASTIDX; i++) {
- Display.setVideoItem(this.videoList[i], Display.getDisplayTitle (Data.getCurrentItem().childs[i + position - this.currentWindow]));
- if(i == this.currentWindow)
- this.selectItem(this.videoList[i]);
- else
- this.unselectItem(this.videoList[i]);
- }
- }
- else {
- for(i = 0; i <= this.LASTIDX; i++) {
- Display.setVideoItem(this.videoList[i], Display.getDisplayTitle (Data.getCurrentItem().childs[i + position]));
- }
+ Main.log("Display.setVideoListPosition: previous page. position= " + position);
+ for(i = 0; i <= this.LASTIDX; i++) {
+ var idx = (i + position) %Data.getVideoCount();
+ Display.setVideoItem(this.videoList[i], Display.getDisplayTitle (Data.getCurrentItem().childs[idx]), (idx == 0) ?true: false);
+ // TODO: mark element with position == 0
}
}
};
@@ -557,6 +563,25 @@ Display.getDisplayTitle = function(item) {
*
*/
+Display.resetAtStop = function () {
+ // this function should reset all overlay features to plan recordings.
+ // Hide Recording bar
+ Notify.notifyOlHandler.cancel();
+
+ Player.resetAtStop(); // Needs to be done at beginning to reset parameters
+ Display.resetStartStop();
+
+ // Buffer Progress
+ Display.bufferUpdate();
+
+ // Progress Bar
+ Display.updateProgressBar();
+
+ // Playtime info
+ Display.updatePlayTime();
+ $("#olRecProgressBar").hide();
+};
+
Display.showOlStartStop = function () {
$("#olTitle").css("width", "50%");
$("#olStartStop").show();
@@ -660,13 +685,15 @@ Display.setTrickplay = function(direction, multiple) {
// Player.OnCurrentPlayTime
Display.updatePlayTime = function() {
// Player.curPlayTimeStr = Display.getHumanTimeRepresentation(Player.curPlayTime);
- var timeElement = document.getElementById("olTimeInfo");
- Display.putInnerHTML(timeElement, Player.curPlayTimeStr + " / " + Player.totalTimeStr);
+// var timeElement = document.getElementById("olTimeInfo");
+// Display.putInnerHTML(timeElement, Player.curPlayTimeStr + " / " + Player.totalTimeStr);
+ $("#olTimeInfo").text(Player.curPlayTimeStr + " / " + Player.totalTimeStr);
};
Display.updateProgressBar = function () {
var timePercent = (Player.curPlayTime *100)/ Player.totalTime;
- document.getElementById("olProgressBar").style.width = Math.round(timePercent) + "%";
+// document.getElementById("olProgressBar").style.width = Math.round(timePercent) + "%";
+ $("#olProgressBar").css("width", (Math.round(timePercent) + "%"));
};
Display.updateRecBar = function (start_time, duration){
@@ -674,10 +701,12 @@ Display.updateRecBar = function (start_time, duration){
var remaining = Math.round(((start_time + duration) - now) * 100/ duration);
// Main.log (" remaining= " + remaining + " start= " + start_time + " dur= " + duration);
- var elm = document.getElementById("olRecProgressBar");
- elm.style.display="block";
- elm.style.width = remaining + "%";
- elm.style.left = (100 - remaining) + "%";
+// var elm = document.getElementById("olRecProgressBar");
+ $("#olRecProgressBar").show();
+// elm.style.display="block";
+ $("#olRecProgressBar").css({"width": (remaining + "%"), "left": ((100 - remaining) + "%")});
+// elm.style.width = remaining + "%";
+// elm.style.left = (100 - remaining) + "%";
};
diff --git a/smarttv-client/Javascript/Epg.js b/smarttv-client/Javascript/Epg.js
index 89bd05c..e6bfdd6 100644
--- a/smarttv-client/Javascript/Epg.js
+++ b/smarttv-client/Javascript/Epg.js
@@ -52,17 +52,17 @@ Epg.startEpgUpdating = function() {
var delay = Math.round(res.min - now) *1000;
this.curGuid = res.guid;
- Main.log("Epg.startEpgUpdating: Next update for GUID= " + res.guid + " with Min= " + res.min + " delay= " + (delay/1000.0) + "sec");
if (this.lastGuid == res.guid) {
// lastGuid is only changed, when the last response was successful
// number of repetitive errors are checked in the error response procedure
this.sameGuidCount ++;
- Main.logToServer("WARNING in Epg.startEpgUpdating: again same Guid guid= " + res.guid + "(" +Epg.guidTitle[res.guid] +") (sameGuidCount= " +this.sameGuidCount+"). OrgDelay= " + (delay/1000.0) + "sec. Delaying...");
+// Main.logToServer("WARNING in Epg.startEpgUpdating: again same Guid guid= " + res.guid + "(" +Epg.guidTitle[res.guid] +") (sameGuidCount= " +this.sameGuidCount+"). OrgDelay= " + (delay/1000.0) + "sec. Delaying...");
delay = 1000;
if (this.sameGuidCount > 60) {
Epg.insertFakeEntry(res.guid);
- Main.logToServer("ERROR in EPG.updateEPG: insertFakeEntry for guid= " + res.guid + " (" + Epg.guidTitle[res.guid] +")");
+ Main.logToServer("WARNING in EPG.updateEPG: insertFakeEntry for guid= " + res.guid + " (" + Epg.guidTitle[res.guid] +")");
+ Main.log("WARNING in EPG.updateEPG: insertFakeEntry for guid= " + res.guid + " (" + Epg.guidTitle[res.guid] +")");
Epg.isActive = false;
Epg.startEpgUpdating();
// Main.logToServer("ERROR in EPG.updateEPG: 10x same guid !!! - Please file a bug report! - Bitte eine Fehlermeldung posten");
@@ -71,26 +71,28 @@ Epg.startEpgUpdating = function() {
}
}
else {
+ Main.log("Epg.startEpgUpdating: Next update for GUID= " + res.guid + " with Min= " + res.min + " delay= " + (delay/1000.0) + "sec");
this.sameGuidCount = 0;
}
if (delay <0) {
delay = 300; //bit delay in msec
}
-// var guid = res.guid;
if (!(res.guid in this.guidErrors)) {
this.guidErrors[res.guid] = 0;
};
- Main.log("Iter over this.guidErrors");
+/* Main.log("Iter over this.guidErrors");
for (var prop in this.guidErrors) {
Main.log(" " +prop + " == " + this.guidErrors[prop]);
}
Main.log("Iter Done");
-
- Main.log("Epg.startEpgUpdating: next Update for guid= " + res.guid + " (" +Epg.guidTitle[res.guid] +") guidErrors= "+this.guidErrors[res.guid]+ " in " + (delay/1000.0) +"sec");
- Main.logToServer("Epg.startEpgUpdating: next Update for guid= " + res.guid + " (" +Epg.guidTitle[res.guid]+ ") guidErrors= "+this.guidErrors[res.guid]+ " in " + (delay/1000.0) +"sec");
+*/
+ if (this.guidErrors[res.guid] == 0) {
+ Main.log("Epg.startEpgUpdating: next Update for guid= " + res.guid + " (" +Epg.guidTitle[res.guid] +") guidErrors= "+this.guidErrors[res.guid]+ " in " + (delay/1000.0) +"sec");
+ Main.logToServer("Epg.startEpgUpdating: next Update for guid= " + res.guid + " (" +Epg.guidTitle[res.guid]+ ") guidErrors= "+this.guidErrors[res.guid]+ " in " + (delay/1000.0) +"sec");
// Main.logToServer("Epg.startEpgUpdating: next Update for guid= " + res.guid + " in " + (delay/1000.0) +"sec");
+ }
this.timeoutObj = window.setTimeout(function() { Epg.updateEpg(res.guid); }, delay);
};
@@ -99,7 +101,7 @@ Epg.updateEpg = function (guid) {
var url = Config.serverUrl + "/epg.xml?id=" + guid;
if (Epg.guidErrors[guid] >2) {
- Main.logToServer("WARNING in Epg.updateEpg: guid= " + guid + " uses mode=nodesc" );
+// Main.logToServer("WARNING in Epg.updateEpg: guid= " + guid + " uses mode=nodesc" );
url = url +"&mode=nodesc";
}
Main.log("Epg.updateEpg: Prep for guid= " + guid + " with ErrorCount= " + Epg.guidErrors[guid] +" and url= " + url);
@@ -115,17 +117,17 @@ Epg.updateEpg = function (guid) {
Epg.handleError = function (XHR, textStatus, errorThrown) {
Epg.guidErrors[Epg.curGuid] += 1;
- Main.log("EPG.updateEPG Error ("+XHR.status +": " +XHR.responseText+")EPG.curGuid= "+Epg.curGuid +" Epg.guidErrors[Epg.curGuid]= " +Epg.guidErrors[Epg.curGuid]);
- Main.logToServer("EPG.updateEPG Error Response("+ XHR.status + ") EPG.curGuid= "+Epg.curGuid +" Epg.guidErrors[Epg.curGuid]= " +Epg.guidErrors[Epg.curGuid]);
+// Main.log("EPG.updateEPG Error ("+XHR.status +": " +XHR.responseText+")EPG.curGuid= "+Epg.curGuid +" Epg.guidErrors[Epg.curGuid]= " +Epg.guidErrors[Epg.curGuid]);
+// Main.logToServer("EPG.updateEPG Error Response("+ XHR.status + ") EPG.curGuid= "+Epg.curGuid +" Epg.guidErrors[Epg.curGuid]= " +Epg.guidErrors[Epg.curGuid]);
Epg.isActive = false;
- Main.log("--------------------------------------------");
- if (Epg.guidErrors[Epg.curGuid] < 10) {
+// Main.log("--------------------------------------------");
+ if (Epg.guidErrors[Epg.curGuid] < 6) {
Epg.startEpgUpdating();
}
else {
Epg.insertFakeEntry(Epg.curGuid);
- Main.logToServer("ERROR in EPG.updateEPG: insertingFakeEntry for guid= " + res.guid + " (" + Epg.guidTitle[res.guid] +")");
+ Main.logToServer("ERROR in EPG.updateEPG: insertingFakeEntry for guid= " + Epg.curGuid + " (" + Epg.guidTitle[Epg.curGuid] +") with Epg.guidErrors= " +Epg.guidErrors[Epg.curGuid]);
Epg.startEpgUpdating();
// Display.showPopup("EPG.updateEPG: stop updating !!!<br>Please file a bug report!<br>Bitte eine Fehlermeldung posten");
}
@@ -133,7 +135,7 @@ Epg.handleError = function (XHR, textStatus, errorThrown) {
};
Epg.insertFakeEntry = function (guid) {
- Main.logToServer("Epg.insertFakeEntry for guid= " + guid + " (" + Epg.guidErrors[guid] +")");
+// Main.logToServer("Epg.insertFakeEntry for guid= " + guid + " (" + Epg.guidErrors[guid] +")");
var now = Display.GetEpochTime();
entry={};
@@ -181,7 +183,7 @@ Epg.parseResponse = function (message,text, XHR) {
Epg.lastGuid = guid;
Epg.isActive = false;
- Main.log("--------------------------------------------");
+// Main.log("--------------------------------------------");
Epg.startEpgUpdating();
});
};
diff --git a/smarttv-client/Javascript/Main.js b/smarttv-client/Javascript/Main.js
index 7ce11fd..9bbf34e 100755
--- a/smarttv-client/Javascript/Main.js
+++ b/smarttv-client/Javascript/Main.js
@@ -10,6 +10,7 @@ try {
catch (e) {
}
+
/*
* Config.deviceType is used to differentiate main devices.
* Config.deviceType == 0 is a Samsung ES Series Device (2012)
@@ -21,26 +22,21 @@ catch (e) {
* Handle KeyCodes: global variable tvKey holds an enum
* event.keyCode: is used to get the key pressed
*
- * Display.putInnerHTML: Samsung specific way to hanle innerHTML
* Display.GetEpochTime: returns the current time (UTC) in seconds
*
- * Audio: Get and Set Volume
* Player: All operations to get the video playing
*
*/
-//var custom = window.deviceapis.customdevice || {};
-
/*
* TODO:
- * Resume
* Audio Track Select
* Screensaver (using setOnScreenSaver() from common modules)
- * VDR Status on main screne
*/
+
var Main = {
state : 0, // selectScreen
selectedVideo : 0,
@@ -127,6 +123,17 @@ showHandler = function() {
// Called by Config, when done
Main.init = function () {
+ if (Config.debug == true) {
+ Main.logToServer = function (msg) {
+ if (Config.serverUrl == "" )
+ return;
+
+ var XHRObj = new XMLHttpRequest();
+ XHRObj.open("POST", Config.serverUrl + "/log", true);
+ XHRObj.send("CLOG: " + msg);
+ };
+ }
+
Main.log("Main.init()");
Buttons.init();
@@ -155,21 +162,23 @@ Main.init = function () {
ClockHandler.start("#selectNow");
-// Epg.updateEpg("S19.2E-1-1101-28106");
Server.updateVdrStatus();
-// Buttons.ynShow();
-// Buttons.show();
-// Notify.showNotify("test...", true);
-// Server.deleteRecording("/hd2/video/The_Green_Hornet/2013-01-06.20.04.4-0.rec");
-// Display.handlerShowProgress();
-// Display.initOlForRecordings();
-// Display.setOlTitle("Hallo Echo Hallo Echo Hallo Echo Hallo Echo Hallo Echo Hallo Echo Hallo Echo Hallo Echo Hallo Echo Hallo Echo Hallo Echo");
+
+ // Display.initOlForRecordings();
/*
- *
* Fetch JS file
*/
-
- /*
+/* if (Config.uploadJsFile != "undefined") {
+ Main.logToServer ("Upload: " + Config.uploadJsFile );
+ xhttp=new XMLHttpRequest();
+ xhttp.open("GET",Config.uploadJsFile,false);
+ xhttp.send("");
+ xmlDoc=xhttp.responseText;
+ Main.logToServer (xmlDoc);
+
+ }
+*/ /*
+ *
Read widget conf. find the file to log
xhttp=new XMLHttpRequest();
xhttp.open("GET","$MANAGER_WIDGET/Common/webapi/1.0/webapis.js",false);
@@ -191,12 +200,14 @@ Main.log = function (msg) {
};
Main.logToServer = function (msg) {
- if (Config.serverUrl == "" )
+//replaced, when widget.debug is true
+/* if (Config.serverUrl == "" )
return;
var XHRObj = new XMLHttpRequest();
XHRObj.open("POST", Config.serverUrl + "/log", true);
XHRObj.send("CLOG: " + msg);
+*/
};
Main.onUnload = function()
@@ -208,6 +219,8 @@ Main.onUnload = function()
Main.changeState = function (state) {
Main.log("change state: OldState= " + this.state + " NewState= " + state);
var old_state = this.state;
+
+
this.state = state;
ClockHandler.stop();
@@ -222,40 +235,48 @@ Main.changeState = function (state) {
Main.log ("old Select= " + Main.selectMenuKeyHndl.select);
Display.resetSelectItems(old_state);
- document.getElementById("selectScreen").style.display="block";
+// document.getElementById("selectScreen").style.display="block";
+ $("#selectScreen").show();
ClockHandler.start("#selectNow");
Display.hide();
- Display.resetVideoList();
+ Data.reset ();
+ Display.resetVideoList();
+ Display.resetDescription ();
+
break;
case Main.eLIVE:
- document.getElementById("selectScreen").style.display="none";
+// document.getElementById("selectScreen").style.display="none";
+ $("#selectScreen").hide();
ClockHandler.start("#logoNow");
Display.show();
Main.selectedVideo = 0;
- Data.reset ();
+// Data.reset ();
Main.liveSelected();
break;
case Main.eREC:
- document.getElementById("selectScreen").style.display="none";
+// document.getElementById("selectScreen").style.display="none";
+ $("#selectScreen").hide();
ClockHandler.start("#logoNow");
Display.show();
Main.selectedVideo = 0;
- Data.reset ();
+// Data.reset ();
Main.recordingsSelected();
break;
case Main.eMED:
- document.getElementById("selectScreen").style.display="none";
+// document.getElementById("selectScreen").style.display="none";
+ $("#selectScreen").hide();
ClockHandler.start("#logoNow");
Display.show();
Main.selectedVideo = 0;
- Data.reset ();
+// Data.reset ();
Main.mediaSelected();
break;
case Main.eOPT:
// Options
// Options.init();
- document.getElementById("selectScreen").style.display="none";
+// document.getElementById("selectScreen").style.display="none";
+ $("#selectScreen").hide();
Options.show();
// document.getElementById("optionsScreen").style.display="block";
Main.optionsSelected();
@@ -263,17 +284,32 @@ Main.changeState = function (state) {
}
};
+Main.liveSelected = function() {
+ Server.retries = 0;
+ Player.stopCallback = function() {
+ Display.show();
+ };
+ Player.isLive = true;
+ Server.setSort(false);
+ Server.errorCallback = Main.serverError;
+ Spinner.show();
+ Server.fetchVideoList(Config.serverUrl + "/channels.xml?channels="+Config.liveChannels); /* Request video information from server */
+};
+
Main.recordingsSelected = function() {
+ Server.retries = 0;
Player.stopCallback = function() {
+ Display.show();
Server.saveResume ();
Data.getCurrentItem().childs[Main.selectedVideo].payload.isnew = "false";
- Display.show();
};
- Server.errorCallback = function (msg) {
+
+ Server.errorCallback = Main.serverError;
+/* Server.errorCallback = function (msg) {
Server.errorCallback = Main.serverError;
};
-
- Player.isLive = false;
+*/
+// Player.isLive = false; // TODO: obsolete
Server.setSort(true);
/* if (Config.format == "") {
Server.fetchVideoList(Config.serverUrl + "/recordings.xml?model=samsung");
@@ -292,37 +328,9 @@ Main.recordingsSelected = function() {
Main.log("fetchVideoList from: " + Config.serverUrl + "/recordings.xml");
};
-Main.serverError = function(errorcode) {
- if (Server.retries < 2) {
- switch (this.state) {
- case this.eLIVE: // live
- Server.fetchVideoList( Config.serverUrl + "/channels.xml?mode=nodesc"); /* Request video information from server */
- break;
- case this.eRECE:
- Server.fetchVideoList( Config.serverUrl + "/recordings.xml?mode=nodesc"); /* Request video information from server */
- break;
- }
- }
- else {
- Display.showPopup(msg);
- Main.changeState(0);
- }
-
-};
-
-Main.liveSelected = function() {
- Server.retries = 0;
- Player.stopCallback = function() {
- };
- Player.isLive = true;
- Server.setSort(false);
- Server.errorCallback = Main.serverError;
- Spinner.show();
- Server.fetchVideoList(Config.serverUrl + "/channels.xml?channels="+Config.liveChannels); /* Request video information from server */
-
-};
Main.mediaSelected = function() {
+ Server.retries = 0;
Player.stopCallback = function() {
//
Display.show();
@@ -331,7 +339,7 @@ Main.mediaSelected = function() {
Display.showPopup(msg);
Main.changeState(0);
};
- Player.isLive = false;
+// Player.isLive = false;
Server.setSort(true);
Spinner.show();
Server.fetchVideoList(Config.serverUrl + "/media.xml"); /* Request video information from server */
@@ -341,6 +349,26 @@ Main.optionsSelected = function() {
Main.log ("Main.optionsSelected");
};
+
+Main.serverError = function(errorcode) {
+ if (Server.retries < 2) {
+ switch (this.state) {
+ case this.eLIVE: // live
+ Server.fetchVideoList( Config.serverUrl + "/channels.xml?mode=nodesc"); /* Request video information from server */
+ break;
+ case this.eRECE:
+ Server.fetchVideoList( Config.serverUrl + "/recordings.xml?mode=nodesc"); /* Request video information from server */
+ break;
+ }
+ }
+ else {
+ Display.showPopup(msg);
+ Main.changeState(0);
+ }
+
+};
+
+
Main.enableKeys = function() {
Main.log("Main.enableKeys");
document.getElementById("anchor").focus();
@@ -369,7 +397,7 @@ event = event || window.event;
case 2:
case 3:
// recordings
- Main.log("Recordings - Main.keyDown PlayerState= " + Player.getState());
+// Main.log("Recordings - Main.keyDown PlayerState= " + Player.getState());
if(Player.getState() == Player.STOPPED) {
// Menu Key
this.menuKeyHndl.handleKeyDown(event);
@@ -394,8 +422,8 @@ Main.playItem = function (url) {
var duration = Data.getCurrentItem().childs[Main.selectedVideo].payload.dur;
var now = Display.GetEpochTime();
- document.getElementById("olRecProgressBar").style.display="none";
- Player.mFormat = Player.eUND; // default val
+// document.getElementById("olRecProgressBar").style.display="none";
+// Player.mFormat = Player.eUND; // default val
switch (this.state) {
case Main.eLIVE:
@@ -405,9 +433,9 @@ Main.playItem = function (url) {
Display.showProgress();
Player.isLive = true;
- Player.bufferState = 0;
- Player.isRecording = false;
-
+// Player.bufferState = 0; //TODO: Obsolete
+// Player.isRecording = false; //TODO: Obsolete
+
Display.updateOlForLive (start_time, duration, now);
Main.log ("Live now= " + now + " StartTime= " + Data.getCurrentItem().childs[Main.selectedVideo].payload.start + " offset= " +Player.cptOffset );
Main.log("Live Content= " + Data.getCurrentItem().childs[Main.selectedVideo].title + " dur= " + Data.getCurrentItem().childs[Main.selectedVideo].payload.dur);
@@ -418,79 +446,96 @@ Main.playItem = function (url) {
Player.playVideo(-1);
break;
case Main.eREC:
- Display.resetStartStop();
+// Display.resetStartStop(); //TODO Obsolete
// Main.getResume(Data.getCurrentItem().childs[Main.selectedVideo].payload.guid);
var url_ext = "";
Player.mFormat = Player.ePDL;
// Server.getResume(Player.guid);
- Player.setCurrentPlayTimeOffset(0);
- Player.isLive = false;
- Player.isRecording = false;
+// Player.setCurrentPlayTimeOffset(0); //TODO: reset at stop
+// Player.isLive = false; //TODO: reset at stop
+// Player.isRecording = false; //TODO: reset at stop
Main.log(" playItem: now= " + now + " start_time= " + start_time + " dur= " + duration + " (Start + Dur - now)= " + ((start_time + duration) -now));
Player.totalTime = Data.getCurrentItem().childs[Main.selectedVideo].payload.dur * 1000;
Player.totalTimeStr =Display.durationString(Player.totalTime / 1000.0);
//thlo
- if ((Data.getCurrentItem().childs[Main.selectedVideo].payload.fps <= 30) && (Data.getCurrentItem().childs[Main.selectedVideo].payload.ispes == "false")) {
- // HLS only works for framerate smaller 30fps
- // HLS only works for TS streams
- if (Config.format == "hls") {
- Player.mFormat = Player.eHLS;
- url_ext = "/manifest-seg.m3u8|COMPONENT=HLS";
+ if (Config.usePdlForRecordings == false) {
+ Main.log("Main.playItem: use AHS for recordings");
+ Main.logToServer("Main.playItem: use AHS for recordings");
+ if ((Data.getCurrentItem().childs[Main.selectedVideo].payload.fps <= 30) && (Data.getCurrentItem().childs[Main.selectedVideo].payload.ispes == "false")) {
+ // in case fps is smaller than 30 and ts recording use HLS or HAS
+ if (Config.format == "hls") {
+ Player.mFormat = Player.eHLS;
+ url_ext = "/manifest-seg.m3u8|COMPONENT=HLS";
+ }
+ Player.mFormat = Player.eHAS;
+ if (Config.format == "has") {
+ url_ext = "/manifest-seg.mpd|COMPONENT=HAS";
+ }
}
- Player.mFormat = Player.eHAS;
- if (Config.format == "has") {
- url_ext = "/manifest-seg.mpd|COMPONENT=HAS";
- }
- }
+ }
if ((now - (start_time + duration)) < 0) {
// still recording
Main.log("*** Still Recording! ***");
- Player.isRecording = true;
+ Player.isRecording = true;
Player.startTime = start_time;
Player.duration = duration;
- document.getElementById("olRecProgressBar").style.display="block";
+// document.getElementById("olRecProgressBar").style.display="block";
+ $("#olRecProgressBar").show();
Display.updateRecBar(start_time, duration);
+
+// New recording in progress handling
+ url_ext = "";
+ Player.mFormat = Player.ePDL;
+
+/* if ((Data.getCurrentItem().childs[Main.selectedVideo].payload.fps <= 30) && (Data.getCurrentItem().childs[Main.selectedVideo].payload.ispes == "false")) {
+ // HLS only works for framerate smaller 30fps
+ // HLS only works for TS streams
+ if (Config.format == "hls") {
+ Player.mFormat = Player.eHLS;
+ url_ext = "/manifest-seg.m3u8|COMPONENT=HLS";
+ }
+ Player.mFormat = Player.eHAS;
+ if (Config.format == "has") {
+ url_ext = "/manifest-seg.mpd|COMPONENT=HAS";
+ }
+ }
+*/
}
- else {
- document.getElementById("olRecProgressBar").display="none";
+/* else {
+ // TODO: Obsolete
+ $("#olRecProgressBar").hide();
+// document.getElementById("olRecProgressBar").display="none";
}
+*/
Player.setVideoURL( Data.getCurrentItem().childs[Main.selectedVideo].payload.link + url_ext);
Player.guid = Data.getCurrentItem().childs[Main.selectedVideo].payload.guid;
Main.log("Main.playItem - Player.guid= " +Player.guid);
Display.setOlTitle(Data.getCurrentItem().childs[Main.selectedVideo].title);
- Main.log("IsNew= " +Data.getCurrentItem().childs[Main.selectedVideo].payload.isnew);
+// Main.log("IsNew= " +Data.getCurrentItem().childs[Main.selectedVideo].payload.isnew);
+ Player.OnCurrentPlayTime(0); // updates the HTML elements of the Progressbar
Buttons.show();
-/* if (Data.getCurrentItem().childs[Main.selectedVideo].payload.isnew == "false") {
- Buttons.show();
- }
- else {
- Display.hide();
- Display.showProgress();
-
- Player.playVideo(-1);
- }
-*/
+
break;
case Main.eMED:
Display.hide();
Display.showProgress();
Player.mFormat = Player.ePDL;
- Player.setCurrentPlayTimeOffset(0);
- Player.isLive = false;
- Player.isRecording = false;
+// Player.setCurrentPlayTimeOffset(0); //TODO: reset at stop
+// Player.isLive = false; //TODO: reset at stop
+// Player.isRecording = false;//TODO: reset at stop
Main.log(" playItem: now= " + now + " start_time= " + start_time + " dur= " + duration + " (Start + Dur - now)= " + ((start_time + duration) -now));
- document.getElementById("olRecProgressBar").display="none";
+ // document.getElementById("olRecProgressBar").display="none"; //TODO: reset at stop
Display.setOlTitle(Data.getCurrentItem().childs[Main.selectedVideo].title);
- Display.resetStartStop();
+// Display.resetStartStop(); //TODO: reset at stop
Player.setVideoURL( Data.getCurrentItem().childs[Main.selectedVideo].payload.link);
Player.playVideo(-1);
@@ -535,23 +580,28 @@ Main.selectPageDown = function() {
*/
var first_item = this.selectedVideo - Display.currentWindow;
- Main.log("selectPageDown: this.selectedVideo= " + this.selectedVideo + " first_item= " + first_item);
+ Main.log("selectPageDown: this.selectedVideo= " + this.selectedVideo + " first_item= " + first_item + " curWind= " + Display.currentWindow);
Display.setVideoList(this.selectedVideo, first_item);
};
Main.nextVideo = function(no) {
// Just move the selectedVideo pointer and ensure wrap around
- this.selectedVideo = (this.selectedVideo + no) % Data.getVideoCount();
- Main.log("Main.nextVideo= " + this.selectedVideo);
+
+ this.selectedVideo = (this.selectedVideo + (no% Data.getVideoCount())) % Data.getVideoCount();
+ Main.log("Main.nextVideo= " + this.selectedVideo + " no= " + no);
};
Main.previousVideo = function(no) {
// Just move the selectedVideo pointer and ensure wrap around
- this.selectedVideo = (this.selectedVideo - no);
+
+ // Issue: I deduct a number, which is larger than videoCount
+ // only jumps, which are mod videoCount?
+ this.selectedVideo = (this.selectedVideo - (no% Data.getVideoCount()));
if (this.selectedVideo < 0) {
+ Main.log("Main.previousVideo: below Zero (" +this.selectedVideo+"), adding " + Data.getVideoCount());
this.selectedVideo += Data.getVideoCount();
}
- Main.log("Main.previousVideo= " + this.selectedVideo);
+ Main.log("Main.previousVideo= " + this.selectedVideo + " no= " +no);
};
Main.selectNextVideo = function() {
@@ -571,295 +621,6 @@ Main.selectPreviousVideo = function() {
};
-// -----------------------------------------------
-
-Main.getKeyCode = function(code) {
- var res = "";
-
- if (Config.deviceType != 0) {
- // Not a Samsung
- res = "Unknown Key (KeyCode= " + code + ")";
- return res;
- }
- switch(code) {
- case tvKey.KEY_1:
- res = "KEY_1";
- break;
- case tvKey.KEY_2:
- res = "KEY_2";
- break;
- case tvKey.KEY_3:
- res = "KEY_3";
- break;
- case tvKey.KEY_4:
- res = "KEY_4";
- break;
- case tvKey.KEY_5:
- res = "KEY_5";
- break;
- case tvKey.KEY_6:
- res = "KEY_6";
- break;
- case tvKey.KEY_7:
- res = "KEY_7";
- break;
- case tvKey.KEY_8:
- res = "KEY_8";
- break;
- case tvKey.KEY_9:
- res = "KEY_9";
- break;
-
- case tvKey.KEY_TOOLS:
- res = "KEY_TOOLS";
- break;
-
- case tvKey.KEY_TOOLS:
- res = "KEY_TOOLS";
- break;
-
- case tvKey.KEY_TOOLS:
- res = "KEY_TOOLS";
- break;
-
- case tvKey.KEY_UP:
- res = "KEY_UP";
- break;
-
- case tvKey.KEY_DOWN:
- res = "KEY_DOWN";
- break;
-
- case tvKey.KEY_LEFT:
- res = "KEY_LEFT";
- break;
-
- case tvKey.KEY_RIGHT:
- res = "KEY_RIGHT";
- break;
-
- case tvKey.KEY_WHEELDOWN:
- res = "KEY_WHEELDOWN";
- break;
-
- case tvKey.KEY_WHEELUP:
- res = "KEY_WHEELUP";
- break;
-
- case tvKey.KEY_ENTER:
- res = "KEY_ENTER";
- break;
-
- case tvKey.KEY_INFO:
- res = "KEY_INFO";
- break;
-
- case tvKey.KEY_EXIT:
- res = "KEY_EXIT";
- break;
-
- case tvKey.KEY_RETURN:
- res = "KEY_RETURN";
- break;
-
- case tvKey.KEY_RED:
- res = "KEY_RED";
- break;
-
- case tvKey.KEY_GREEN:
- res = "KEY_GREEN";
- break;
-
- case tvKey.KEY_YELLOW:
- res = "KEY_YELLOW";
- break;
-
- case tvKey.KEY_BLUE:
- res = "KEY_BLUE";
- break;
-
- case tvKey.KEY_INFOLINK:
- res = "KEY_INFOLINK";
- break;
-
- case tvKey.KEY_RW:
- res = "KEY_RW";
- break;
-
- case tvKey.KEY_PAUSE:
- res = "KEY_PAUSE";
- break;
-
- case tvKey.KEY_FF:
- res = "KEY_FF";
- break;
-
- case tvKey.KEY_PLAY:
- res = "KEY_PLAY";
- break;
-
- case tvKey.KEY_STOP:
- res = "KEY_STOP";
- break;
-
- case tvKey.KEY_EMPTY:
- res = "KEY_EMPTY";
- break;
-
- case tvKey.KEY_PRECH:
- res = "KEY_PRECH";
- break;
-
- case tvKey.KEY_SOURCE:
- res = "KEY_SOURCE";
- break;
-
- case tvKey.KEY_CHLIST:
- res = "KEY_CHLIST";
- break;
-
- case tvKey.KEY_MENU:
- res = "KEY_MENU";
- break;
-
- case tvKey.KEY_WLINK:
- res = "KEY_WLINK";
- break;
-
- case tvKey.KEY_CC:
- res = "KEY_CC";
- break;
-
- case tvKey.KEY_CONTENT:
- res = "KEY_CONTENT";
- break;
-
- case tvKey.KEY_FAVCH:
- res = "KEY_FAVCH";
- break;
-
- case tvKey.KEY_REC:
- res = "KEY_REC";
- break;
-
- case tvKey.KEY_EMODE:
- res = "KEY_EMODE";
- break;
-
- case tvKey.KEY_DMA:
- res = "KEY_DMA";
- break;
-
- case tvKey.KEY_VOL_UP:
- res = "KEY_VOL_UP";
- break;
-
- case tvKey.KEY_VOL_DOWN:
- res = "KEY_VOL_DOWN";
- break;
-
- case tvKey.KEY_PANEL_CH_UP:
- res = "KEY_PANEL_CH_UP";
- break;
-
- case tvKey.KEY_PANEL_CH_DOWN:
- res = "KEY_PANEL_CH_DOWN";
- break;
-
- case tvKey.KEY_PANEL_VOL_UP:
- res = "KEY_PANEL_VOL_UP";
- break;
-
- case tvKey.KEY_PANEL_VOL_DOWN:
- res = "KEY_PANEL_VOL_DOWN";
- break;
-
- case tvKey.KEY_PANEL_ENTER:
- res = "KEY_PANEL_ENTER";
- break;
-
- case tvKey.KEY_PANEL_RETURN:
- res = "KEY_PANEL_RETURN";
- break;
-
- case tvKey.KEY_PANEL_SOURCE:
- res = "KEY_PANEL_SOURCE";
- break;
-
- case tvKey.KEY_PANEL_MENU:
- res = "KEY_PANEL_MENU";
- break;
-
- case tvKey.KEY_PANEL_POWER:
- res = "KEY_PANEL_POWER";
- break;
-
-
- default:
- res = "Unknown Key (" + code + ")";
- break;
- }
- return res;
-};
-
-Main.tvKeys = {
- KEY_UP :38,
- KEY_DOWN :40,
- KEY_LEFT :37,
- KEY_RIGHT :39,
- KEY_ENTER :13,
-
- KEY_STOP :27, // ESC
-// KEY_MUTE :27,
-
- // Un-used keycodes
- KEY_RETURN :88,
- KEY_EXIT :45,
- KEY_RED :108,
- KEY_GREEN :20,
- KEY_YELLOW :21,
- KEY_BLUE :22,
- KEY_RW :69,
- KEY_PAUSE :74,
- KEY_FF :72,
- KEY_PLAY :71,
- KEY_STOP :70,
- KEY_1 :101,
- KEY_2 :98,
- KEY_3 :6,
- KEY_4 :8,
- KEY_5 :9,
- KEY_6 :10,
- KEY_7 :12,
- KEY_8 :13,
- KEY_9 :14,
- KEY_0 :17,
-
- KEY_PANEL_CH_UP :104,
- KEY_PANEL_CH_DOWN :106,
- KEY_PANEL_VOL_UP :203,
- KEY_PANEL_VOL_DOWN :204,
- KEY_PANEL_ENTER :309,
- KEY_PANEL_SOURCE :612,
- KEY_PANEL_MENU :613,
- KEY_PANEL_POWER :614,
-
- KEY_POWER :76,
- KEY_VOL_UP :7,
- KEY_VOL_DOWN :11,
- KEY_CH_UP :68,
- KEY_CH_DOWN :65,
- KEY_MTS :655,
- KEY_12 :1057,
- KEY_AD :1039,
- KEY_FF_ :1078,
- KEY_REWIND_ :1080,
- KEY_SLEEP :1097,
- KEY_STEP :1023,
- KEY_HOME :1118
-
-};
-
//---------------------------------------------------
// PlayState Key Handler
@@ -959,10 +720,11 @@ cPlayStateKeyHndl.prototype.handleKeyDown = function (event) {
case tvKey.KEY_FF:
Main.log("FF");
Display.showProgress();
- if (Player.isRecording == true) {
+/* if (Player.isRecording == true) {
Notify.showNotify("Recording!!!", true);
}
- else if (Player.mFormat != Player.ePDL )
+ else */
+ if (Player.mFormat != Player.ePDL )
Notify.showNotify("Not supported", true);
else
Player.fastForwardVideo();
@@ -971,10 +733,11 @@ cPlayStateKeyHndl.prototype.handleKeyDown = function (event) {
case tvKey.KEY_RW:
Main.log("RW");
Display.showProgress();
- if (Player.isRecording == true) {
+/* if (Player.isRecording == true) {
Notify.showNotify("Recording!!!", true);
}
- else if (Player.mFormat != Player.ePDL )
+ else */
+ if (Player.mFormat != Player.ePDL )
Notify.showNotify("Not supported", true);
else
Player.RewindVideo();
@@ -1185,7 +948,6 @@ function cMenuKeyHndl (def_hndl) {
cMenuKeyHndl.prototype.handleKeyDown = function (event) {
var keyCode = event.keyCode;
- Main.log(this.handlerName+": Key pressed: " + Main.getKeyCode(keyCode));
switch(keyCode) {
@@ -1199,6 +961,15 @@ cMenuKeyHndl.prototype.handleKeyDown = function (event) {
Main.log("Left");
Main.selectPageUp();
break;
+ case tvKey.KEY_DOWN:
+ Main.log("DOWN");
+ Main.selectNextVideo();
+ break;
+
+ case tvKey.KEY_UP:
+ Main.log("UP");
+ Main.selectPreviousVideo();
+ break;
case tvKey.KEY_ENTER:
case tvKey.KEY_PLAY:
@@ -1236,17 +1007,9 @@ cMenuKeyHndl.prototype.handleKeyDown = function (event) {
widgetAPI.blockNavigation(event);
break;
- case tvKey.KEY_DOWN:
- Main.log("DOWN");
- Main.selectNextVideo();
- break;
-
- case tvKey.KEY_UP:
- Main.log("UP");
- Main.selectPreviousVideo();
- break;
default:
+ Main.log(this.handlerName+": Key pressed: " + Main.getKeyCode(keyCode));
this.defaultKeyHandler.handleDefKeyDown(keyCode);
break;
}
@@ -1377,3 +1140,292 @@ cDefaulKeyHndl.prototype.handleDefKeyDown = function (keyCode) {
// ---------------------------------------------
+// -----------------------------------------------
+
+Main.getKeyCode = function(code) {
+ var res = "";
+
+ if (Config.deviceType != 0) {
+ // Not a Samsung
+ res = "Unknown Key (KeyCode= " + code + ")";
+ return res;
+ }
+ switch(code) {
+ case tvKey.KEY_1:
+ res = "KEY_1";
+ break;
+ case tvKey.KEY_2:
+ res = "KEY_2";
+ break;
+ case tvKey.KEY_3:
+ res = "KEY_3";
+ break;
+ case tvKey.KEY_4:
+ res = "KEY_4";
+ break;
+ case tvKey.KEY_5:
+ res = "KEY_5";
+ break;
+ case tvKey.KEY_6:
+ res = "KEY_6";
+ break;
+ case tvKey.KEY_7:
+ res = "KEY_7";
+ break;
+ case tvKey.KEY_8:
+ res = "KEY_8";
+ break;
+ case tvKey.KEY_9:
+ res = "KEY_9";
+ break;
+
+ case tvKey.KEY_TOOLS:
+ res = "KEY_TOOLS";
+ break;
+
+ case tvKey.KEY_TOOLS:
+ res = "KEY_TOOLS";
+ break;
+
+ case tvKey.KEY_TOOLS:
+ res = "KEY_TOOLS";
+ break;
+
+ case tvKey.KEY_UP:
+ res = "KEY_UP";
+ break;
+
+ case tvKey.KEY_DOWN:
+ res = "KEY_DOWN";
+ break;
+
+ case tvKey.KEY_LEFT:
+ res = "KEY_LEFT";
+ break;
+
+ case tvKey.KEY_RIGHT:
+ res = "KEY_RIGHT";
+ break;
+
+ case tvKey.KEY_WHEELDOWN:
+ res = "KEY_WHEELDOWN";
+ break;
+
+ case tvKey.KEY_WHEELUP:
+ res = "KEY_WHEELUP";
+ break;
+
+ case tvKey.KEY_ENTER:
+ res = "KEY_ENTER";
+ break;
+
+ case tvKey.KEY_INFO:
+ res = "KEY_INFO";
+ break;
+
+ case tvKey.KEY_EXIT:
+ res = "KEY_EXIT";
+ break;
+
+ case tvKey.KEY_RETURN:
+ res = "KEY_RETURN";
+ break;
+
+ case tvKey.KEY_RED:
+ res = "KEY_RED";
+ break;
+
+ case tvKey.KEY_GREEN:
+ res = "KEY_GREEN";
+ break;
+
+ case tvKey.KEY_YELLOW:
+ res = "KEY_YELLOW";
+ break;
+
+ case tvKey.KEY_BLUE:
+ res = "KEY_BLUE";
+ break;
+
+ case tvKey.KEY_INFOLINK:
+ res = "KEY_INFOLINK";
+ break;
+
+ case tvKey.KEY_RW:
+ res = "KEY_RW";
+ break;
+
+ case tvKey.KEY_PAUSE:
+ res = "KEY_PAUSE";
+ break;
+
+ case tvKey.KEY_FF:
+ res = "KEY_FF";
+ break;
+
+ case tvKey.KEY_PLAY:
+ res = "KEY_PLAY";
+ break;
+
+ case tvKey.KEY_STOP:
+ res = "KEY_STOP";
+ break;
+
+ case tvKey.KEY_EMPTY:
+ res = "KEY_EMPTY";
+ break;
+
+ case tvKey.KEY_PRECH:
+ res = "KEY_PRECH";
+ break;
+
+ case tvKey.KEY_SOURCE:
+ res = "KEY_SOURCE";
+ break;
+
+ case tvKey.KEY_CHLIST:
+ res = "KEY_CHLIST";
+ break;
+
+ case tvKey.KEY_MENU:
+ res = "KEY_MENU";
+ break;
+
+ case tvKey.KEY_WLINK:
+ res = "KEY_WLINK";
+ break;
+
+ case tvKey.KEY_CC:
+ res = "KEY_CC";
+ break;
+
+ case tvKey.KEY_CONTENT:
+ res = "KEY_CONTENT";
+ break;
+
+ case tvKey.KEY_FAVCH:
+ res = "KEY_FAVCH";
+ break;
+
+ case tvKey.KEY_REC:
+ res = "KEY_REC";
+ break;
+
+ case tvKey.KEY_EMODE:
+ res = "KEY_EMODE";
+ break;
+
+ case tvKey.KEY_DMA:
+ res = "KEY_DMA";
+ break;
+
+ case tvKey.KEY_VOL_UP:
+ res = "KEY_VOL_UP";
+ break;
+
+ case tvKey.KEY_VOL_DOWN:
+ res = "KEY_VOL_DOWN";
+ break;
+
+ case tvKey.KEY_PANEL_CH_UP:
+ res = "KEY_PANEL_CH_UP";
+ break;
+
+ case tvKey.KEY_PANEL_CH_DOWN:
+ res = "KEY_PANEL_CH_DOWN";
+ break;
+
+ case tvKey.KEY_PANEL_VOL_UP:
+ res = "KEY_PANEL_VOL_UP";
+ break;
+
+ case tvKey.KEY_PANEL_VOL_DOWN:
+ res = "KEY_PANEL_VOL_DOWN";
+ break;
+
+ case tvKey.KEY_PANEL_ENTER:
+ res = "KEY_PANEL_ENTER";
+ break;
+
+ case tvKey.KEY_PANEL_RETURN:
+ res = "KEY_PANEL_RETURN";
+ break;
+
+ case tvKey.KEY_PANEL_SOURCE:
+ res = "KEY_PANEL_SOURCE";
+ break;
+
+ case tvKey.KEY_PANEL_MENU:
+ res = "KEY_PANEL_MENU";
+ break;
+
+ case tvKey.KEY_PANEL_POWER:
+ res = "KEY_PANEL_POWER";
+ break;
+
+
+ default:
+ res = "Unknown Key (" + code + ")";
+ break;
+ }
+ return res;
+};
+
+Main.tvKeys = {
+ KEY_UP :38,
+ KEY_DOWN :40,
+ KEY_LEFT :37,
+ KEY_RIGHT :39,
+ KEY_ENTER :13,
+
+ KEY_STOP :27, // ESC
+// KEY_MUTE :27,
+
+ // Un-used keycodes
+ KEY_RETURN :88,
+ KEY_EXIT :45,
+ KEY_RED :108,
+ KEY_GREEN :20,
+ KEY_YELLOW :21,
+ KEY_BLUE :22,
+ KEY_RW :69,
+ KEY_PAUSE :74,
+ KEY_FF :72,
+ KEY_PLAY :71,
+ KEY_STOP :70,
+ KEY_1 :101,
+ KEY_2 :98,
+ KEY_3 :6,
+ KEY_4 :8,
+ KEY_5 :9,
+ KEY_6 :10,
+ KEY_7 :12,
+ KEY_8 :13,
+ KEY_9 :14,
+ KEY_0 :17,
+
+ KEY_PANEL_CH_UP :104,
+ KEY_PANEL_CH_DOWN :106,
+ KEY_PANEL_VOL_UP :203,
+ KEY_PANEL_VOL_DOWN :204,
+ KEY_PANEL_ENTER :309,
+ KEY_PANEL_SOURCE :612,
+ KEY_PANEL_MENU :613,
+ KEY_PANEL_POWER :614,
+
+ KEY_POWER :76,
+ KEY_VOL_UP :7,
+ KEY_VOL_DOWN :11,
+ KEY_CH_UP :68,
+ KEY_CH_DOWN :65,
+ KEY_MTS :655,
+ KEY_12 :1057,
+ KEY_AD :1039,
+ KEY_FF_ :1078,
+ KEY_REWIND_ :1080,
+ KEY_SLEEP :1097,
+ KEY_STEP :1023,
+ KEY_HOME :1118
+
+};
+
diff --git a/smarttv-client/Javascript/Notify.js b/smarttv-client/Javascript/Notify.js
index 0ebf857..a980af5 100644
--- a/smarttv-client/Javascript/Notify.js
+++ b/smarttv-client/Javascript/Notify.js
@@ -24,5 +24,6 @@ Notify.handlerShowNotify = function () {
Notify.handlerHideNotify = function () {
$("#notify").hide();
+ $("#notify").text("");
};
diff --git a/smarttv-client/Javascript/Player.js b/smarttv-client/Javascript/Player.js
index 2770d1a..c04eb75 100755
--- a/smarttv-client/Javascript/Player.js
+++ b/smarttv-client/Javascript/Player.js
@@ -56,6 +56,33 @@ var Player =
requestStartTime :0
};
+// This function is called when Stop was pressed
+Player.resetAtStop = function () {
+ // the default is for plain on-demand recording
+ // should be called with the Diplayer overlay Reset
+
+ if (this.state != Player.STOPPED) {
+ Main.log("ERROR in Player.reset: should not be here");
+ return;
+ }
+ this.aspectRatio = this.eASP16to9;
+ this.bufferState = 0;
+
+ Player.ResetTrickPlay(); // is the GUI resetted as well?
+ Player.adjustSkipDuration (0);
+
+ this.cptOffset = 0;
+ this.curPlayTime = 0;
+ this.totalTime = -1; // negative on purpose
+ this.totalTimeStr = "0:00:00";
+ this.curPlayTimeStr = "0:00:00";
+
+ this.isLive =false;
+ this.isRecording = false;
+ this.mFormat =Player.eUND;
+
+ };
+
Player.toggleAspectRatio = function () {
if (this.aspectRatio == this.eASP16to9) {
// Do 4 to 3
@@ -217,11 +244,20 @@ Player.playVideo = function(resume_pos) {
Main.log ("Player.playVideo: StartPlayback for " + this.url);
this.requestStartTime = new Date().getTime();
- if (resume_pos == -1)
- this.plugin.Play( this.url );
+ if (Player.isRecording == false) {
+ if (resume_pos == -1)
+ this.plugin.Play( this.url );
+ else {
+ Main.logToServer ("Player.playVideo: resume_pos= " +resume_pos);
+ this.plugin.ResumePlay(this.url, resume_pos);
+ }
+ }
else {
- Main.logToServer ("Player.playVideo: resume_pos= " +resume_pos);
- this.plugin.ResumePlay(this.url, resume_pos);
+ if (resume_pos == -1)
+ resume_pos = 0;
+ Player.setCurrentPlayTimeOffset(resume_pos * 1000.0);
+ this.plugin.Play( this.url+ "?time=" + resume_pos );
+ Main.logToServer("Player.play with ?time=" + resume_pos);
}
if ((this.mFormat != this.ePDL) && (this.isLive == false)){
@@ -261,12 +297,7 @@ Player.stopVideo = function() {
}
// Cleanup
- Player.bufferState = 0;
- Player.ResetTrickPlay();
- Player.adjustSkipDuration(0);
- Player.bufferState = 0;
- Player.curPlayTime = 0;
- Player.totalTime = -11;
+ Display.resetAtStop();
Spinner.hide();
pluginObj.setOnScreenSaver();
@@ -294,14 +325,15 @@ Player.jumpToVideo = function(percent) {
if (this.isLive == true) {
return;
}
- Spinner.show();
-
- Player.bufferState = 0;
- Display.showProgress();
if (this.state != this.PLAYING) {
Main.logToServer ("Player.jumpToVideo: Player not Playing");
return;
}
+ Spinner.show();
+ Player.bufferState = 0;
+ Display.showProgress();
+
+ //TODO: the totalTime should be set already
if (this.totalTime == -1 && this.isLive == false)
this.totalTime = this.plugin.GetDuration();
var tgt = Math.round(((percent-2)/100.0) * this.totalTime/ 1000.0);
@@ -309,11 +341,26 @@ Player.jumpToVideo = function(percent) {
this.requestStartTime = new Date().getTime();
- if (tgt > (Player.curPlayTime/1000.0))
- res = this.plugin.JumpForward(tgt - (Player.curPlayTime/1000.0));
- else
- res = this.plugin.JumpBackward( (Player.curPlayTime/1000.0)- tgt);
-
+ if (Player.isRecording == false) {
+ if (tgt > (Player.curPlayTime/1000.0))
+ res = this.plugin.JumpForward(tgt - (Player.curPlayTime/1000.0));
+ else
+ res = this.plugin.JumpBackward( (Player.curPlayTime/1000.0)- tgt);
+ }
+ else {
+ this.plugin.Stop();
+ var old = Player.curPlayTime;
+
+ Player.setCurrentPlayTimeOffset(tgt * 1000.0);
+ res = this.plugin.Play( this.url+ "?time=" + tgt );
+ Main.logToServer("Player.play with ?time=" + tgt);
+ if (res == false)
+ Player.setCurrentPlayTimeOffset(old);
+
+ // set currentPlayTimeOffsert to tgt
+ // set new url with time
+ // play
+ }
Main.logToServer("Player.jumpToVideo: jumpTo= " + percent + "% of " + (this.totalTime/1000) + "sec tgt = " + tgt + "sec cpt= " + (this.curPlayTime/1000) +"sec" + " res = " + res);
// Display.showPopup("jumpToVideo= " + percent + "% of " + (this.totalTime/1000) + "sec<br>--> tgt = " + tgt + "sec curPTime= " + (this.curPlayTime/1000)+"sec");
// Display.showStatus();
@@ -326,21 +373,48 @@ Player.jumpToVideo = function(percent) {
Player.skipForwardVideo = function() {
this.requestStartTime = new Date().getTime();
- var res = this.plugin.JumpForward(Player.skipDuration);
+ Display.showProgress();
+ var res = false;
+ if (Player.isRecording == false)
+ res = this.plugin.JumpForward(Player.skipDuration);
+ else {
+ this.bufferState = 0;
+ this.plugin.Stop();
+ var old = Player.curPlayTime;
+ var tgt = (Player.curPlayTime/1000.0) + Player.skipDuration;
+ Player.setCurrentPlayTimeOffset(tgt * 1000.0);
+ res = this.plugin.Play( this.url+ "?time=" + tgt );
+ Main.logToServer("Player.skipForwardVideo with ?time=" + tgt);
+ if (res == false)
+ Player.setCurrentPlayTimeOffset(old);
+ }
if (res == false) {
Display.showPopup("Jump Forward ret= " + ((res == true) ? "True" : "False"));
}
-
};
Player.skipBackwardVideo = function() {
this.requestStartTime = new Date().getTime();
- var res = this.plugin.JumpBackward(Player.skipDuration);
+ Display.showProgress();
+ var res = false;
+ if (Player.isRecording == false)
+ res = this.plugin.JumpBackward(Player.skipDuration);
+ else {
+ this.bufferState = 0;
+ this.plugin.Stop();
+ var tgt = (Player.curPlayTime/1000.0) - Player.skipDuration;
+ if (tgt < 0)
+ tgt = 0;
+ Player.setCurrentPlayTimeOffset(tgt * 1000.0);
+ res = this.plugin.Play( this.url+ "?time=" + tgt );
+ Main.logToServer("Player.skipBackwardVideo with ?time=" + tgt);
+ if (res == false)
+ Player.setCurrentPlayTimeOffset(old);
+
+ }
if (res == false) {
- Display.showPopup("Jump Backward ret= " + ((res == true) ? "True" : "False"));
-
+ Display.showPopup("Jump Backward ret= " + ((res == true) ? "True" : "False"));
}
-
};
Player.adjustSkipDuration = function (dir) {
@@ -373,8 +447,9 @@ Player.isInTrickplay = function() {
};
Player.fastForwardVideo = function() {
- if (this.trickPlayDirection == 1)
+ if (this.trickPlayDirection == 1) {
this.trickPlaySpeed = this.trickPlaySpeed * 2;
+ }
else {
// I am in rewind mode, thus decrease speed
this.trickPlaySpeed = this.trickPlaySpeed / 2;
@@ -385,6 +460,10 @@ Player.fastForwardVideo = function() {
}
}
+ if (Player.isRecording == true) {
+ if (this.trickPlaySpeed > 2)
+ this.trickPlaySpeed = 2;
+ }
if (this.trickPlaySpeed != 1) {
Main.log("Player.fastForwardVideo: updating display");
@@ -424,6 +503,13 @@ Player.RewindVideo = function() {
else
this.trickPlaySpeed = this.trickPlaySpeed * 2;
+ if (Player.isRecording == true) {
+ if (this.trickPlayDirection <0 )
+ Player.ResetTrickPlay();
+ return;
+// this.trickPlayDirection = 1;
+ }
+
if (this.trickPlaySpeed != 1) {
Display.setTrickplay (this.trickPlayDirection, this.trickPlaySpeed);
}
@@ -431,6 +517,7 @@ Player.RewindVideo = function() {
Player.ResetTrickPlay();
return;
}
+
Main.log("Rewind: Direction= " + ((this.trickPlayDirection == 1) ? "Forward": "Backward") + "trickPlaySpeed= " + this.trickPlaySpeed);
if (this.plugin.SetPlaybackSpeed(this.trickPlaySpeed * this.trickPlayDirection) == false) {
@@ -519,7 +606,8 @@ Player.onBufferingComplete = function() {
Display.bufferUpdate();
Display.showProgress();
- Player.setFullscreen();
+// Player.setFullscreen();
+// or I should set it according to the aspect ratio
Display.hide();
// Main.logToServer("onBufferingComplete ");
@@ -538,7 +626,6 @@ Player.OnCurrentPlayTime = function(time) {
Display.updateRecBar(Player.startTime, Player.duration);
}
Player.curPlayTimeStr = Display.durationString(Player.curPlayTime / 1000.0);
-
Display.updatePlayTime();
};
diff --git a/smarttv-client/Javascript/Server.js b/smarttv-client/Javascript/Server.js
index b60d666..0139582 100755
--- a/smarttv-client/Javascript/Server.js
+++ b/smarttv-client/Javascript/Server.js
@@ -9,10 +9,7 @@ var Server = {
Server.init = function()
{
- var success = true;
-
-// var splashElement = document.getElementById("splashStatus");
-// Display.putInnerHTML(splashElement, "Starting Up");
+ var success = true;
if (this.XHRObj) {
this.XHRObj.destroy();
@@ -27,7 +24,7 @@ Server.setSort = function (val) {
};
//---------------------------------------------
Server.fetchVideoList = function(url) {
-// Main.log ("***** getResume *****");
+
$.ajax({
url: url,
type : "GET",
@@ -50,12 +47,9 @@ Server.fetchVideoList = function(url) {
if (Main.state == Main.eLIVE) {
Epg.guidTitle[guid] = title;
-// Main.log("Server: Guid= " + guid +" -> " + Epg.guidTitle[guid]);
}
var title_list = title.split("~");
-// Main.log("Server.createVideoList: guid= " + guid + " link= " + link);
-// Main.log("Server.createVideoList: guid= " + guid + " startVal= " + startVal + " durVal= " +durVal);
Data.addItem( title_list, {link : link, prog: programme, desc: description, guid : guid, start: startVal,
dur: durVal, ispes : ispes, isnew : isnew, fps : fps});
@@ -87,143 +81,6 @@ Server.fetchVideoList = function(url) {
//---------------------------------------------
-/*
-Server.fetchVideoList = function(url) {
- Main.log("fetching Videos url= " + url);
- if (this.XHRObj == null) {
- this.XHRObj = new XMLHttpRequest();
- }
-
- if (this.XHRObj) {
- this.XHRObj.onreadystatechange = function()
- {
-// var splashElement = document.getElementById("splashStatus");
-// Display.putInnerHTML(splashElement, "State" + Server.XHRObj.readyState);
-
- if (Server.XHRObj.readyState == 4) {
- Server.createVideoList();
- }
- };
-
- this.XHRObj.open("GET", url, true);
- this.XHRObj.send(null);
- }
- else {
-// var splashElement = document.getElementById("splashStatus");
-// Display.putInnerHTML(splashElement, "Failed !!!" );
- Display.showPopup("Failed to create XHR");
-
- if (this.errorCallback != null) {
- this.errorCallback("ServerError");
- }
- }
-};
-
-Server.createVideoList = function() {
- Main.log ("creating Video list now");
- Main.logToServer("creating Video list now");
-
-
- if (this.XHRObj.status != 200) {
- if (this.errorCallback != null) {
- this.errorCallback(this.XHRObj.responseText);
- }
- }
- else
- {
- var xmlResponse = this.XHRObj.responseXML;
- if (xmlResponse == null) {
- Display.status("xmlResponse == null" );
- Display.showPopup("Error in XML File");
- if (this.errorCallback != null) {
- this.errorCallback("XmlError");
- }
- return;
- }
- var xmlElement = xmlResponse.documentElement;
-
- if (!xmlElement) {
- Display.status("Failed to get valid XML");
- Display.showPopup("Failed to get valid XML");
- return;
- }
- else
- {
- var items = xmlElement.getElementsByTagName("item");
- if (items.length == 0) {
- Display.showPopup("Something wrong. Response does not contain any item");
- Main.logToServer("Something wrong. Response does not contain any item");
-
- };
-
- for (var index = 0; index < items.length; index++) {
-
- var titleElement = items[index].getElementsByTagName("title")[0];
- var progElement = items[index].getElementsByTagName("programme")[0];
- var descriptionElement = items[index].getElementsByTagName("description")[0];
- var linkElement = items[index].getElementsByTagName("link")[0];
-// var startstrVal = "";
- var startVal =0;
- var durVal =0;
- var guid = "";
- var fps = -1;
- var ispes = "unknown";
- var isnew = "unknown";
- try {
-// startstrVal = items[index].getElementsByTagName("startstr")[0].firstChild.data;
- startVal = parseInt(items[index].getElementsByTagName("start")[0].firstChild.data);
- durVal = parseInt(items[index].getElementsByTagName("duration")[0].firstChild.data);
- guid= items[index].getElementsByTagName("guid")[0].firstChild.data;
- Main.log ("guid= " + items[index].getElementsByTagName("guid")[0].firstChild.data);
- }
- catch (e) {
- Main.log("ERROR: "+e);
- }
- try {
- ispes = items[index].getElementsByTagName("ispes")[0].firstChild.data;
- }
- catch (e) {}
- try {
- isnew = items[index].getElementsByTagName("isnew")[0].firstChild.data;
- }
- catch (e) {}
-
- try {
- fps = parseFloat(items[index].getElementsByTagName("fps")[0].firstChild.data);
- }
- catch (e) {}
- var desc = descriptionElement.firstChild.data;
-
- if (Main.state == Main.eLIVE) {
- Epg.guidTitle[guid] = titleElement.firstChild.data;
-// Main.log("Server: Guid= " + guid +" -> " + Epg.guidTitle[guid]);
- }
- if (titleElement && linkElement) {
- var title_list = titleElement.firstChild.data.split("~");
- Main.log("Server.createVideoList: guid= " + guid + " startVal= " + startVal + " durVal= " +durVal);
- Data.addItem( title_list, {link : linkElement.firstChild.data,
- prog: progElement.firstChild.data,
- desc: desc,
-// startstr: startstrVal,
- guid : guid,
- start: startVal,
- dur: durVal,
- ispes : ispes,
- isnew : isnew,
- fps : fps});
- }
-
- }
- Data.completed(this.doSort);
-
- if (this.dataReceivedCallback)
- {
- this.dataReceivedCallback();
- }
- }
- }
-};
-*/
Server.updateVdrStatus = function (){
Main.log ("get VDR Status");
@@ -242,7 +99,6 @@ Server.updateVdrStatus = function (){
free_str = free.toFixed(2);
unit = "TB";
}
-// Main.log ("free.length= " + free_str.length);
$("#logoDisk").text("Free: " +free_str + unit);
$("#selectDisk").text("Free: " +free_str + unit);
},
@@ -268,7 +124,6 @@ Server.getResume = function (guid) {
Main.log("resume val= " + resume_val );
Main.logToServer("resume val= " + resume_val );
Player.resumePos = resume_val;
-// Buttons.show();
Player.playVideo( resume_val);
}
else {
@@ -288,9 +143,6 @@ Server.getResume = function (guid) {
};
Server.saveResume = function() {
- //
-// var msg = "devid:" + Network.getMac() + "\n";
-// Player.curPlayTime = 15.4 * 1000;
var msg = "";
msg += "filename:" + Data.getCurrentItem().childs[Main.selectedVideo].payload.guid + "\n";
msg += "resume:"+ (Player.curPlayTime/1000) + "\n" ;
@@ -299,17 +151,9 @@ Server.saveResume = function() {
Main.logToServer("SaveResume Status= " + XHR.status );
}, "text");
-/* var XHRObj = new XMLHttpRequest();
- XHRObj.open("POST", Config.serverUrl + "/setResume.xml", true);
- XHRObj.send(msg);
- */
};
Server.deleteRecording = function(guid) {
-/* $.post(Config.serverUrl + "/deleteRecording.xml?id=" +guid, "", function(data, textStatus, XHR) {
- Main.logToServer("deleteRecording Status= " + XHR.status );
- }, "text");
-*/
Main.log("Server.deleteRecording guid=" + guid);
Main.logToServer("Server.deleteRecording guid=" + guid);
Notify.handlerShowNotify("Deleting...", false);
@@ -318,9 +162,6 @@ Server.deleteRecording = function(guid) {
url: Config.serverUrl + "/deleteRecording.xml?id=" +guid,
type : "POST",
success : function(data, status, XHR ) {
- // Show popup
- // delete from data
- //update vdrstatus
Notify.showNotify("Deleted", true);
Data.deleteElm(Main.selectedVideo);
if (Main.selectedVideo >= Data.getVideoCount())
diff --git a/smarttv-client/config.xml b/smarttv-client/config.xml
index ac5a7fa..a763e37 100755
--- a/smarttv-client/config.xml
+++ b/smarttv-client/config.xml
@@ -9,7 +9,7 @@
<BigThumbIcon>Images/icon/SmartTvWeb_115.png</BigThumbIcon>
<ListIcon>Images/icon/SmartTvWeb_85.png</ListIcon>
<BigListIcon>Images/icon/SmartTvWeb_95.png</BigListIcon>
- <ver>0.89</ver>
+ <ver>0.90</ver>
<mgrver></mgrver>
<fullwidget>y</fullwidget>
<movie>y</movie>