summaryrefslogtreecommitdiff
path: root/smarttv-client
diff options
context:
space:
mode:
authorthlo <smarttv640@gmail.com>2013-02-03 20:36:52 +0100
committerthlo <t.lohmar@gmx.de>2013-02-03 20:36:52 +0100
commit3488d6aa8a59441491cd876f7121d4d2cdb7913c (patch)
tree359de84a1148d9c2babc2071b8967a210fd49aff /smarttv-client
parentf3f6a509b603485b3472beb980d241010dd1fbe1 (diff)
downloadvdr-plugin-smarttvweb-3488d6aa8a59441491cd876f7121d4d2cdb7913c.tar.gz
vdr-plugin-smarttvweb-3488d6aa8a59441491cd876f7121d4d2cdb7913c.tar.bz2
4:3 Button.
Trickplay for PES recordings and other files (no TS recordings yet). Delete Recordings. Parsing RSS enclosure url.
Diffstat (limited to 'smarttv-client')
-rwxr-xr-xsmarttv-client/CSS/Main.css24
-rw-r--r--smarttv-client/Javascript/Buttons.js349
-rwxr-xr-xsmarttv-client/Javascript/Data.js10
-rwxr-xr-xsmarttv-client/Javascript/Display.js20
-rwxr-xr-xsmarttv-client/Javascript/Main.js129
-rw-r--r--smarttv-client/Javascript/Notify.js28
-rwxr-xr-xsmarttv-client/Javascript/Player.js161
-rwxr-xr-xsmarttv-client/Javascript/Server.js138
-rwxr-xr-xsmarttv-client/config.xml2
-rwxr-xr-xsmarttv-client/index.html18
10 files changed, 684 insertions, 195 deletions
diff --git a/smarttv-client/CSS/Main.css b/smarttv-client/CSS/Main.css
index cb6ac5e..5b8f829 100755
--- a/smarttv-client/CSS/Main.css
+++ b/smarttv-client/CSS/Main.css
@@ -42,8 +42,9 @@ body {
left: 0px; top: 0px;
width: 960px; height: 540px;
background: url("../Images/selectScreen-bg.png");
+ background: radial-gradient(ellipse at 80% 80%, #c5deea 0%,#8abbd7 31%,#066dab 100%);
background: -webkit-radial-gradient(80% 80%, ellipse cover, rgba(197,222,234,1) 0%,rgba(138,187,215,1) 31%,rgba(6,109,171,1) 100%);
-}
+ }
#selectView {
position: absolute;
@@ -52,11 +53,13 @@ body {
border-style:solid;
border-width:2px;
font-size:16px;
+ border-radius: 7px;
-webkit-border-radius: 7px;
padding-top:5px;
padding-left:20px;
padding-right:20px;
background: rgba(6,109,171,1) 100%;
+ background: linear-gradient(135deg, #1e5799 0%,#2989d8 41%,#7db9e8 100%);
background: -webkit-linear-gradient(-45deg, #1e5799 0%,#2989d8 41%,#7db9e8 100%);
-webkit-box-shadow:3px 3px 7px 4px rgba(0,0,0, 0.5);
}
@@ -111,6 +114,25 @@ body {
background-color: rgba(0,0,0,0.5);
}
+#notify {
+ position: absolute;
+ display: none;
+ left: 70%; top: 10px;
+ width: 20%; height: 6%;
+ -webkit-border-radius: 1em;
+ -webkit-box-shadow:3px 3px 7px 4px rgba(0,0,0, 0.5);
+ border-style:solid;
+ border-width:2px;
+ font-size:16px;
+
+ padding-top:20px;
+ padding-left:20px;
+ padding-right:20px;
+ background-color: rgba(0,0,0,0.5);
+ z-index:20;
+
+}
+
#popup{
position: absolute;
display: none;
diff --git a/smarttv-client/Javascript/Buttons.js b/smarttv-client/Javascript/Buttons.js
index 8edab38..5c5b3ca 100644
--- a/smarttv-client/Javascript/Buttons.js
+++ b/smarttv-client/Javascript/Buttons.js
@@ -1,7 +1,8 @@
var Buttons = {
created: false,
btnSelected : 0,
- btnMax : 1
+ btnMax : 2,
+ prButton : null
};
/*
@@ -9,94 +10,237 @@ var Buttons = {
*/
Buttons.init = function (){
if (this.created == false) {
- Buttons.createButtons();
- $("#pr-popup").hide();
+ Buttons.createStyleSheet ();
+ Buttons.createPrcButtons();
+ $("#prc-buttons").hide();
+ Buttons.createYnButtons();
+ $("#yn-buttons").hide();
+
this.created = true;
- }
+ this.prButton = new ButtonHandler();
+ this.prButton.hndlName = "prcButtons";
+ this.prButton.enterCallback = Buttons.prcEnterCallback;
+ this.prButton.btnMax = 2;
+ this.prButton.elmName = "#pr-btn-";
+ this.prButton.masterElm = "#prc-buttons";
+ this.prButton.inputElm = "#prc-buttons-anchor";
+
+ var elem = document.getElementById('prc-buttons-anchor');
+ elem.setAttribute('onkeydown', 'Buttons.prButton.onInput();');
+
+ this.ynButton = new ButtonHandler();
+ this.ynButton.hndlName = "ynButtons";
+ this.ynButton.enterCallback = Buttons.ynEnterCallback;
+ this.ynButton.btnMax = 1;
+ this.ynButton.elmName = "#yn-btn-";
+ this.ynButton.masterElm = "#yn-buttons";
+ this.ynButton.inputElm = "#yn-buttons-anchor";
+
+ elem = document.getElementById('yn-buttons-anchor');
+ elem.setAttribute('onkeydown', 'Buttons.ynButton.onInput();');
+ // $("#prc-buttons-anchor").attr("onkeydown", "Button.prButton.onInput();");
+ }
+};
+
+Buttons.ynEnterCallback = function () {
+ Main.log("Buttons.ynEnterCallback btnSelected= " + Buttons.ynButton.btnSelected);
+ switch(Buttons.ynButton.btnSelected){
+ case 0:
+ Main.logToServer("ynButtons: No -> Don't delete");
+ break;
+ case 1:
+ Main.logToServer("ynButtons: Yes "+Player.resumePos);
+ Server.deleteRecording(Player.guid);
+ break;
+ }
+ Buttons.ynHide();
+ };
+
+Buttons.prcEnterCallback = function () {
+ Main.log("Buttons.prcEnterCallback");
+
+ switch(Buttons.prButton.btnSelected){
+ case 0:
+ Main.logToServer("prcButtons: Play from start");
+ Display.hide();
+ Display.showProgress();
+ Player.playVideo(-1);
+ Buttons.prcHide();
+ break;
+ case 1:
+ Main.logToServer("prcButtons: Resume from "+Player.resumePos);
+// Player.playVideo(Player.resumePos);
+ Display.hide();
+ Display.showProgress();
+ Spinner.show();
+ Server.getResume(Player.guid);
+ Buttons.prcHide();
+ break;
+ case 2:
+ //delete
+ Buttons.prcHide();
+ Buttons.ynShow();
+
+ break;
+ }
};
Buttons.show = function () {
Main.log("Buttons.show()");
- $("#pr-popup").show();
- $("#pr-popup-anchor").focus();
-
- Buttons.reset ();
+ this.prButton.show();
+ this.prButton.reset();
};
-
Buttons.hide = function () {
- $("#pr-popup").hide();
- $("#pr-popup-anchor").blur();
+ this.prButton.hide();
+// $("#prc-buttons-anchor").blur();
Main.enableKeys();
};
-Buttons.createButtons= function () {
- var p_width = $("body").outerWidth();
- var p_height = $("body").outerHeight();
-
+Buttons.prcShow = function () {
+ Main.log("Buttons.show()");
+ this.prButton.show();
+ this.prButton.reset();
+};
+
+Buttons.prcHide = function () {
+ this.prButton.hide();
+// $("#prc-buttons-anchor").blur();
+ Main.enableKeys();
+};
+
+Buttons.ynShow = function () {
+ Main.log("Buttons.ynShow()");
+ this.ynButton.show();
+ this.ynButton.reset();
+};
+
+Buttons.ynHide = function () {
+ this.ynButton.hide();
+ Main.enableKeys();
+};
+
+Buttons.createStyleSheet = function () {
var sheet = $("<style>");
sheet.attr({type : 'text/css',
innerHTML : '\
- #pr-popup { display:table; width:40%; height: 30%; position: absolute; text-align:center; border-width:1px;\
+ #prc-buttons { width:40%; height: 30%; position: absolute; text-align:center; border-width:1px;\
+ background:rgba(0,0,139, 0.8);border-style:solid;border-width:1px;border-radius:15px;\
+ -webkit-box-shadow:3px 3px 7px 4px rgba(0,0,0, 0.5);z-index:15;}\
+ #yn-buttons { width:40%; height: 30%; position: absolute; text-align:center; border-width:1px;\
background:rgba(0,0,139, 0.8);border-style:solid;border-width:1px;border-radius:15px;\
- -webkit-box-shadow:3px 3px 7px 4px rgba(0,0,0, 0.5);}\
- .pr-btn { display:inline-block; \
- margin-left: 10px; \
+ -webkit-box-shadow:3px 3px 7px 4px rgba(0,0,0, 0.5);z-index:15;}\
+ .pr-btn { margin-left: 10px; \
padding: 10px 10px 10px 10px;\
border-radius:10px; \
font-size:16px;\
border-style:solid;\
border-width:1px;\
background: transparent;}\
- .pr-btn-pressed {display:inline-block; \
- margin-left: 10px; \
+ .pr-btn-pressed {margin-left: 10px; \
padding: 10px 10px 10px 10px;\
border-radius:10px; \
font-size:16px;\
border-style:solid;\
border-width:1px;\
- background: "white";\
- background: "-webkit-linear-gradient(top, rgba(246,248,249,1) 0%,rgba(229,235,238,1) 50%,rgba(215,222,227,1) 51%,rgba(245,247,249,1) 100%)";\
+ background-color: "white";\
+ background-color: "-webkit-linear-gradient(top, rgba(246,248,249,1) 0%,rgba(229,235,238,1) 50%,rgba(215,222,227,1) 51%,rgba(245,247,249,1) 100%)";\
}\
.pr-helpbar {display:inline-block;}\
}'});
+
$('body').append(sheet);
+};
-// var domNode = $("<div>", {id: "pr-popup", "onkeydown":"Buttons.onInput();"});
-
- var row = $('<div>');
- row.css({"height":"80%", "display":"table-row", "vertical-align":"middle"});
- var cell = $("<div>");
- cell.css({"display":"table-cell", "vertical-align":"middle"});
- cell.appendTo(row);
+Buttons.createPrcButtons= function () {
+ var p_width = $("body").outerWidth();
+ var p_height = $("body").outerHeight();
+
+
+ var table = $("<table>", {style:"height:100%;width:100%;"});
+ $("#prc-buttons").append(table);
+
+ var tbody = $("<tbody>", {style:"height:100%;width:100%;"});
+ table.append(tbody);
+
+
+ var row = $("<tr>", {style: "width:100%; align:center"});
+
+ var cell = $("<td>");
+ cell.css("align","right");
$("<button>", {id : "pr-btn-0", text: "Play", class: "pr-btn"}).appendTo(cell);
+ row.append(cell);
+ cell = $("<td>", {style :"height:80%"});
$("<button>", {id : "pr-btn-1", text: "Resume", class: "pr-btn"}).appendTo(cell);
- $("#pr-popup").append(row);
+ row.append(cell);
+ cell = $("<td>", {style :"height:80%"});
+ $("<button>", {id : "pr-btn-2", text: "Delete", class: "pr-btn"}).appendTo(cell);
+ row.append(cell);
+
+ tbody.append(row);
+
+ $("#prc-buttons").css({"left": ((p_width - $("#prc-buttons").outerWidth()) /2) +"px", "top": ((p_height - $("#prc-buttons").outerHeight()) /2) +"px" });
+
+ row = $("<tr>", {style: "width:100%; align:center"});
+ tbody.append(row);
+
+ cell = $("<td>");
+ row.append(cell); // Helpbar row
+ Buttons.addHelpItem(cell, "Images/helpbar/help_lr.png", "Select");
+
+ cell = $("<td>");
+ row.append(cell);
+ Buttons.addHelpItem(cell, "Images/helpbar/help_enter.png", "OK");
+
+ cell = $("<td>");
+ row.append(cell);
+ Buttons.addHelpItem(cell, "Images/helpbar/help_back.png", "Cancel");
+
+};
+
+Buttons.createYnButtons= function () {
+ var p_width = $("body").outerWidth();
+ var p_height = $("body").outerHeight();
+
- $("#pr-popup").css({"left": ((p_width - $("#pr-popup").outerWidth()) /2) +"px", "top": ((p_height - $("#pr-popup").outerHeight()) /2) +"px"});
+ var table = $("<table>", {style:"height:100%;width:100%;"});
+ $("#yn-buttons").append(table);
- row = $('<div>', {style: "display:table-row; vertical-align:bottom; text-align:center"});
-// row.css({"display":"table-row", "vertical-align":"bottom"});
- $("#pr-popup").append(row);
- var elm = $("<div>", {class: "pr-helpbar"});
- elm.css({"display":"table-cell", "vertical-align":"bottom"});
- elm.appendTo(row);
- Buttons.addHelpItem(elm, "Images/helpbar/help_lr.png", "Select");
- Buttons.addHelpItem(elm, "Images/helpbar/help_enter.png", "OK");
- Buttons.addHelpItem(elm, "Images/helpbar/help_back.png", "Cancel");
+ var tbody = $("<tbody>", {style:"height:100%;width:100%;"});
+ table.append(tbody);
+ var row = $("<tr>", {style: "width:100%; align:center"});
- // row.appendTo(domNode);
-// $('body').append(domNode);
+ var cell = $("<td>", {style :"height:80%; width:50%"});
+ cell.css("align","right");
+ $("<button>", {id : "yn-btn-1", text: "Yes", class: "pr-btn"}).appendTo(cell);
+ row.append(cell);
+ cell = $("<td>", {style :"height:80%; width:50%"});
+ $("<button>", {id : "yn-btn-0", text: "No", class: "pr-btn"}).appendTo(cell);
+ row.append(cell);
- // Center
-// domNode.css({"left": ((p_width - domNode.outerWidth()) /2) +"px", "top": ((p_height - domNode.outerHeight()) /2) +"px"});
+ tbody.append(row);
+
+ $("#yn-buttons").css({"left": ((p_width - $("#yn-buttons").outerWidth()) /2) +"px", "top": ((p_height - $("#yn-buttons").outerHeight()) /2) +"px" });
+
+ row = $("<tr>", {style: "width:100%; align:center"});
+ tbody.append(row);
+
+ cell = $("<td>");
+ row.append(cell); // Helpbar row
+ Buttons.addHelpItem(cell, "Images/helpbar/help_lr.png", "Select");
+ cell = $("<td>");
+ row.append(cell);
+ Buttons.addHelpItem(cell, "Images/helpbar/help_enter.png", "OK");
+ cell = $("<td>");
+ row.append(cell);
+ Buttons.addHelpItem(cell, "Images/helpbar/help_back.png", "Cancel");
};
+
Buttons.addHelpItem = function(elm, url, msg) {
-// var hb_elm = $("<td>");
var hb_elm = $("<div>");
hb_elm.css({"display":"inline-block", "padding-right":"10px"});
@@ -107,68 +251,99 @@ Buttons.addHelpItem = function(elm, url, msg) {
};
-Buttons.reset = function () {
- for (var i =0; i <= Buttons.btnMax; i++) {
- $("#pr-btn-" + i).removeClass('pr-btn-pressed').addClass('pr-btn');
+
+
+/*
+Principle:
+The HTML DOM tree is created outside
+The element name is formed in such a way that the btnSelected is appended.
+
+How to handle keyboard input?
+
+How to do the onEnter Callback?
+*/
+
+function ButtonHandler() {
+ this.hndlName ="";
+ this.btnSelected = 0;
+ this.btnMax = 2;
+ this.elmName = "#pr-btn-";
+ this.masterElm = "#prc-buttons";
+ this.inputElm = "#prc-buttons-anchor";
+ this.enterCallback = null;
+ this.returnCallback = null;
+};
+
+ButtonHandler.prototype.show = function () {
+ Main.log(this.hndlName + ".show(): masterElm= " +this.masterElm + " inputElm= " + this.inputElm);
+ $(this.masterElm).show();
+ $(this.inputElm).focus();
+ this.reset ();
+};
+
+ButtonHandler.prototype.hide = function () {
+ Main.log(this.hndlName + ".hide(): masterElm= " +this.masterElm + " inputElm= " + this.inputElm);
+ $(this.masterElm).hide();
+ $(this.inputElm).blur();
+ Main.enableKeys();
+};
+
+
+ButtonHandler.prototype.reset = function () {
+ this.btnSelected = 0;
+ for (var i =0; i <= this.btnMax; i++) {
+ $(this.elmName + i).removeClass('pr-btn-pressed').addClass('pr-btn');
}
- $("#pr-btn-0").removeClass('pr-btn').addClass('pr-btn-pressed');
+ $(this.elmName+"0").removeClass('pr-btn').addClass('pr-btn-pressed');
};
-Buttons.selectBtnLeft = function () {
- var btnname = "#pr-btn-"+Buttons.btnSelected;
- Main.log("BtnLeft: Old: " +Buttons.btnSelected + " btn= "+btnname);
+
+ButtonHandler.prototype.selectBtnLeft = function () {
+ var btnname = this.elmName+this.btnSelected;
+ Main.log(this.hndlName + "-BtnLeft: Old: " +this.btnSelected + " btn= "+btnname);
$(btnname).removeClass('pr-btn-pressed').addClass('pr-btn');
- if (Buttons.btnSelected == 0)
- Buttons.btnSelected = Buttons.btnMax;
+ if (this.btnSelected == 0)
+ this.btnSelected = this.btnMax;
else
- Buttons.btnSelected--;
- $("#pr-btn-" + Buttons.btnSelected).removeClass('pr-btn').addClass('pr-btn-pressed');
- Main.log("BtnLeft: New: " +Buttons.btnSelected);
+ this.btnSelected--;
+ $(this.elmName + this.btnSelected).removeClass('pr-btn').addClass('pr-btn-pressed');
+ Main.log(this.hndlName+"-BtnLeft: New: " +this.btnSelected);
};
-Buttons.selectBtnRight = function () {
- $("#pr-btn-" + Buttons.btnSelected).removeClass('pr-btn-pressed').addClass('pr-btn');
- if (Buttons.btnSelected == Buttons.btnMax)
- Buttons.btnSelected = 0;
+ButtonHandler.prototype.selectBtnRight = function () {
+ $(this.elmName + this.btnSelected).removeClass('pr-btn-pressed').addClass('pr-btn');
+ if (this.btnSelected == this.btnMax)
+ this.btnSelected = 0;
else
- Buttons.btnSelected++;
- $("#pr-btn-" + Buttons.btnSelected).removeClass('pr-btn').addClass('pr-btn-pressed');
+ this.btnSelected++;
+ $(this.elmName + this.btnSelected).removeClass('pr-btn').addClass('pr-btn-pressed');
};
-Buttons.onInput = function () {
+ButtonHandler.prototype.onInput = function () {
var keyCode = event.keyCode;
-// alert("Buttons Input= " + keyCode);
switch(keyCode) {
case tvKey.KEY_LEFT:
- Main.log("Select Left");
- Buttons.selectBtnLeft();
+ Main.log(this.hndlName+"-Select Left");
+ this.selectBtnLeft();
break;
case tvKey.KEY_RIGHT:
- Main.log("Select Right");
- Buttons.selectBtnRight();
+ Main.log(this.hndlName+"-Select Right");
+ this.selectBtnRight();
break;
case tvKey.KEY_ENTER:
- Main.log("Enter");
- Display.hide();
- Display.showProgress();
- switch(Buttons.btnSelected){
- case 0:
- Main.logToServer("Buttons: Play from start");
- Player.playVideo(-1);
- break;
- case 1:
- Main.logToServer("Buttons: Resume from "+Player.resumePos);
-// Player.playVideo(Player.resumePos);
- Spinner.show();
- Server.getResume(Player.guid);
- break;
- }
- Buttons.hide();
+ if (this.enterCallback != null)
+ this.enterCallback();
+ else
+ Main.log(this.hndlName+"-Enter: enterCallback is NULL");
+
break;
case tvKey.KEY_RETURN:
Buttons.hide();
+ if (this.returnCallback != null)
+ this.returnCallback();
break;
}
widgetAPI.blockNavigation(event);
- }; \ No newline at end of file
+ };
+
diff --git a/smarttv-client/Javascript/Data.js b/smarttv-client/Javascript/Data.js
index 03b7a31..edc2a05 100755
--- a/smarttv-client/Javascript/Data.js
+++ b/smarttv-client/Javascript/Data.js
@@ -4,6 +4,12 @@ var Data =
folderList : [],
};
+Array.prototype.remove = function(from, to) {
+ var rest = this.slice((to || from) + 1 || this.length);
+ this.length = from < 0 ? this.length + from : from;
+ return this.push.apply(this, rest);
+};
+
Data.reset = function() {
this.assets = null;
this.assets = new Item;
@@ -71,7 +77,9 @@ Data.getVideoCount = function() {
return this.folderList[this.folderList.length-1].item.childs.length;
};
-
+Data.deleteElm = function (pos) {
+ Data.getCurrentItem().childs.remove(pos);
+};
//-----------------------------------------
function Item() {
this.title = "root";
diff --git a/smarttv-client/Javascript/Display.js b/smarttv-client/Javascript/Display.js
index 14cc873..97dae0c 100755
--- a/smarttv-client/Javascript/Display.js
+++ b/smarttv-client/Javascript/Display.js
@@ -594,6 +594,7 @@ Display.setOlTitle = function (title) {
};
Display.resetStartStop = function () {
+ Main.log("Display.resetStartStop");
Display.olStartStop = "";
Display.hideOlStartStop();
$("#olStartStop").text("");
@@ -627,8 +628,10 @@ Display.setStartStop = function(start, stop) {
};
Display.setSkipDuration = function(duration) {
+ Main.log("Display.setSkipDuration: duration= " +duration);
this.olStartStop = "";
- Display.showOlStartStop();
+// if (this.olStartStop == "")
+ Display.showOlStartStop();
this.olStartStop = duration;
@@ -639,6 +642,21 @@ Display.setSkipDuration = function(duration) {
*/
};
+Display.setTrickplay = function(direction, multiple) {
+ this.olStartStop = "";
+// if (this.olStartStop == "")
+ Display.showOlStartStop();
+
+ this.olStartStop = multiple;
+
+ $("#olStartStop").text( ((direction == 1) ? "FF": "RW") + ": " + Display.olStartStop+"x");
+
+/* var elm = document.getElementById("olStartStop");
+ Display.putInnerHTML(elm, "Next Skip: " + Display.olStartStop+"sec");
+ */
+};
+
+
// Player.OnCurrentPlayTime
Display.updatePlayTime = function() {
// Player.curPlayTimeStr = Display.getHumanTimeRepresentation(Player.curPlayTime);
diff --git a/smarttv-client/Javascript/Main.js b/smarttv-client/Javascript/Main.js
index 05099b5..7ce11fd 100755
--- a/smarttv-client/Javascript/Main.js
+++ b/smarttv-client/Javascript/Main.js
@@ -97,6 +97,7 @@ Main.onLoad = function() {
});
Display.init();
Display.selectItem(document.getElementById("selectItem1"));
+ Notify.init();
Spinner.init();
Helpbar.init();
Options.init();
@@ -136,7 +137,7 @@ Main.init = function () {
Server.dataReceivedCallback = function() {
/* Use video information when it has arrived */
Display.setVideoList(Main.selectedVideo, Main.selectedVideo);
-
+ Spinner.hide();
Display.show();
// if (Player.isLive == true) {
if (Main.state == Main.eLIVE) {
@@ -156,20 +157,26 @@ Main.init = function () {
// 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");
/*
*
* Fetch JS file
+ */
+
+ /*
+ Read widget conf. find the file to log
xhttp=new XMLHttpRequest();
- xhttp.open("GET","$MANAGER_WIDGET/Common/API/Plugin.js",false);
+ xhttp.open("GET","$MANAGER_WIDGET/Common/webapi/1.0/webapis.js",false);
xhttp.send("");
xmlDoc=xhttp.responseText;
Main.logToServer (xmlDoc);
-*/
-
+ */
};
Main.log = function (msg) {
@@ -263,33 +270,44 @@ Main.recordingsSelected = function() {
Display.show();
};
Server.errorCallback = function (msg) {
- Display.showPopup(msg);
- Main.changeState(0);
+ Server.errorCallback = Main.serverError;
};
Player.isLive = false;
Server.setSort(true);
- if (Config.format == "") {
- Server.fetchVideoList(Config.serverUrl + "/recordings.xml?model=samsung"); /* Request video information from server */
+/* if (Config.format == "") {
+ Server.fetchVideoList(Config.serverUrl + "/recordings.xml?model=samsung");
Main.log("fetchVideoList from: " + Config.serverUrl + "/recordings.xml?model=samsung");
}
else {
Main.logToServer("Using format " + Config.format);
if (Config.format == "")
- Server.fetchVideoList(Config.serverUrl + "/recordings.xml?model=samsung&has4hd=false"); /* Request video information from server */
+ Server.fetchVideoList(Config.serverUrl + "/recordings.xml?model=samsung&has4hd=false");
else
- Server.fetchVideoList(Config.serverUrl + "/recordings.xml?model=samsung&has4hd=false&type="+Config.format); /* Request video information from server */
+ Server.fetchVideoList(Config.serverUrl + "/recordings.xml?model=samsung&has4hd=false&type="+Config.format);
}
+ */
+ Spinner.show();
+ Server.fetchVideoList(Config.serverUrl + "/recordings.xml"); /* Request video information from server */
+ Main.log("fetchVideoList from: " + Config.serverUrl + "/recordings.xml");
};
Main.serverError = function(errorcode) {
- if (Server.retries == 0) {
+ if (Server.retries < 2) {
switch (this.state) {
- case 1: // live
+ 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() {
@@ -299,6 +317,7 @@ Main.liveSelected = 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 */
};
@@ -314,6 +333,7 @@ Main.mediaSelected = function() {
};
Player.isLive = false;
Server.setSort(true);
+ Spinner.show();
Server.fetchVideoList(Config.serverUrl + "/media.xml"); /* Request video information from server */
};
@@ -375,7 +395,8 @@ Main.playItem = function (url) {
var now = Display.GetEpochTime();
document.getElementById("olRecProgressBar").style.display="none";
-
+ Player.mFormat = Player.eUND; // default val
+
switch (this.state) {
case Main.eLIVE:
// Live
@@ -400,9 +421,8 @@ Main.playItem = function (url) {
Display.resetStartStop();
// Main.getResume(Data.getCurrentItem().childs[Main.selectedVideo].payload.guid);
- Player.setVideoURL( Data.getCurrentItem().childs[Main.selectedVideo].payload.link);
- Player.guid = Data.getCurrentItem().childs[Main.selectedVideo].payload.guid;
-
+ var url_ext = "";
+ Player.mFormat = Player.ePDL;
// Server.getResume(Player.guid);
Player.setCurrentPlayTimeOffset(0);
@@ -413,6 +433,20 @@ Main.playItem = function (url) {
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";
+ }
+ 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! ***");
@@ -420,16 +454,20 @@ Main.playItem = function (url) {
Player.startTime = start_time;
Player.duration = duration;
document.getElementById("olRecProgressBar").style.display="block";
-
Display.updateRecBar(start_time, duration);
}
else {
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);
- if (Data.getCurrentItem().childs[Main.selectedVideo].payload.isnew == "false") {
+ Buttons.show();
+/* if (Data.getCurrentItem().childs[Main.selectedVideo].payload.isnew == "false") {
Buttons.show();
}
else {
@@ -438,11 +476,12 @@ Main.playItem = function (url) {
Player.playVideo(-1);
}
-
+*/
break;
case Main.eMED:
Display.hide();
Display.showProgress();
+ Player.mFormat = Player.ePDL;
Player.setCurrentPlayTimeOffset(0);
Player.isLive = false;
@@ -844,6 +883,7 @@ cPlayStateKeyHndl.prototype.handleKeyDown = function (event) {
}
Main.log(this.handlerName+": Key pressed: " + Main.getKeyCode(keyCode));
+ Main.logToServer(this.handlerName+": Key pressed: " + Main.getKeyCode(keyCode));
switch(keyCode)
{
@@ -893,33 +933,53 @@ cPlayStateKeyHndl.prototype.handleKeyDown = function (event) {
Player.jumpToVideo(90);
break;
- case tvKey.KEY_FF:
+// case tvKey.KEY_FF:
case tvKey.KEY_RIGHT:
Main.log("Right: Skip Forward");
Display.showProgress();
- Player.skipForwardVideo();
+ if (Player.trickPlaySpeed != 1) {
+ Notify.showNotify("Trickplay!", true);
+ }
+ else
+ Player.skipForwardVideo();
break;
- case tvKey.KEY_RW:
+// case tvKey.KEY_RW:
case tvKey.KEY_LEFT:
Main.log("Left: Skip Backward");
Display.showProgress();
- Player.skipBackwardVideo();
+ if (Player.trickPlaySpeed != 1) {
+ Notify.showNotify("Trickplay!", true);
+ }
+ else
+ Player.skipBackwardVideo();
break;
/* Works only for progressive streams, not Adaptive HTTP */
-/* case tvKey.KEY_FF:
+ case tvKey.KEY_FF:
Main.log("FF");
Display.showProgress();
- Player.fastForwardVideo();
+ if (Player.isRecording == true) {
+ Notify.showNotify("Recording!!!", true);
+ }
+ else if (Player.mFormat != Player.ePDL )
+ Notify.showNotify("Not supported", true);
+ else
+ Player.fastForwardVideo();
break;
case tvKey.KEY_RW:
Main.log("RW");
Display.showProgress();
- Player.RewindVideo();
+ if (Player.isRecording == true) {
+ Notify.showNotify("Recording!!!", true);
+ }
+ else if (Player.mFormat != Player.ePDL )
+ Notify.showNotify("Not supported", true);
+ else
+ Player.RewindVideo();
break;
-*/
+
case tvKey.KEY_ENTER:
case tvKey.KEY_PLAY:
case tvKey.KEY_PANEL_ENTER:
@@ -927,8 +987,10 @@ cPlayStateKeyHndl.prototype.handleKeyDown = function (event) {
if(Player.getState() == Player.PAUSED) {
Player.resumeVideo();
}
- Player.ResetTrickPlay();
- if (Display.isProgressOlShown()) {
+ if (Player.isInTrickplay() == true) {
+ Player.ResetTrickPlay();
+ }
+ else if (Display.isProgressOlShown()) {
Player.adjustSkipDuration(0); // reset skip duration to default
Display.resetStartStop();
}
@@ -938,7 +1000,6 @@ cPlayStateKeyHndl.prototype.handleKeyDown = function (event) {
case tvKey.KEY_PANEL_RETURN:
case tvKey.KEY_STOP:
Main.log("STOP");
-// Player.setWindow();
Player.stopVideo();
widgetAPI.blockNavigation(event);
@@ -955,6 +1016,9 @@ cPlayStateKeyHndl.prototype.handleKeyDown = function (event) {
Player.adjustSkipDuration(2);
Display.showProgress();
break;
+ case tvKey.KEY_ASPECT:
+ Player.toggleAspectRatio();
+ break;
/* case tvKey.KEY_UP:
case tvKey.KEY_PANEL_VOL_UP:
case tvKey.KEY_VOL_UP:
@@ -1081,6 +1145,9 @@ cLivePlayStateKeyHndl.prototype.handleKeyDown = function (event) {
case tvKey.KEY_PAUSE:
Main.log("PAUSE");
break;
+ case tvKey.KEY_ASPECT:
+ Player.toggleAspectRatio();
+ break;
/* case tvKey.KEY_UP:
case tvKey.KEY_PANEL_VOL_UP:
diff --git a/smarttv-client/Javascript/Notify.js b/smarttv-client/Javascript/Notify.js
new file mode 100644
index 0000000..0ebf857
--- /dev/null
+++ b/smarttv-client/Javascript/Notify.js
@@ -0,0 +1,28 @@
+var Notify = {
+ notifyOlHandler : null
+};
+
+
+Notify.init = function () {
+ this.notifyOlHandler = new OverlayHandler("NotifyHndl");
+ this.notifyOlHandler.init(Notify.handlerShowNotify, Notify.handlerHideNotify);
+
+};
+
+
+Notify.showNotify = function (msg, timer) {
+ $("#notify").text(msg);
+ if (timer == true)
+ this.notifyOlHandler.show();
+ else
+ $("#notify").show();
+};
+
+Notify.handlerShowNotify = function () {
+ $("#notify").show();
+};
+
+Notify.handlerHideNotify = function () {
+ $("#notify").hide();
+};
+
diff --git a/smarttv-client/Javascript/Player.js b/smarttv-client/Javascript/Player.js
index 4105ba9..2770d1a 100755
--- a/smarttv-client/Javascript/Player.js
+++ b/smarttv-client/Javascript/Player.js
@@ -9,6 +9,12 @@ var Player =
mFrontPanel : null,
isLive : false,
isRecording : false,
+ mFormat : 0,
+ eUND : 0, // undefined
+ ePDL : 1,
+ eHLS : 2,
+ eHAS : 3,
+
url : "",
guid : "unknown",
@@ -33,12 +39,37 @@ var Player =
trickPlaySpeed : 1, // Multiple of 2 only.
trickPlayDirection : 1,
-
+
+
STOPPED : 0,
PLAYING : 1,
PAUSED : 2,
FORWARD : 3,
- REWIND : 4
+ REWIND : 4,
+
+ aspectRatio :0,
+
+ eASP16to9 :0,
+ eASP4to3 :1,
+
+ bufferStartTime : 0,
+ requestStartTime :0
+};
+
+Player.toggleAspectRatio = function () {
+ if (this.aspectRatio == this.eASP16to9) {
+ // Do 4 to 3
+ this.plugin.SetDisplayArea(120, 0, 720, 540);
+ // 4/3 = x/540
+ this.aspectRatio = this.eASP4to3;
+ Main.logToServer("Player.toggleAspectRatio: 4 by 3 Now");
+ }
+ else {
+ // do 16 to 9
+ Player.setFullscreen();
+ this.aspectRatio = this.eASP16to9;
+ Main.logToServer("Player.toggleAspectRatio: 16 by 9 Now");
+ }
};
Player.init = function() {
@@ -111,7 +142,7 @@ Player.setBuffer = function (){
var buffer_byte = (Config.totalBufferDuration * Config.tgtBufferBitrate) / 8.0;
var initial_buf = Config.initialBuffer;
if (Player.isLive == true)
- initial_buf = initial_buf *2;
+ initial_buf = initial_buf *4;
Main.logToServer("Seting TotalBufferSize to " + Math.round(buffer_byte) +"Byte dur= " +Config.totalBufferDuration + "sec init_buffer_perc= " +initial_buf +"% pend_buffer_perc= " +Config.pendingBuffer + "% initialTimeOut= " +Config.initialTimeOut + "sec");
@@ -145,7 +176,7 @@ Player.setBuffer = function (){
Player.setVideoURL = function(url) {
this.url = url;
- Main.log("URL = " + this.url);
+ Main.log("Player.setVideoURL: URL = " + this.url);
};
@@ -185,11 +216,17 @@ 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 );
- else
+ else {
+ Main.logToServer ("Player.playVideo: resume_pos= " +resume_pos);
this.plugin.ResumePlay(this.url, resume_pos);
+ }
+ if ((this.mFormat != this.ePDL) && (this.isLive == false)){
+ Notify.showNotify("No Trickplay", true);
+ }
Audio.plugin.SetSystemMute(false);
pluginObj.setOffScreenSaver();
this.pluginBD.DisplayVFD_Show(0100); // Play
@@ -215,13 +252,22 @@ Player.stopVideo = function() {
this.state = this.STOPPED;
Display.status("Stop");
this.plugin.Stop();
- Player.bufferState = 0;
+
// Display.setTime(0);
if (this.stopCallback) {
Main.log(" StopCallback");
this.stopCallback();
}
+
+ // Cleanup
+ Player.bufferState = 0;
+ Player.ResetTrickPlay();
+ Player.adjustSkipDuration(0);
+ Player.bufferState = 0;
+ Player.curPlayTime = 0;
+ Player.totalTime = -11;
+
Spinner.hide();
pluginObj.setOnScreenSaver();
this.pluginBD.DisplayVFD_Show(0101); // Stop
@@ -248,28 +294,38 @@ Player.jumpToVideo = function(percent) {
if (this.isLive == true) {
return;
}
+ Spinner.show();
+
Player.bufferState = 0;
Display.showProgress();
if (this.state != this.PLAYING) {
- Main.log ("Player not Playing");
+ Main.logToServer ("Player.jumpToVideo: Player not Playing");
return;
}
if (this.totalTime == -1 && this.isLive == false)
this.totalTime = this.plugin.GetDuration();
var tgt = Math.round(((percent-2)/100.0) * this.totalTime/ 1000.0);
+ var res = false;
+
+ 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);
- Main.log("jumpToVideo= " + percent + "% of " + (this.totalTime/1000) + "sec tgt = " + tgt + "sec curPTime= " + (this.curPlayTime/1000) +"sec");
+ 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");
- this.plugin.Stop();
-
// Display.showStatus();
- var res = this.plugin.ResumePlay(this.url, tgt );
+ // this.plugin.Stop();
+// var res = this.plugin.ResumePlay(this.url, tgt );
if (res == false)
Display.showPopup("ResumePlay ret= " + ((res == true) ? "True" : "False"));
};
Player.skipForwardVideo = function() {
+ this.requestStartTime = new Date().getTime();
var res = this.plugin.JumpForward(Player.skipDuration);
if (res == false) {
Display.showPopup("Jump Forward ret= " + ((res == true) ? "True" : "False"));
@@ -278,6 +334,7 @@ Player.skipForwardVideo = function() {
};
Player.skipBackwardVideo = function() {
+ this.requestStartTime = new Date().getTime();
var res = this.plugin.JumpBackward(Player.skipDuration);
if (res == false) {
Display.showPopup("Jump Backward ret= " + ((res == true) ? "True" : "False"));
@@ -311,56 +368,88 @@ Player.adjustSkipDuration = function (dir) {
};
};
+Player.isInTrickplay = function() {
+ return (this.trickPlaySpeed != 1) ? true: false;
+};
Player.fastForwardVideo = function() {
if (this.trickPlayDirection == 1)
this.trickPlaySpeed = this.trickPlaySpeed * 2;
else {
+ // I am in rewind mode, thus decrease speed
this.trickPlaySpeed = this.trickPlaySpeed / 2;
- if (this.trickPlaySpeed < 1) {
+ if (this.trickPlaySpeed <= 1) {
this.trickPlaySpeed = 1;
- this.trickPlayDirection = -1;
+ this.trickPlayDirection = 1;
}
}
-
+
+ if (this.trickPlaySpeed != 1) {
+ Main.log("Player.fastForwardVideo: updating display");
+ Display.setTrickplay (this.trickPlayDirection, this.trickPlaySpeed);
+ }
+ else {
+ Player.ResetTrickPlay();
+ return;
+ }
+
Main.log("FastForward: Direction= " + ((this.trickPlayDirection == 1) ? "Forward": "Backward") + "trickPlaySpeed= " + this.trickPlaySpeed);
Main.logToServer("FastForward: Direction= " + ((this.trickPlayDirection == 1) ? "Forward": "Backward") + "trickPlaySpeed= " + this.trickPlaySpeed);
if (this.plugin.SetPlaybackSpeed(this.trickPlaySpeed * this.trickPlayDirection) == false) {
Display.showPopup("trick play returns false. Reset Trick-Play" );
- this.trickPlaySpeed = 1;
- this.trickPlayDirection = 1;
+ Player.ResetTrickPlay();
+// this.trickPlaySpeed = 1;
+// this.trickPlayDirection = 1;
}
-
};
Player.RewindVideo = function() {
- if (this.trickPlayDirection == 1) {
+
+ if ((this.trickPlayDirection == 1) && (this.trickPlaySpeed == 1)){
+ this.trickPlayDirection = -1;
+ this.trickPlaySpeed = this.trickPlaySpeed * 2;
+
+ }
+ else if (this.trickPlayDirection == 1) {
+ // I am in fast forward mode, so decrease
this.trickPlaySpeed = this.trickPlaySpeed / 2;
if (this.trickPlaySpeed < 1) {
this.trickPlaySpeed = 1;
- this.trickPlayDirection = 1;
+ this.trickPlayDirection = -1;
}
}
else
this.trickPlaySpeed = this.trickPlaySpeed * 2;
+ if (this.trickPlaySpeed != 1) {
+ Display.setTrickplay (this.trickPlayDirection, this.trickPlaySpeed);
+ }
+ else {
+ Player.ResetTrickPlay();
+ return;
+ }
+ Main.log("Rewind: Direction= " + ((this.trickPlayDirection == 1) ? "Forward": "Backward") + "trickPlaySpeed= " + this.trickPlaySpeed);
+
if (this.plugin.SetPlaybackSpeed(this.trickPlaySpeed * this.trickPlayDirection) == false) {
Display.showPopup("trick play returns false. Reset Trick-Play" );
- this.trickPlaySpeed = 1;
- this.trickPlayDirection = 1;
+ Player.ResetTrickPlay();
+// this.trickPlaySpeed = 1;
+// this.trickPlayDirection = 1;
}
+
Main.log("Rewind: Direction= " + ((this.trickPlayDirection == 1) ? "Forward": "Backward") + "trickPlaySpeed= " + this.trickPlaySpeed);
Main.logToServer("Rewind: Direction= " + ((this.trickPlayDirection == 1) ? "Forward": "Backward") + "trickPlaySpeed= " + this.trickPlaySpeed);
- if (this.plugin.SetPlaybackSpeed(this.trickPlaySpeed * this.trickPlayDirection) == false) {
+
+ /* if (this.plugin.SetPlaybackSpeed(this.trickPlaySpeed * this.trickPlayDirection) == false) {
Display.showPopup("trick play returns false. Reset Trick-Play" );
this.trickPlaySpeed = 1;
this.trickPlayDirection = 1;
}
-
+*/
};
Player.ResetTrickPlay = function() {
@@ -375,6 +464,12 @@ Player.ResetTrickPlay = function() {
}
}
+ if (Player.skipDuration != 30) {
+ Display.setSkipDuration(Player.skipDuration );
+ }
+ else {
+ Display.resetStartStop();
+ }
};
Player.getState = function() {
@@ -386,9 +481,14 @@ Player.getState = function() {
//------------------------------------------------
Player.onBufferingStart = function() {
- Main.logToServer("Buffer Start: " + Player.curPlayTime);
+ Main.logToServer("Buffer Start: cpt= " + (Player.curPlayTime/1000.0) +"sec");
Player.bufferStartTime = new Date().getTime();
+ if (this.requestStartTime != 0) {
+ Main.logToServer("Player.onBufferingStart Server RTT= " + (Player.bufferStartTime -this.requestStartTime ) + "ms");
+ this.requestStartTime = 0;
+ }
+
Spinner.show();
Player.bufferState = 0;
Display.bufferUpdate();
@@ -413,7 +513,7 @@ Player.onBufferingComplete = function() {
Display.hideStatus();
Spinner.hide();
- Main.logToServer("Buffer Completed - Buffering Duration= " + (new Date().getTime() - Player.bufferStartTime) + " ms");
+ Main.logToServer("onBufferingComplete cpt= " +(Player.curPlayTime/1000.0) +"sec - Buffering Duration= " + (new Date().getTime() - Player.bufferStartTime) + " ms");
Player.bufferState = 100;
Display.bufferUpdate();
@@ -422,7 +522,7 @@ Player.onBufferingComplete = function() {
Player.setFullscreen();
Display.hide();
- Main.logToServer("onBufferingComplete ");
+// Main.logToServer("onBufferingComplete ");
/* Player.pauseVideo();
window.setTimeout(Player.resumeVideo, 1000); */
};
@@ -445,17 +545,16 @@ Player.OnCurrentPlayTime = function(time) {
Player.OnStreamInfoReady = function() {
Main.log("*** OnStreamInfoReady ***");
- Main.logToServer("GetCurrentBitrates= " + Player.plugin.GetCurrentBitrates());
+// Main.logToServer("GetCurrentBitrates= " + Player.plugin.GetCurrentBitrates());
if ((Player.isLive == false) && (Player.isRecording == false)) {
Player.totalTime = Player.plugin.GetDuration();
}
// Player.curPlayTimeStr = Display.durationString(Player.totalTime / 1000.0);
Player.totalTimeStr =Display.durationString(Player.totalTime / 1000.0);
- var height = Player.plugin.GetVideoHeight();
- var width = Player.plugin.GetVideoWidth();
-// Display.showPopup("Resolution= " + height + " x " +width);
- Main.logToServer("Resolution= " + width + " x " + height );
+// var height = Player.plugin.GetVideoHeight();
+// var width = Player.plugin.GetVideoWidth();
+// Main.logToServer("Resolution= " + width + " x " + height );
};
Player.OnRenderingComplete = function() {
diff --git a/smarttv-client/Javascript/Server.js b/smarttv-client/Javascript/Server.js
index 3b3226f..b60d666 100755
--- a/smarttv-client/Javascript/Server.js
+++ b/smarttv-client/Javascript/Server.js
@@ -1,5 +1,4 @@
-var Server =
-{
+var Server = {
dataReceivedCallback : null,
errorCallback : null,
doSort : false,
@@ -26,7 +25,69 @@ Server.init = function()
Server.setSort = function (val) {
this.doSort = val;
};
+//---------------------------------------------
+Server.fetchVideoList = function(url) {
+// Main.log ("***** getResume *****");
+ $.ajax({
+ url: url,
+ type : "GET",
+ success : function(data, status, XHR ) {
+ Main.log("Server.fetchVideoList Success Response - status= " + status + " mime= " + XHR.responseType + " data= "+ data);
+
+ $(data).find("item").each(function () {
+ var title = $(this).find('title').text();
+// var link = $(this).find('link').text();
+ var link = $(this).find('enclosure').attr('url');
+ var guid = $(this).find('guid').text();
+ var programme = $(this).find('programme').text();
+ var description = $(this).find('description').text();
+ var startVal = parseInt($(this).find('start').text());
+ var durVal = parseInt($(this).find('duration').text());
+ var fps = parseFloat($(this).find('fps').text());
+ var ispes = $(this).find('ispes').text();
+ var isnew = $(this).find('isnew').text();
+// Main.log("Server.fetchVideoList: title= " + title + " start= " + startVal + " dur= " + durVal + " fps= " + fps);
+
+ 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});
+
+ }); // each
+
+ Data.completed(Server.doSort);
+
+ if (Server.dataReceivedCallback) {
+ Server.dataReceivedCallback();
+ }
+
+ },
+ error : function (jqXHR, status, error) {
+ Main.logToServer("Server.fetchVideoList Error Response - status= " + status + " error= "+ error);
+ Display.showPopup("Error with XML File: " + status);
+ Server.retries ++;
+ },
+ parsererror : function () {
+ Main.logToServer("Server.fetchVideoList parserError " );
+ Display.showPopup("Error in XML File");
+ Server.retries ++;
+ if (Server.errorCallback != null) {
+ Server.errorCallback("XmlError");
+ }
+
+ }
+ });
+};
+
+//---------------------------------------------
+/*
Server.fetchVideoList = function(url) {
Main.log("fetching Videos url= " + url);
if (this.XHRObj == null) {
@@ -113,6 +174,7 @@ Server.createVideoList = function() {
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);
@@ -127,7 +189,7 @@ Server.createVideoList = function() {
catch (e) {}
try {
- fps = parseInt(items[index].getElementsByTagName("fps")[0].firstChild.data);
+ fps = parseFloat(items[index].getElementsByTagName("fps")[0].firstChild.data);
}
catch (e) {}
var desc = descriptionElement.firstChild.data;
@@ -138,6 +200,7 @@ Server.createVideoList = function() {
}
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,
@@ -155,11 +218,12 @@ Server.createVideoList = function() {
if (this.dataReceivedCallback)
{
- this.dataReceivedCallback(); /* Notify all data is received and stored */
+ this.dataReceivedCallback();
}
}
}
};
+*/
Server.updateVdrStatus = function (){
Main.log ("get VDR Status");
@@ -213,41 +277,6 @@ Server.getResume = function (guid) {
Player.playVideo(-1);
}
-/* var xmlResponse = XHR.responseXML;
- if (xmlResponse == null) {
- Main.logToServer("Resume: xmlResponse is null");
- Display.hide();
- Display.showProgress();
- Player.playVideo();
- }
- var xmlElement = xmlResponse.documentElement;
- if (!xmlElement) {
- Main.logToServer("Resume: Dont get xml");
- Display.hide();
- Display.showProgress();
- Player.playVideo();
- }
- var xml_str = (new XMLSerializer()).serializeToString(xmlElement);
- Main.logToServer(" XML Response= " + xml_str + " NodeType= " + xmlElement.nodeType);
- Main.logToServer("xmlElement.firstChild.nodeType= " + xmlElement.firstChild.nodeType);
- Main.logToServer("xmlElement.firstChild.nodeName= " + xmlElement.firstChild.nodeName);
- Main.logToServer("xmlElement.firstChild.nodeValue= " + xmlElement.firstChild.nodeValue);
- var resume_val = -1.0;
- try {
- resume_val = parseFloat(xmlElement.firstChild.nodeValue);
- Main.log("resume val= " + resume_val );
- Main.logToServer("resume val= " + resume_val );
- Player.resumePos = resume_val;
-// Buttons.show();
- Player.playVideo( resume_val);
- }
- catch (e) {
- Main.log("Resume Parsing Error: " +e);
- Display.hide();
- Display.showProgress();
- Player.playVideo(-1);
- }
- */
},
error : function (jqXHR, status, error) {
Main.log("**** Resome Error Response - status= " + status + " error= "+ error);
@@ -276,4 +305,35 @@ Server.saveResume = function() {
*/
};
+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);
+ $.ajax({
+ 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())
+ Main.selectedVideo = Data.getVideoCount() -1;
+ Server.updateVdrStatus();
+ Display.setVideoList(Main.selectedVideo, (Main.selectedVideo - Display.currentWindow));
+ Main.logToServer("Server.deleteRecording: Success" );
+ },
+ error : function (XHR, status, error) {
+ Main.logToServer("Server.deleteRecording: Error" );
+
+ // show popup
+ Notify.showNotify("Error", true);
+ }
+ });
+};
diff --git a/smarttv-client/config.xml b/smarttv-client/config.xml
index 621d8c0..ac5a7fa 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.88</ver>
+ <ver>0.89</ver>
<mgrver></mgrver>
<fullwidget>y</fullwidget>
<movie>y</movie>
diff --git a/smarttv-client/index.html b/smarttv-client/index.html
index fb65aec..7661321 100755
--- a/smarttv-client/index.html
+++ b/smarttv-client/index.html
@@ -31,6 +31,7 @@
<script language="javascript" type="text/javascript" src="Javascript/Epg.js"></script>
<script language="javascript" type="text/javascript" src="Javascript/Spinner.js"></script>
<script language="javascript" type="text/javascript" src="Javascript/Buttons.js"></script>
+ <script language="javascript" type="text/javascript" src="Javascript/Notify.js"></script>
<!-- Style sheets -->
<link rel="stylesheet" href="CSS/Main.css" type="text/css">
@@ -59,6 +60,11 @@
<!-- Layout begins -->
<div id="statusPopup"></div>
+ <div id="notify">
+ <div id="notifSpinner">
+ <img ></img>
+ </div>
+ </div>
<div id="popup"></div>
<div id="selectScreen">
<div id="selectView">
@@ -146,8 +152,14 @@
<div id="Spinning">
<img ></img>
</div>
- <div id="pr-popup">
- <a href='javascript:void(0);' id='pr-popup-anchor' onkeydown='Buttons.onInput();'></a>
+ <div id="prc-buttons">
+ <a href='javascript:void(0);' id='prc-buttons-anchor' ></a>
+ <!-- onkeydown='Buttons.onPrInput();'-->
</div>
- </body>
+ <div id="yn-buttons">
+ <a href='javascript:void(0);' id='yn-buttons-anchor' ></a>
+ <!-- onkeydown='Buttons.onPrInput();'-->
+ </div>
+
+ </body>
</html>