summaryrefslogtreecommitdiff
path: root/smarttv-client
diff options
context:
space:
mode:
authorthlo <smarttv640@gmail.com>2013-01-13 21:28:52 +0100
committerthlo <t.lohmar@gmx.de>2013-01-13 21:28:52 +0100
commit1f5fd1308b4518826408342f94d99ab6e10a4a71 (patch)
tree8bf2e407989e9f6e5bdc6ddda70d46d3f35786c8 /smarttv-client
parent66ffbf715e153129c282aaad20471293fd4da185 (diff)
downloadvdr-plugin-smarttvweb-1f5fd1308b4518826408342f94d99ab6e10a4a71.tar.gz
vdr-plugin-smarttvweb-1f5fd1308b4518826408342f94d99ab6e10a4a71.tar.bz2
Various changes: Folder Support for Live, Spinner, Keyboard, etc
Diffstat (limited to 'smarttv-client')
-rwxr-xr-xsmarttv-client/CSS/Main.css17
-rw-r--r--smarttv-client/Images/leftHalf-bg.pngbin138277 -> 155643 bytes
-rw-r--r--smarttv-client/Images/rightHalf-bg.pngbin124624 -> 140790 bytes
-rwxr-xr-xsmarttv-client/Javascript/Config.js45
-rwxr-xr-xsmarttv-client/Javascript/Data.js32
-rwxr-xr-xsmarttv-client/Javascript/Display.js75
-rw-r--r--smarttv-client/Javascript/Epg.js41
-rw-r--r--smarttv-client/Javascript/Helpbar.js58
-rwxr-xr-xsmarttv-client/Javascript/Main.js170
-rwxr-xr-xsmarttv-client/Javascript/Options.js367
-rwxr-xr-xsmarttv-client/Javascript/Player.js40
-rwxr-xr-xsmarttv-client/Javascript/Server.js49
-rw-r--r--smarttv-client/Javascript/Spinner.js51
-rwxr-xr-xsmarttv-client/config.xml2
-rwxr-xr-xsmarttv-client/index.html23
15 files changed, 742 insertions, 228 deletions
diff --git a/smarttv-client/CSS/Main.css b/smarttv-client/CSS/Main.css
index e3ebaca..ccc6714 100755
--- a/smarttv-client/CSS/Main.css
+++ b/smarttv-client/CSS/Main.css
@@ -66,7 +66,6 @@ body {
position: absolute;
left: 0px; top: 0px;
width: 960px; height: 540px;
- display: none;
background: url("../Images/selectScreen-bg.png");
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%);
}
@@ -226,6 +225,9 @@ body {
background: -webkit-linear-gradient(-45deg, #1e5799 0%,#2989d8 41%,#7db9e8 100%);
}
+.style_videoitem {
+ display: inline-block;
+}
.style_videoList
{
color:#FFFFFF;
@@ -383,3 +385,16 @@ body {
text-align:center;
font-size:14px;
}
+
+
+#Spinning {
+ position:absolute;
+ left:401px; top:196px;
+ width:158px; height:147px;
+ background-image:url("../Images/spinner/loadingBG.png");
+ background-repeat:no-repeat;
+ opacity:0.5;
+ display:none;
+ z-index:20;
+}
+
diff --git a/smarttv-client/Images/leftHalf-bg.png b/smarttv-client/Images/leftHalf-bg.png
index 0be1542..d91b9b6 100644
--- a/smarttv-client/Images/leftHalf-bg.png
+++ b/smarttv-client/Images/leftHalf-bg.png
Binary files differ
diff --git a/smarttv-client/Images/rightHalf-bg.png b/smarttv-client/Images/rightHalf-bg.png
index 824f3a8..9cb89ac 100644
--- a/smarttv-client/Images/rightHalf-bg.png
+++ b/smarttv-client/Images/rightHalf-bg.png
Binary files differ
diff --git a/smarttv-client/Javascript/Config.js b/smarttv-client/Javascript/Config.js
index 1aa2f75..a950641 100755
--- a/smarttv-client/Javascript/Config.js
+++ b/smarttv-client/Javascript/Config.js
@@ -64,17 +64,14 @@ Config.init = function () {
// should switch to the config screen here
var res = fileSystemObj.createCommonDir(curWidget.id);
if (res == true) {
- Config.firstLaunch = true;
-
- Main.init(); // Obsolete?
-
- Main.changeState(4);
+ Config.doFirstLaunch();
return;
}
else {
- Main.init();
- Display.showPopup ("ERROR: Cannot create widget folder");
- Main.logToServer("ERROR: Cannot create widget folder curWidget.id= " +curWidget.id);
+ Config.doFirstLaunch();
+// Main.init();
+ Display.showPopup ("WARNING: Cannot create widget folder. Try Config");
+// Main.logToServer("ERROR: Cannot create widget folder curWidget.id= " +curWidget.id);
}
return;
}
@@ -86,6 +83,13 @@ Config.init = function () {
Config.fetchConfig();
};
+Config.doFirstLaunch = function () {
+ Config.firstLaunch = true;
+// Main.init(); // Obsolete?
+
+ Main.changeState(4);
+};
+
Config.fetchConfig = function () {
if (this.XHRObj == null) {
this.XHRObj = new XMLHttpRequest();
@@ -114,6 +118,7 @@ Config.writeContext = function (addr) {
};
Config.updateContext = function (addr) {
+ Main.log("Config.updateContext with ("+addr+")");
var fileSystemObj = new FileSystem();
var fd = fileSystemObj.openCommonFile(Config.cfgFileName,"w");
@@ -123,6 +128,7 @@ Config.updateContext = function (addr) {
Config.serverAddr = addr;
Config.serverUrl = "http://" + Config.serverAddr;
+ Config.fetchConfig();
};
Config.readContext = function () {
@@ -141,29 +147,28 @@ Config.readContext = function () {
Config.serverUrl = "http://" + Config.serverAddr;
}
else {
- Display.showPopup ("WARNING: Error in Config File. Try widget restart.");
+ Display.showPopup ("ERROR: Error in Config File. Try widget re-install.");
// TODO: I should re-write the config file
}
}
fileSystemObj.closeCommonFile(fd);
-
}
catch (e) {
- Main.logToServer("Config.readContext: Error while reading: e= " +e);
+ Main.log("Config.readContext: Error while reading: e= " +e);
var res = fileSystemObj.createCommonDir(curWidget.id);
if (res == true) {
- Main.logToServer("Config.readContext: Widget Folder created");
- Display.showPopup ("Config Read Error: Try widget restart");
+ Main.log("WARNING: ConfigRead Error. Launching Config-Menu from here");
+ // Display.showPopup ("Config Read Error: Try widget restart");
+
}
else {
- Main.logToServer("Config.readContext: Widget Folder creation failed");
- Display.showPopup ("Config Read Error: Try re-installing the widget");
- Main.log("-------------- Error: res = false ------------------------");
+ Main.log("Config.readContext: Widget Folder creation failed");
+
+ Display.showPopup ("WARNING: ConfigRead Error and WidgetFolder creation failed. <br> Launching Config-Menu from here");
+// Main.log("-------------- Error: res = false ------------------------");
}
+ Config.doFirstLaunch();
- Config.firstLaunch = true;
- Main.init();
- Main.changeState(4);
}
};
@@ -219,6 +224,8 @@ Config.processConfig = function () {
return;
}
else {
+ Config.firstLaunch = false;
+
Main.log ("Parsing config XML now");
Main.logToServer("Parsing config XML now");
this.format = Config.getXmlString("format");
diff --git a/smarttv-client/Javascript/Data.js b/smarttv-client/Javascript/Data.js
index e7049ee..2b95fa7 100755
--- a/smarttv-client/Javascript/Data.js
+++ b/smarttv-client/Javascript/Data.js
@@ -48,6 +48,10 @@ Data.dumpFolderStruct = function(){
Main.log("---------- dumpFolderStruct Done -------");
};
+Data.findEpgUpdateTime = function() {
+ return this.assets.findEpgUpdateTime(Display.GetEpochTime() + 10000, "", 0);
+ // min, guid, level
+};
Data.getCurrentItem = function () {
return this.folderList[this.folderList.length-1].item;
};
@@ -123,6 +127,34 @@ Item.prototype.addChild = function (key, pyld, level) {
}
};
+Item.prototype.findEpgUpdateTime = function (min, guid, level) {
+ var prefix= "";
+ for (var i = 0; i < level; i++)
+ prefix += "-";
+
+ for (var i = 0; i < this.childs.length; i++) {
+ if (this.childs[i].isFolder == true) {
+ var res = this.childs[i].findEpgUpdateTime(min, guid, level+1);
+ min = res.min;
+ guid = res.guid;
+ }
+ else {
+ var digi =new Date(this.childs[i].payload['start'] * 1000);
+ var str = digi.getHours() + ":" + digi.getMinutes();
+
+ Main.log(prefix + "min= " + min+ " start= " + this.childs[i].payload['start'] + " (" + str+ ") title= " + this.childs[i].title);
+
+ 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);
+ }
+ }
+ }
+
+ return { "min": min, "guid" : guid};
+};
+
Item.prototype.print = function(level) {
var prefix= "";
for (var i = 0; i < level; i++)
diff --git a/smarttv-client/Javascript/Display.js b/smarttv-client/Javascript/Display.js
index 483a141..218f942 100755
--- a/smarttv-client/Javascript/Display.js
+++ b/smarttv-client/Javascript/Display.js
@@ -49,10 +49,22 @@ Display.init = function()
}
for (var i = 0; i <= this.LASTIDX; i++) {
- var elm = document.getElementById("video"+i);
+ var elm = $("#video"+i);
+ $(elm).css({"width" : "100%", "text-align": "left" });
+ $(elm).append($("<div>").css({ "display": "inline-block", "padding-top": "4px", "padding-bottom": "6px", "width":"20%"}));
+ $(elm).append($("<div>").css({ "display": "inline-block", "padding-top": "4px", "padding-bottom": "6px", "width":"70%"}));
+ $(elm).append($("<div>").css({ "display": "inline-block", "padding-top": "4px", "padding-bottom": "6px", "width":"5%"}));
+
+/* $(elm).children("div").eq(0).text ("Hallo1");
+ $(elm).children("div").eq(1).text ("Hallo2");
+ $(elm).children("div").eq(2).text ("Hallo3");
+*/
+/*
+ * var elm = document.getElementById("video"+i);
elm.style.paddingLeft = "10px";
elm.style.paddingTop = "4px";
elm.style.paddingBottom = "6px";
+ */
}
var done = false;
@@ -76,8 +88,15 @@ Display.init = function()
return success;
};
+Display.setVideoItem = function (elm, cnt) {
+ // 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);
+};
+
Display.putInnerHTML = function (elm, val) {
-
+ alert(Config.deviceType + " " +elm + " " + val);
switch (Config.deviceType) {
case 0:
// Samsung specific handling of innerHtml
@@ -133,7 +152,7 @@ Display.resetVideoList = function () {
break;
}
Display.unselectItem(elm);
- Display.putInnerHTML(elm, "");
+ Display.setVideoItem(elm, {c1: "", c2: "", c3: ""});
}
};
@@ -276,7 +295,6 @@ Display.handleDescription =function (selected) {
var min = Display.getNumString (digi.getMinutes(), 2);
var d_str ="";
-// Main.log("handleDescription: " +Data.getCurrentItem().childs[selected].payload.desc);
var msg = "";
if (Main.state == 1) {
// Live
@@ -326,19 +344,24 @@ Display.getNumString =function(num, fmt) {
};
Display.getDisplayTitle = function(item) {
- var res = "";
+ var res = {c1:"", c2:"", c3:""};
switch (Main.state) {
case 1:
// Live
- res = item.title;
+ if (item.isFolder == true) {
+ res.c2 = item.title;
+ res.c3 = "<" + Display.getNumString(item.childs.length, 2) +">";
+ }
+ else {
+ res.c2 = item.title;
+ }
break;
case 2:
case 3:
// Recordings
if (item.isFolder == true) {
-// res = "<" + Display.getNumString(item.childs.length, 3) + ">-------- " + item.title;
- res = "<" + Display.getNumString(item.childs.length, 3) + ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- " + item.title;
-
+ res.c1 = "<" + Display.getNumString(item.childs.length, 3) + ">";
+ res.c2 = item.title;
}
else {
var digi = new Date(parseInt(item.payload.start*1000));
@@ -348,7 +371,8 @@ Display.getDisplayTitle = function(item) {
var min = Display.getNumString (digi.getMinutes(), 2);
var d_str = mon + "/" + day + " " + hour + ":" + min;
- res = d_str + " - " + item.title;
+ res.c1 = d_str;
+ res.c2 = item.title;
}
break;
default:
@@ -361,7 +385,9 @@ Display.getDisplayTitle = function(item) {
Display.setVideoList = function(selected, first) {
//
var listHTML = "";
- var first_item = selected;
+ var res = {};
+// var first_item = selected;
+ var first_item = first; //thlo
var i=0;
Main.log("Display.setVideoList title= " +Data.getCurrentItem().childs[selected].title + " selected= " + selected + " first_item= " + first_item);
@@ -369,15 +395,14 @@ Display.setVideoList = function(selected, first) {
for (i = 0; i <= this.LASTIDX; i++) {
if ((first_item+i) >= Data.getVideoCount()) {
- listHTML = "";
+ res = {c1: "", c2: "", c3: ""};
}
else {
- listHTML = Display.getDisplayTitle (Data.getCurrentItem().childs[first_item+i]);
-// Main.log(" - title[first_item+i]= " +Data.getCurrentItem().childs[(first_item +i)].title + " i= " + i + " listHTML= " + listHTML);
-// Main.log(" - listHTML= " + listHTML);
+ res = Display.getDisplayTitle (Data.getCurrentItem().childs[first_item+i]);
}
this.videoList[i] = document.getElementById("video"+i);
- Display.putInnerHTML(this.videoList[i], listHTML);
+
+ Display.setVideoItem(this.videoList[i], res);
this.unselectItem(this.videoList[i]);
}
@@ -414,6 +439,7 @@ Display.unselectItem = function (item) {
Display.setVideoListPosition = function(position, move)
{
var listHTML = "";
+// var res = {}; //thlo: unused?
Main.log ("Display.setVideoListPosition title= " +Data.getCurrentItem().childs[position].title + " move= " +move);
this.handleDescription(position);
@@ -454,9 +480,7 @@ Display.setVideoListPosition = function(position, move)
this.currentWindow = this.FIRSTIDX;
for(i = 0; i <= this.LASTIDX; i++) {
- listHTML = Display.getDisplayTitle (Data.getCurrentItem().childs[i]);
-// listHTML = Data.getCurrentItem().childs[i].title;
- Display.putInnerHTML(this.videoList[i], listHTML);
+ Display.setVideoItem(this.videoList[i], Display.getDisplayTitle (Data.getCurrentItem().childs[i]));
if(i == this.currentWindow)
this.selectItem(this.videoList[i]);
@@ -466,9 +490,7 @@ Display.setVideoListPosition = function(position, move)
}
else {
for(i = 0; i <= this.LASTIDX; i++) {
- listHTML = Display.getDisplayTitle (Data.getCurrentItem().childs[i + position - this.currentWindow]);
-// listHTML = Data.getCurrentItem().childs[i + position - this.currentWindow].title;
- Display.putInnerHTML(this.videoList[i], listHTML);
+ Display.setVideoItem(this.videoList[i], Display.getDisplayTitle (Data.getCurrentItem().childs[i + position - this.currentWindow]));
}
}
}
@@ -479,10 +501,7 @@ Display.setVideoListPosition = function(position, move)
this.currentWindow = this.LASTIDX;
for(i = 0; i <= this.LASTIDX; i++) {
- listHTML = Display.getDisplayTitle (Data.getCurrentItem().childs[i + position - this.currentWindow]);
-// listHTML = Data.getCurrentItem().childs[i + position - this.currentWindow].title;
- Display.putInnerHTML(this.videoList[i], listHTML);
-
+ Display.setVideoItem(this.videoList[i], Display.getDisplayTitle (Data.getCurrentItem().childs[i + position - this.currentWindow]));
if(i == this.currentWindow)
this.selectItem(this.videoList[i]);
else
@@ -491,9 +510,7 @@ Display.setVideoListPosition = function(position, move)
}
else {
for(i = 0; i <= this.LASTIDX; i++) {
- listHTML = Display.getDisplayTitle (Data.getCurrentItem().childs[i + position]);
-// listHTML = Data.getCurrentItem().childs[i + position].title;
- Display.putInnerHTML(this.videoList[i], listHTML);
+ Display.setVideoItem(this.videoList[i], Display.getDisplayTitle (Data.getCurrentItem().childs[i + position]));
}
}
}
diff --git a/smarttv-client/Javascript/Epg.js b/smarttv-client/Javascript/Epg.js
new file mode 100644
index 0000000..c400e0e
--- /dev/null
+++ b/smarttv-client/Javascript/Epg.js
@@ -0,0 +1,41 @@
+/*
+ * Principle: One monitor for each channel
+ * Nur max 20
+ * Oder einer:
+ * Search once through all entries and look for the lowest expiry.
+ * Set a timer to update the entry
+ * check, whether the entry is "on screen"
+ *
+*/
+
+var Epg = {
+ restfulUrl : ""
+
+};
+
+// Should be called after initial config
+Epg.init = function () {
+ if (Config.serverUrl == "")
+ return;
+ if (Config.serverUrl.indexOf(':') != -1) {
+ Main.log ("Epg: Serverurl= " + Config.serverUrl);
+ this.restfulUrl = Config.serverUrl.splice(0, Config.serverUrl.indexOf(':')) + ":8002";
+ }
+
+ Main.log ("Restful API Url= "+ this.restfulUrl);
+
+ $.ajax({
+ type: "HEAD",
+ async: true,
+ url: this.restfulUrl + "channels.xml",
+ success: function(message,text,response){
+ Main.log("AJAX Response: MSG= " + message + " txt= " + text + " resp= " + response);
+ }
+ });
+};
+
+Epg.startEpgUpdating = function() {
+
+ var res = Data.findEpgUpdateTime();
+ Main.log("GUID= " + res.guid + " Min= " + res.min);
+}; \ No newline at end of file
diff --git a/smarttv-client/Javascript/Helpbar.js b/smarttv-client/Javascript/Helpbar.js
new file mode 100644
index 0000000..0196d78
--- /dev/null
+++ b/smarttv-client/Javascript/Helpbar.js
@@ -0,0 +1,58 @@
+
+var Helpbar = {
+ isInited : false
+};
+
+Helpbar.init = function () {
+ if (this.isInited == false) {
+ Helpbar.createHelpbar();
+ Helpbar.hide();
+ }
+};
+
+Helpbar.show = function () {
+ $("#helpbar").show();
+};
+
+Helpbar.hide = function () {
+ $("#helpbar").hide();
+};
+
+Helpbar.createHelpbar = function() {
+ this.isInited = true;
+ var sheet = $("<style>");
+ sheet.attr({type : 'text/css',
+ innerHTML : '\
+ .hb-bg {width:960px; height: 40px; left: 0px; top: 480px; font-size:16px;background: darkblue;background: -webkit-linear-gradient(top, #1e5799 0%,#7db9e8 50%,#1e5799 100%);}\
+ }'});
+ $('body').append(sheet);
+
+
+ $("<table>", {id:"helpbar", class: "hb-bg"}).appendTo ($("body"));
+// $("#helpbar").hide();
+ $("<tr>", {id: "hb-row", align:"center", valign:"middle"}).appendTo("#helpbar");
+
+ Helpbar.addItem("Images/helpbar/help_lr.png", "Move Cursor");
+ Helpbar.addItem("Images/helpbar/help_back.png", "Cancel");
+
+ Helpbar.addItem("Images/helpbar/help_enter.png", "Done");
+ Helpbar.addItem("Images/helpbar/help_red.png", "Clear all");
+ Helpbar.addItem("Images/helpbar/help_green.png", "Clear Char");
+ Helpbar.addItem("Images/helpbar/help_yellow.png", "Dot (.)");
+ Helpbar.addItem("Images/helpbar/help_blue.png", "Colon (:)");
+};
+
+
+Helpbar.addItem = function(url, msg) {
+ var hb_elm = $("<td>");
+ hb_elm.appendTo("#hb-row");
+
+ var tab = $("<table>");
+ tab.appendTo(hb_elm);
+ var row = $("<tr>");
+ row.appendTo(tab);
+
+ $("<td>").append($("<img>", { src: url})).appendTo(row);
+ $("<td>").append($("<p>", { text: msg})).appendTo(row);
+
+}; \ No newline at end of file
diff --git a/smarttv-client/Javascript/Main.js b/smarttv-client/Javascript/Main.js
index 42fa8f7..10bf7fa 100755
--- a/smarttv-client/Javascript/Main.js
+++ b/smarttv-client/Javascript/Main.js
@@ -65,6 +65,10 @@ var Main = {
menuKeyHndl : null
};
+$(document).ready(function(){
+ Main.onLoad ();
+});
+
Main.onLoad = function() {
window.onShow = showHandler;
window.onshow = showHandler;
@@ -82,7 +86,11 @@ Main.onLoad = function() {
// Display.showPopup("Not a Samsung Smart TV. Lets see, how far we come");
}
- Display.init();
+ Display.init();
+ Display.selectItem(document.getElementById("selectItem1"));
+ Spinner.init();
+ Helpbar.init();
+ Options.init();
this.defKeyHndl = new cDefaulKeyHndl;
this.playStateKeyHndl = new cPlayStateKeyHndl(this.defKeyHndl);
@@ -110,25 +118,25 @@ showHandler = function() {
// Called by Config, when done
Main.init = function () {
Main.log("Main.init()");
+
if ( Player.init() && Server.init() && Audio.init()) {
Display.setVolume( Audio.getVolume() );
+// Epg.init();
// Start retrieving data from server
Server.dataReceivedCallback = function() {
/* Use video information when it has arrived */
-// Main.log("Server.dataReceivedCallback");
- Display.setVideoList(Main.selectedVideo);
+ Display.setVideoList(Main.selectedVideo, Main.selectedVideo);
Display.show();
+ if (Player.isLive == true) {
+ Epg.startEpgUpdating();
+ }
};
// Enable key event processing
this.enableKeys();
-
- Display.selectItem(document.getElementById("selectItem1"));
-
- document.getElementById("splashScreen").style.display="none";
-
+
}
else {
Main.log("Failed to initialise");
@@ -172,15 +180,16 @@ Main.onUnload = function()
Main.changeState = function (state) {
- Main.log("change state: new state= " + state);
+ Main.log("change state: OldState= " + this.state + " NewState= " + state);
var old_state = this.state;
this.state = state;
switch (this.state) {
case 0:
Main.selectMenuKeyHndl.select = old_state;
+
Main.log ("old Select= " + Main.selectMenuKeyHndl.select);
- Display.resetSelectItems(Main.selectMenuKeyHndl.select);
+ Display.resetSelectItems(old_state);
document.getElementById("selectScreen").style.display="block";
Display.hide();
@@ -206,9 +215,10 @@ Main.changeState = function (state) {
break;
case 4:
// Options
- Options.init();
+// Options.init();
document.getElementById("selectScreen").style.display="none";
- document.getElementById("optionsScreen").style.display="block";
+ Options.show();
+// document.getElementById("optionsScreen").style.display="block";
Main.optionsSelected();
break;
@@ -267,6 +277,7 @@ Main.liveSelected = function() {
Server.setSort(false);
Server.errorCallback = Main.serverError;
Server.fetchVideoList(Config.serverUrl + "/channels.xml?channels="+Config.liveChannels); /* Request video information from server */
+
};
Main.mediaSelected = function() {
@@ -325,7 +336,8 @@ Main.keyDown = function() {
break;
case 4:
- Main.log ("ERROR: Wrong State");
+// Options.onInput();
+// Main.log ("ERROR: Wrong State");
break;
};
};
@@ -341,7 +353,9 @@ Main.playItem = function (url) {
switch (this.state) {
case 1:
// Live
- Display.setOlTitle(Data.getCurrentItem().childs[Main.selectedVideo].payload.prog);
+ // Check for updates
+
+ Display.setOlTitle(Data.getCurrentItem().childs[Main.selectedVideo].title + " - " +Data.getCurrentItem().childs[Main.selectedVideo].payload.prog);
Display.setStartStop (start_time, (start_time + duration));
Player.isLive = true;
Player.bufferState = 0;
@@ -391,17 +405,18 @@ Main.playItem = function (url) {
Player.playVideo();
};
-Main.selectPageUp = function(up) {
+Main.selectPageUp = function() {
if (this.selectedVideo == 0) {
Main.changeState(0);
return;
};
- this.selectedVideo = (this.selectedVideo - (Display.LASTIDX + 1));
+ Main.previousVideo(Display.LASTIDX + 1);
+/* this.selectedVideo = (this.selectedVideo - (Display.LASTIDX + 1));
if (this.selectedVideo < 0) {
this.selectedVideo = 0;
}
-
+*/
var first_item = this.selectedVideo - Display.currentWindow;
if (first_item < 0 )
first_item = 0;
@@ -410,12 +425,14 @@ Main.selectPageUp = function(up) {
Display.setVideoList(this.selectedVideo, first_item);
};
-Main.selectPageDown = function(down) {
- this.selectedVideo = (this.selectedVideo + Display.LASTIDX + 1);
-
+Main.selectPageDown = function() {
+ Main.nextVideo (Display.LASTIDX + 1);
+
+/* this.selectedVideo = (this.selectedVideo + Display.LASTIDX + 1);
if (this.selectedVideo >= Data.getVideoCount()) {
this.selectedVideo = Data.getVideoCount() -1;
}
+*/
var first_item = this.selectedVideo - Display.currentWindow;
Main.log("selectPageDown: this.selectedVideo= " + this.selectedVideo + " first_item= " + first_item);
@@ -423,12 +440,13 @@ Main.selectPageDown = function(down) {
};
Main.nextVideo = function(no) {
+ // Just move the selectedVideo pointer and ensure wrap around
this.selectedVideo = (this.selectedVideo + no) % Data.getVideoCount();
Main.log("nextVideo= " + this.selectedVideo);
};
Main.previousVideo = function(no) {
-
+// Just move the selectedVideo pointer and ensure wrap around
this.selectedVideo = (this.selectedVideo - no);
if (this.selectedVideo < 0) {
this.selectedVideo += Data.getVideoCount();
@@ -437,70 +455,24 @@ Main.previousVideo = function(no) {
};
-Main.selectNextVideo = function(down)
-{
+Main.selectNextVideo = function() {
Player.stopVideo();
Main.nextVideo(1);
// this.updateCurrentVideo(down);
- Display.setVideoListPosition(this.selectedVideo, down);
+ Display.setVideoListPosition(this.selectedVideo, Main.DOWN);
};
-Main.selectPreviousVideo = function(up)
+Main.selectPreviousVideo = function()
{
Player.stopVideo();
Main.previousVideo(1);
// this.updateCurrentVideo(up);
- Display.setVideoListPosition(this.selectedVideo, up);
+ Display.setVideoListPosition(this.selectedVideo, Main.UP);
};
-
-Main.setMuteMode = function()
-{
- if (this.mute != this.YMUTE)
- {
- var volumeElement = document.getElementById("volumeInfo");
- //Audio.plugin.SetSystemMute(true);
- Audio.plugin.SetUserMute(true);
- document.getElementById("volumeBar").style.backgroundImage = "url(Images/muteBar.png)";
- document.getElementById("volumeIcon").style.backgroundImage = "url(Images/mute.png)";
- widgetAPI.putInnerHTML(volumeElement, "MUTE");
- this.mute = this.YMUTE;
- }
-};
-
-Main.noMuteMode = function()
-{
- if (this.mute != this.NMUTE)
- {
- Audio.plugin.SetUserMute(false);
- document.getElementById("volumeBar").style.backgroundImage = "url(Images/volumeBar.png)";
- document.getElementById("volumeIcon").style.backgroundImage = "url(Images/volume.png)";
- Display.setVolume( Audio.getVolume() );
- this.mute = this.NMUTE;
- }
-};
-
-Main.muteMode = function()
-{
- switch (this.mute)
- {
- case this.NMUTE:
- this.setMuteMode();
- break;
-
- case this.YMUTE:
- this.noMuteMode();
- break;
-
- default:
- Main.log("ERROR: unexpected mode in muteMode");
- break;
- }
-};
-
// -----------------------------------------------
Main.getKeyCode = function(code) {
@@ -972,22 +944,54 @@ cLivePlayStateKeyHndl.prototype.handleKeyDown = function () {
Main.log(this.handlerName+": Key pressed: " + Main.getKeyCode(keyCode));
switch(keyCode) {
- case tvKey.KEY_1:
+// case tvKey.KEY_1:
+ case tvKey.KEY_UP:
case tvKey.KEY_CH_UP:
Main.log("Prog Up");
Display.showProgress();
Player.stopVideo();
- Main.previousVideo(1);
-
+
+ // Check, weather I am the last element of a folder. If yes, go one level up
+ if (Main.selectedVideo == (Data.getVideoCount() -1)) {
+ //Last VideoItem, check wrap around or folder fall-down
+ if (Data.isRootFolder() != "true") {
+ Main.selectedVideo = Data.folderUp();
+ }
+ }
+ Main.nextVideo(1); // increase and wrap
+ // check, if new element is a folder again
+ if (Data.getCurrentItem().childs[Main.selectedVideo].isFolder == true) {
+ Data.selectFolder(Main.selectedVideo);
+ Main.selectedVideo= 0;
+ }
+// Main.nextVideo(1);
+
Main.playItem();
break;
- case tvKey.KEY_4:
+// case tvKey.KEY_4:
+ case tvKey.KEY_DOWN:
case tvKey.KEY_CH_DOWN:
Main.log("Prog Down");
Display.showProgress();
Player.stopVideo();
- Main.nextVideo(1);
+
+ // check, if I am the first element of a folder
+ // if yes, then one up
+ if (Main.selectedVideo == 0) {
+ //First VideoItem,
+ if (Data.isRootFolder() != "true") {
+ Main.selectedVideo = Data.folderUp();
+ }
+ }
+ Main.previousVideo(1);
+ // check, if new element is a folder again
+ if (Data.getCurrentItem().childs[Main.selectedVideo].isFolder == true) {
+ Data.selectFolder(Main.selectedVideo);
+ Main.selectedVideo= Data.getVideoCount()-1;
+ }
+
+// Main.previousVideo(1);
Main.playItem();
break;
@@ -1005,7 +1009,7 @@ cLivePlayStateKeyHndl.prototype.handleKeyDown = function () {
case tvKey.KEY_STOP:
Main.log("STOP");
Player.stopVideo();
- Display.setVideoList(Main.selectedVideo);
+ Display.setVideoList(Main.selectedVideo, Main.selectedVideo- ( Main.selectedVideo % (Display.LASTIDX +1)));
Display.show();
widgetAPI.blockNavigation(event);
@@ -1057,12 +1061,12 @@ cMenuKeyHndl.prototype.handleKeyDown = function () {
case tvKey.KEY_RIGHT:
Main.log("Right");
- Main.selectPageDown(Main.DOWN);
+ Main.selectPageDown();
break;
case tvKey.KEY_LEFT:
Main.log("Left");
- Main.selectPageUp(Main.UP);
+ Main.selectPageUp();
break;
case tvKey.KEY_ENTER:
@@ -1074,7 +1078,7 @@ cMenuKeyHndl.prototype.handleKeyDown = function () {
Main.log ("selectFolder= " +Main.selectedVideo);
Data.selectFolder(Main.selectedVideo);
Main.selectedVideo= 0;
- Display.setVideoList(Main.selectedVideo);
+ Display.setVideoList(Main.selectedVideo, Main.selectedVideo); // thlo
}
else{
Display.hide();
@@ -1094,19 +1098,19 @@ cMenuKeyHndl.prototype.handleKeyDown = function () {
else {
Main.selectedVideo = Data.folderUp();
Main.log("folderUp selectedVideo= " + Main.selectedVideo);
- Display.setVideoList(Main.selectedVideo);
+ Display.setVideoList(Main.selectedVideo, Main.selectedVideo); // thlo
}
widgetAPI.blockNavigation(event);
break;
case tvKey.KEY_DOWN:
Main.log("DOWN");
- Main.selectNextVideo(Main.DOWN);
+ Main.selectNextVideo();
break;
case tvKey.KEY_UP:
Main.log("UP");
- Main.selectPreviousVideo(Main.UP);
+ Main.selectPreviousVideo();
break;
default:
diff --git a/smarttv-client/Javascript/Options.js b/smarttv-client/Javascript/Options.js
index d066c00..06d9ad0 100755
--- a/smarttv-client/Javascript/Options.js
+++ b/smarttv-client/Javascript/Options.js
@@ -1,83 +1,346 @@
var Options = {
- imeBox : null
+ imeBox : null,
+ inputElm : "widgetServerAddr",
+ jqInputElm : "#widgetServerAddr",
+ cursor : "_",
+ cursorPos : 0,
+ isCreated : false
+
};
Options.init = function() {
- _g_ime.Recog_use_YN = false;
- _g_ime.keySet = '12key';
+ if (this.isCreated == true)
+ return;
- this.imeBox = new IMEShell("widgetServerAddr", Options.onImeCreated, 'de');
-};
+ this.isCreated = true;
-Options.onComplete = function () {
- Main.log("Completed");
-};
+ document.getElementById(Options.inputElm).value = Config.serverAddrDefault;
+ Options.cursorPos = Config.serverAddrDefault.length;
+
+ Options.createKeypad ();
+ $("#optionsScreen").hide();
-Options.onEnter = function () {
- Main.log("Enter: " + document.getElementById("widgetServerAddr").value );
+ document.getElementById(Options.inputElm).style.color="black";
+};
- Config.updateContext(document.getElementById("widgetServerAddr").value);
+Options.show = function() {
+// document.getElementById("optionsScreen").style.display="block";
+ $("#optionsScreen").show();
+ if (Config.firstLaunch == true)
+ document.getElementById(Options.inputElm).value = Config.serverAddrDefault ;
+ else
+ document.getElementById(Options.inputElm).value = Config.serverAddr;
- document.getElementById('widgetServerAddr').blur();
-
- document.getElementById("optionsScreen").style.display="none";
+ Options.cursorPos = document.getElementById(Options.inputElm).value.length;
- if (Config.firstLaunch == true)
- Main.state = 1;
- Main.changeState(0);
-
- Config.fetchConfig();
- if(_g_ime.pluginMouse_use_YN){
- this.imeBox._blur();
- };
+ $(this.jqInputElm).focus();
+// document.getElementById(Options.inputElm).focus();
- // Main.enableKeys();
+ Helpbar.init();
+ Helpbar.show();
};
-Options.onBlue = function () {
- var val = document.getElementById("widgetServerAddr").value + ".";
- Options.imeBox.setString(val);
+Options.hide = function() {
+ $("#optionsScreen").hide();
+// document.getElementById("optionsScreen").style.display="none";
+ Helpbar.hide();
+ Main.enableKeys();
};
-Options.onImeCreated = function(obj) {
-// _g_ime.keySet ("12key");
-// obj.setKeySetFunc('12key');
- Main.logToServer ("Options.onImeCreated()");
- Main.logToServer ("[IME] ============================================ imeobj.IsSupportXT9:"+obj.IsSupportXT9);
- var strKeySet = obj.getKeySet();
- Main.logToServer ("[IME] ============================================ strKeySet:"+strKeySet);
+Options.createKeypad = function () {
+ var sheet = $("<style>");
+ sheet.attr({type : 'text/css',
+ innerHTML : '\
+ .ui-btn {width:70px; height: 48px; display:inline-block, font-size:20px;background:url("Images/keypad/kp-button.png");}\
+ .ui-btn-pressed {width:70px; height: 48px; display:inline-blockfont-size:20px;background:url("Images/keypad/kp-button-inv.png");}\
+ .ui-keypad {left:650px; top:135px; width: 220px; text-align:center; border-width:1px; background: #1e5799; border-style:solid;\
+ }'});
+ $('body').append(sheet);
-
- obj.setKeyFunc(tvKey.KEY_RETURN, function(keyCode) { widgetAPI.sendReturnEvent(); return false; } );
- obj.setKeyFunc(tvKey.KEY_EXIT, function(keyCode) { widgetAPI.sendExitEvent(); return false; } );
+/* var domNode = $('<div>');
+ domNode.attr({id : 'ime_keypad',
+ innerHTML : '<table class="ui-keypad"> \
+ <tr><td><button id="kb-btn-1" class="ui-btn">1</button></td><td><button id="kb-btn-2" class="ui-btn">2</button></td><td><button id="kb-btn-3" class="ui-btn">3</button></td></tr>\
+ <tr><td><button id="kb-btn-4" class="ui-btn">4</button></td><td><button id="kb-btn-5" class="ui-btn">5</button></td><td><button id="kb-btn-6" class="ui-btn">6</button></td></tr>\
+ <tr><td><button id="kb-btn-7" class="ui-btn">7</button></td><td><button id="kb-btn-8" class="ui-btn">8</button></td><td><button id="kb-btn-9" class="ui-btn">9</button></td></tr>\
+ <tr><td><button id="kb-btn-dot" class="ui-btn">.</button></td><td><button id="kb-btn-0" class="ui-btn">0</button></td><td><button id="kb-btn-col" class="ui-btn">:</button></td></tr>\
+ </table>'});
+*/
+ var domNode = $('<div>', { id: "ime_keypad", class: "ui-keypad"});
+ var row = $('<div>');
+ $("<button>", {id : "kb-btn-1", text: "1", class: "ui-btn"}).appendTo(row);
+ $("<button>", {id : "kb-btn-2", text: "2", class: "ui-btn"}).appendTo(row);
+ $("<button>", {id : "kb-btn-3", text: "3", class: "ui-btn"}).appendTo(row);
+ row.appendTo(domNode);
+
+ row = $('<div>');
+ $("<button>", {id : "kb-btn-4", text: "4", class: "ui-btn"}).appendTo(row);
+ $("<button>", {id : "kb-btn-5", text: "5", class: "ui-btn"}).appendTo(row);
+ $("<button>", {id : "kb-btn-6", text: "6", class: "ui-btn"}).appendTo(row);
+ row.appendTo(domNode);
- obj.setKeypadPos(650, 135);
- obj.setWordBoxPos(18, 6);
- obj.setKeyFunc(tvKey.KEY_BLUE, Options.onBlue);
+ row = $('<div>');
+ $("<button>", {id : "kb-btn-7", text: "7", class: "ui-btn"}).appendTo(row);
+ $("<button>", {id : "kb-btn-8", text: "8", class: "ui-btn"}).appendTo(row);
+ $("<button>", {id : "kb-btn-9", text: "9", class: "ui-btn"}).appendTo(row);
+ row.appendTo(domNode);
+
+ row = $('<div>');
+ $("<button>", {id : "kb-btn-dot", text: ".", class: "ui-btn"}).appendTo(row);
+ $("<button>", {id : "kb-btn-0", text: "0", class: "ui-btn"}).appendTo(row);
+ $("<button>", {id : "kb-btn-col", text: ":", class: "ui-btn"}).appendTo(row);
+ row.appendTo(domNode);
+
+ $("#optionsScreen").append(domNode);
+};
- obj.setString(Config.serverAddrDefault);
- obj.setEnterFunc(Options.onEnter);
+Options.setCursor = function (pos) {
+ document.getElementById(Options.inputElm).setSelectionRange(pos, pos);
+};
- if (obj.setMode("_num") == false) {
- Main.logToServer("obj.setMode(\"_num\") returns false");
+Options.insertChar = function(char) {
+ var txt = document.getElementById(Options.inputElm).value;
+ var res = "";
+ if (Options.cursorPos == 0) {
+ res = char;
+// document.getElementById(Options.inputElm).value = char + Options.cursor;
+ }
+ else {
+ if (Options.cursorPos == txt.length) {
+ res = txt + char;
+ }
+ else {
+ res = txt.slice(0, Options.cursorPos) + char + txt.slice(Options.cursorPos);
+// document.getElementById(Options.inputElm).value = txt.slice(0, Options.cursorPos) + char + txt.slice(Options.cursorPos);
+ }
}
+ document.getElementById(Options.inputElm).value = res;
+ Options.cursorPos = Options.cursorPos +1;
+ Options.setCursor(Options.cursorPos);
+
+};
+
+Options.deleteAll = function () {
+ document.getElementById(Options.inputElm).value = '';
+ Options.cursorPos = 0;
+ Options.setCursor(Options.cursorPos);
+// document.getElementById(Options.inputElm).value = "" +Options.cursor;
+};
+
+Options.deleteChar = function() {
+ var txt = document.getElementById(Options.inputElm).value;
+ alert("Options.cursorPos= " +Options.cursorPos);
+ alert("txt.length= " +txt.length);
+ document.getElementById(Options.inputElm).value = txt.slice(0, (Options.cursorPos-1)) + txt.slice(Options.cursorPos);
+ Options.cursorPos = Options.cursorPos -1;
+ Options.setCursor(Options.cursorPos);
+};
- Options.imeBox.setOnCompleteFunc(Options.onComplete);
- if(_g_ime.pluginMouse_use_YN){
- obj._focus();
- };
- document.getElementById('widgetServerAddr').focus();
- Main.logToServer ("Options.onReady()");
- Main.logToServer ("KeySet= " + Options.imeBox.getKeySet());
+Options.moveCursorLeft = function() {
+ if (Options.cursorPos == 0)
+ return;
+ Options.cursorPos = Options.cursorPos -1;
+ Options.setCursor(Options.cursorPos);
+// document.getElementById(Options.inputElm).setSelectionRange(Options.cursorPos, Options.cursorPos);
+ /*
+ if (Options.cursorPos == 0)
+ return;
+ var txt = document.getElementById(Options.inputElm).value;
+ var tgt = txt.slice(0, (Options.cursorPos-1)) + Options.cursor +txt.slice((Options.cursorPos-1), Options.cursorPos) + txt.slice(Options.cursorPos+1);
- Options.onReady ();
+ document.getElementById(Options.inputElm).value = tgt;
+ Options.cursorPos = Options.cursorPos -1;
+ */
};
-Options.onReady = function () {
+Options.moveCursorRight = function() {
+ if (Options.cursorPos == document.getElementById(Options.inputElm).value.length)
+ return;
+ Options.cursorPos = Options.cursorPos +1;
+// document.getElementById(Options.inputElm).setSelectionRange(Options.cursorPos, Options.cursorPos);
+ Options.setCursor(Options.cursorPos);
+
+
+ /*
+ var txt = document.getElementById(Options.inputElm).value;
+ if (Options.cursorPos == txt.length-1)
+ return;
+
+ var tgt = txt.slice(0, Options.cursorPos) +txt.slice((Options.cursorPos+1), (Options.cursorPos+2)) + Options.cursor + txt.slice(Options.cursorPos+2);
+ document.getElementById(Options.inputElm).value = tgt;
+ Options.cursorPos = Options.cursorPos +1;
+ */
};
+Options.onInput = function () {
+ var keyCode = event.keyCode;
+
+ switch(keyCode) {
+ case tvKey.KEY_1:
+ Main.log("KEY_1 pressed");
+ Options.insertChar("1");
+
+ $("#kb-btn-1").removeClass('ui-btn').addClass('ui-btn-pressed');
+ setTimeout(function() {
+ $("#kb-btn-1").removeClass('ui-btn-pressed').addClass('ui-btn');
+ }, 80);
+
+ break;
+ case tvKey.KEY_2:
+ Main.log("KEY_2 pressed");
+ Options.insertChar("2");
+ $("#kb-btn-2").removeClass('ui-btn').addClass('ui-btn-pressed');
+ setTimeout(function() {
+ $("#kb-btn-2").removeClass('ui-btn-pressed').addClass('ui-btn');
+ }, 80);
+
+ break;
+ case tvKey.KEY_3:
+ Main.log("KEY_3 pressed");
+ Options.insertChar("3");
+
+ $("#kb-btn-3").removeClass('ui-btn').addClass('ui-btn-pressed');
+ setTimeout(function() {
+ $("#kb-btn-3").removeClass('ui-btn-pressed').addClass('ui-btn');
+ }, 80);
+ break;
+ case tvKey.KEY_4:
+ Main.log("KEY_4 pressed");
+ Options.insertChar("4");
+
+ document.getElementById("kb-btn-4").click();
+
+ $("#kb-btn-4").removeClass('ui-btn').addClass('ui-btn-pressed');
+ setTimeout(function() {
+ $("#kb-btn-4").removeClass('ui-btn-pressed').addClass('ui-btn');
+ }, 80);
+
+ break;
+ case tvKey.KEY_5:
+ Main.log("KEY_5 pressed");
+ Options.insertChar("5");
+
+ $("#kb-btn-5").removeClass('ui-btn').addClass('ui-btn-pressed');
+ setTimeout(function() {
+ $("#kb-btn-5").removeClass('ui-btn-pressed').addClass('ui-btn');
+ }, 80);
+
+ break;
+ case tvKey.KEY_6:
+ Main.log("KEY_6 pressed");
+ Options.insertChar("6");
+
+ $("#kb-btn-6").removeClass('ui-btn').addClass('ui-btn-pressed');
+ setTimeout(function() {
+ $("#kb-btn-6").removeClass('ui-btn-pressed').addClass('ui-btn');
+ }, 80);
+
+ break;
+ case tvKey.KEY_7:
+ Main.log("KEY_7 pressed");
+ Options.insertChar("7");
+
+ $("#kb-btn-7").removeClass('ui-btn').addClass('ui-btn-pressed');
+ setTimeout(function() {
+ $("#kb-btn-7").removeClass('ui-btn-pressed').addClass('ui-btn');
+ }, 80);
+
+ break;
+ case tvKey.KEY_8:
+ Main.log("KEY_8 pressed");
+ Options.insertChar("8");
+ $("#kb-btn-8").removeClass('ui-btn').addClass('ui-btn-pressed');
+ setTimeout(function() {
+ $("#kb-btn-8").removeClass('ui-btn-pressed').addClass('ui-btn');
+ }, 80);
+
+ break;
+ case tvKey.KEY_9:
+ Main.log("KEY_9 pressed");
+ Options.insertChar("9");
+
+ $("#kb-btn-9").removeClass('ui-btn').addClass('ui-btn-pressed');
+ setTimeout(function() {
+ $("#kb-btn-9").removeClass('ui-btn-pressed').addClass('ui-btn');
+ }, 80);
+
+ break;
+ case tvKey.KEY_0:
+ Main.log("KEY_0 pressed");
+ Options.insertChar("0");
+ $("#kb-btn-0").removeClass('ui-btn').addClass('ui-btn-pressed');
+ setTimeout(function() {
+ $("#kb-btn-0").removeClass('ui-btn-pressed').addClass('ui-btn');
+ }, 80);
+
+ break;
+ case tvKey.KEY_LEFT:
+ Options.moveCursorLeft();
+ break;
+ case tvKey.KEY_RIGHT:
+ Options.moveCursorRight();
+ break;
+
+ case tvKey.KEY_RETURN:
+ Main.log("Return pressed");
+ Options.hide();
+ Main.changeState(0);
+ widgetAPI.blockNavigation(event);
+
+ break;
+ case tvKey.KEY_ENTER:
+ // Done
+// Options.cursorPos = Options.cursorPos +1;
+// Options.deleteChar(); //
+ Main.log("Enter pressed -> Done Val= ("+ document.getElementById(Options.inputElm).value+")");
+
+ Config.updateContext(document.getElementById(Options.inputElm).value);
+ if (Config.firstLaunch == true)
+ Main.state = 1;
+
+ Main.enableKeys();
+ Options.hide();
+ Main.changeState(0);
+
+ Config.fetchConfig();
+
+ break;
+ case tvKey.KEY_RED:
+ // Clear All
+ Main.log("Red pressed");
+ Options.deleteAll();
+ break;
+
+ case tvKey.KEY_GREEN:
+ // Clear Char
+ Main.log("Green pressed");
+ Options.deleteChar();
+ break;
+
+ case tvKey.KEY_TTX_MIX:
+ case tvKey.KEY_YELLOW:
+ // Dot
+ Main.log("Yellow pressed");
+
+ Options.insertChar(".");
+ break;
+
+ case tvKey.KEY_PRECH:
+ case tvKey.KEY_BLUE:
+ Main.log("Blue pressed");
+ // Colon
+ Options.insertChar(":");
+ break;
+ }
+ widgetAPI.blockNavigation(event);
+
+};
+
+
+
+
diff --git a/smarttv-client/Javascript/Player.js b/smarttv-client/Javascript/Player.js
index c8ab787..3a677e0 100755
--- a/smarttv-client/Javascript/Player.js
+++ b/smarttv-client/Javascript/Player.js
@@ -10,6 +10,7 @@ var Player =
isLive : false,
isRecording : false,
+ url : "",
startTime : 0,
duration : 0,
@@ -45,7 +46,12 @@ Player.init = function() {
this.plugin = document.getElementById("pluginPlayer");
this.pluginBD = document.getElementById("pluginBD");
- this.pluginBD.DisplayVFD_Show(0101); // Stop
+ try {
+ this.pluginBD.DisplayVFD_Show(0101); // Stop
+ }
+ catch (e) {
+
+ }
/* var pl_version = "";
try {
@@ -98,11 +104,14 @@ Player.setFullscreen = function() {
this.plugin.SetDisplayArea(0, 0, 960, 540);
};
-Player.setBuffer = function (btr){
+Player.setBuffer = function (){
var res = true;
var buffer_byte = (Config.totalBufferDuration * Config.tgtBufferBitrate) / 8.0;
-
- Main.logToServer("Seting TotalBufferSize to " + Math.round(buffer_byte) +"Byte dur= " +Config.totalBufferDuration + "sec init_buffer_perc= " +Config.initialBuffer +"% pend_buffer_perc= " +Config.pendingBuffer + "% initialTimeOut= " +Config.initialTimeOut + "sec");
+ var initial_buf = Config.initialBuffer;
+ if (Player.isLive == true)
+ initial_buf = initial_buf *2;
+
+ 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");
//The SetTotalBufferSize function sets the streaming buffer size of media player.
res = this.plugin.SetTotalBufferSize(Math.round(buffer_byte));
@@ -112,10 +121,10 @@ Player.setBuffer = function (btr){
}
// The SetInitialBuffer function sets the first buffering size as percentage of buffer size before starting playback.
- res = this.plugin.SetInitialBuffer(Math.round( buffer_byte * Config.initialBuffer/ 100.0));
+ res = this.plugin.SetInitialBuffer(Math.round( buffer_byte * initial_buf/ 100.0));
if (res == false) {
- Display.showPopup("SetInitialBuffer(" + Math.round(buffer_byte * Config.initialBuffer/ 100.0) +") returns error");
- Main.logToServer("SetInitialBuffer(" + Math.round(buffer_byte * Config.initialBuffer/ 100.0) +") returns error");
+ Display.showPopup("SetInitialBuffer(" + Math.round(buffer_byte * initial_buf/ 100.0) +") returns error");
+ Main.logToServer("SetInitialBuffer(" + Math.round(buffer_byte * initial_buf/ 100.0) +") returns error");
}
//he SetInitialTimeOut function sets the maximum time out value for initial buffering before starting playback.
res = this.plugin.SetInitialTimeOut(Config.initialTimeOut);
@@ -130,7 +139,6 @@ Player.setBuffer = function (btr){
Display.showPopup("SetPendingBuffer(" + Math.round(buffer_byte * Config.pendingBuffer /100.0) +") returns error");
Main.logToServer("SetPendingBuffer(" + Math.round(buffer_byte * Config.pendingBuffer /100.0) +") returns error");
}
-
};
Player.setVideoURL = function(url) {
@@ -157,6 +165,8 @@ Player.playVideo = function() {
Player.bufferState = 0;
Display.bufferUpdate();
+ Spinner.show();
+
// Player.curPlayTime = 0;
Display.updatePlayTime();
@@ -165,17 +175,12 @@ Player.playVideo = function() {
Display.showProgress();
this.state = this.PLAYING;
-// if (this.plugin.InitPlayer(this.url) == false)
-// Display.showPopup("InitPlayer returns false");
-
- Player.setBuffer(15000000.0);
+ Player.setBuffer();
Player.ResetTrickPlay();
Player.skipDuration = Config.skipDuration; // reset
Main.log ("StartPlayback for " + this.url);
-// if (this.plugin.StartPlayback() == false)
-// Display.showPopup("StartPlayback returns false");
-
+
this.plugin.Play( this.url );
Audio.plugin.SetSystemMute(false);
pluginObj.setOffScreenSaver();
@@ -205,8 +210,10 @@ Player.stopVideo = function() {
// Display.setTime(0);
if (this.stopCallback) {
+ Main.log(" StopCallback");
this.stopCallback();
}
+ Spinner.hide();
pluginObj.setOnScreenSaver();
this.pluginBD.DisplayVFD_Show(0101); // Stop
}
@@ -372,6 +379,7 @@ Player.onBufferingStart = function() {
Main.logToServer("Buffer Start: " + Player.curPlayTime);
Player.bufferStartTime = new Date().getTime();
+ Spinner.show();
Player.bufferState = 0;
Display.bufferUpdate();
// should trigger from here the overlay
@@ -393,6 +401,7 @@ Player.onBufferingProgress = function(percent)
Player.onBufferingComplete = function() {
Display.status("Play");
Display.hideStatus();
+ Spinner.hide();
Main.logToServer("Buffer Completed - Buffering Duration= " + (new Date().getTime() - Player.bufferStartTime) + " ms");
@@ -448,6 +457,7 @@ Player.OnRenderingComplete = function() {
Player.OnConnectionFailed = function() {
// fails to connect to the streaming server
Main.log ("ERROR: Failed to connect to the streaming server");
+ Main.logToServer("ERROR: Failed to connect Url= "+ Player.url);
// widgetAPI.putInnerHTML(document.getElementById("popup"), "Failed to connect to the streaming server");
Display.showPopup("Failed to connect to the streaming server");
};
diff --git a/smarttv-client/Javascript/Server.js b/smarttv-client/Javascript/Server.js
index f24a789..2bd800f 100755
--- a/smarttv-client/Javascript/Server.js
+++ b/smarttv-client/Javascript/Server.js
@@ -12,8 +12,8 @@ Server.init = function()
{
var success = true;
- var splashElement = document.getElementById("splashStatus");
- Display.putInnerHTML(splashElement, "Starting Up");
+// var splashElement = document.getElementById("splashStatus");
+// Display.putInnerHTML(splashElement, "Starting Up");
if (this.XHRObj) {
this.XHRObj.destroy();
@@ -36,8 +36,8 @@ Server.fetchVideoList = function(url) {
if (this.XHRObj) {
this.XHRObj.onreadystatechange = function()
{
- var splashElement = document.getElementById("splashStatus");
- Display.putInnerHTML(splashElement, "State" + Server.XHRObj.readyState);
+// var splashElement = document.getElementById("splashStatus");
+// Display.putInnerHTML(splashElement, "State" + Server.XHRObj.readyState);
if (Server.XHRObj.readyState == 4) {
Server.createVideoList();
@@ -48,8 +48,8 @@ Server.fetchVideoList = function(url) {
this.XHRObj.send(null);
}
else {
- var splashElement = document.getElementById("splashStatus");
- Display.putInnerHTML(splashElement, "Failed !!!" );
+// var splashElement = document.getElementById("splashStatus");
+// Display.putInnerHTML(splashElement, "Failed !!!" );
Display.showPopup("Failed to create XHR");
if (this.errorCallback != null) {
@@ -62,11 +62,11 @@ Server.createVideoList = function() {
Main.log ("creating Video list now");
Main.logToServer("creating Video list now");
- var splashElement = document.getElementById("splashStatus");
- Display.putInnerHTML(splashElement, "Creating Video list now" );
+// var splashElement = document.getElementById("splashStatus");
+// Display.putInnerHTML(splashElement, "Creating Video list now" );
if (this.XHRObj.status != 200) {
- Display.putInnerHTML(splashElement, "XML Server Error " + this.XHRObj.status);
+// Display.putInnerHTML(splashElement, "XML Server Error " + this.XHRObj.status);
// Display.status("XML Server Error " + this.XHRObj.status);
// Display.showPopup("XML Server Error " + this.XHRObj.status);
if (this.errorCallback != null) {
@@ -78,7 +78,7 @@ Server.createVideoList = function() {
var xmlResponse = this.XHRObj.responseXML;
if (xmlResponse == null) {
Display.status("xmlResponse == null" );
- Display.putInnerHTML(splashElement, "Error in XML File ");
+// Display.putInnerHTML(splashElement, "Error in XML File ");
Display.showPopup("Error in XML File");
if (this.errorCallback != null) {
this.errorCallback("XmlError");
@@ -89,14 +89,14 @@ Server.createVideoList = function() {
// var xmlElement = this.XHRObj.responseXML.documentElement;
if (!xmlElement) {
- Display.putInnerHTML(splashElement, "Failed to get valid XML!!!");
+// Display.putInnerHTML(splashElement, "Failed to get valid XML!!!");
Display.status("Failed to get valid XML");
Display.showPopup("Failed to get valid XML");
return;
}
else
{
- Display.putInnerHTML(splashElement, "Parsing ...");
+// Display.putInnerHTML(splashElement, "Parsing ...");
var items = xmlElement.getElementsByTagName("item");
if (items.length == 0) {
Display.showPopup("Something wrong. Response does not contain any item");
@@ -113,16 +113,26 @@ Server.createVideoList = function() {
// var startstrVal = "";
var startVal =0;
var durVal =0;
+ var guid = "";
+ var fps = -1;
+ var ispes = "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);
- }
- catch (e) {
-
+ 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 {
+ fps = parseInt(items[index].getElementsByTagName("fps")[0].firstChild.data);
+ }
+ catch (e) {}
var desc = descriptionElement.firstChild.data;
if (titleElement && linkElement) {
@@ -131,13 +141,16 @@ Server.createVideoList = function() {
prog: progElement.firstChild.data,
desc: desc,
// startstr: startstrVal,
+ guid : guid,
start: startVal,
- dur: durVal});
+ dur: durVal,
+ ispes : ispes,
+ fps : fps});
}
}
Data.completed(this.doSort);
- Display.putInnerHTML(splashElement, "Done...");
+// Display.putInnerHTML(splashElement, "Done...");
if (this.dataReceivedCallback)
{
diff --git a/smarttv-client/Javascript/Spinner.js b/smarttv-client/Javascript/Spinner.js
new file mode 100644
index 0000000..4a9b8ea
--- /dev/null
+++ b/smarttv-client/Javascript/Spinner.js
@@ -0,0 +1,51 @@
+var Spinner =
+{
+ index : 1,
+ run: 0,
+ timeout : 0
+};
+
+Spinner.init = function () {
+// var sp_width = $("#Spinning").width();
+// var sp_height = $("#Spinning").height();
+
+ // TODO: No Abs Number please
+ $("#Spinning").children().eq(0).css({"margin-left": "43px", "margin-top": "37px"});
+};
+
+Spinner.show= function() {
+ if (this.run == 1)
+ return;
+
+ if (this.timeout > 0) {
+ clearTimeout(this.timeout);
+ this.timeout = 0;
+ }
+
+ this.index=1;
+
+ if (this.run==0) {
+ this.run=1;
+ $("#Spinning").show();
+ Spinner.step();
+ }
+};
+
+Spinner.hide= function() {
+ $("#Spinning").hide();
+ this.run=0;
+};
+
+ Spinner.step=function() {
+ $("#Spinning").children().eq(0).attr("src", "Images/spinner/loading_"+this.index+".png");
+
+ this.index++;
+
+ if (this.index > 12) {
+ this.index=1;
+ }
+
+ if (this.run) {
+ this.timeout = setTimeout("Spinner.step();", 200);
+ }
+};
diff --git a/smarttv-client/config.xml b/smarttv-client/config.xml
index 821ccb7..2c55be8 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.84</ver>
+ <ver>0.85</ver>
<mgrver></mgrver>
<fullwidget>y</fullwidget>
<movie>y</movie>
diff --git a/smarttv-client/index.html b/smarttv-client/index.html
index 7c37790..fcd7f0e 100755
--- a/smarttv-client/index.html
+++ b/smarttv-client/index.html
@@ -5,14 +5,12 @@
<title>Vdr on SmartTV</title>
<script type="text/javascript" src="$MANAGER_WIDGET/Common/OpenSrc/jquery-1.4.2.min.js"></script>
+<!-- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> -->
<!-- Common widget API -->
<script type='text/javascript' language='javascript' src='$MANAGER_WIDGET/Common/API/Widget.js'></script>
<script type='text/javascript' language='javascript' src='$MANAGER_WIDGET/Common/API/Plugin.js'></script>
<script type='text/javascript' language='javascript' src='$MANAGER_WIDGET/Common/API/TVKeyValue.js'></script>
-
- <script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/webapi/1.0/serviceapis.js"></script>
- <script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/webapi/1.0/deviceapis.js"></script>
<script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/Util/Include.js"></script>
<script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/Util/Language.js"></script>
<script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/Plugin/Define.js"></script>
@@ -26,6 +24,10 @@
<script language="javascript" type="text/javascript" src="Javascript/Audio.js"></script>
<script language="javascript" type="text/javascript" src="Javascript/Network.js"></script>
<script language="javascript" type="text/javascript" src="Javascript/Config.js"></script>
+ <script language="javascript" type="text/javascript" src="Javascript/Helpbar.js"></script>
+ <script language="javascript" type="text/javascript" src="Javascript/Options.js"></script>
+ <script language="javascript" type="text/javascript" src="Javascript/Epg.js"></script>
+ <script language="javascript" type="text/javascript" src="Javascript/Spinner.js"></script>
<!-- Style sheets -->
<link rel="stylesheet" href="CSS/Main.css" type="text/css">
@@ -47,17 +49,12 @@
</head>
- <body onload="Main.onLoad();" onunload="Main.onUnload();">
- <script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/IME_XT9/ime.js"></script>
- <script language="javascript" type="text/javascript" src="Javascript/Options.js"></script>
+ <body onunload="Main.onUnload();">
<!-- Dummy anchor as focus for key events -->
<a href='javascript:void(0);' id='anchor' onkeydown='Main.keyDown();'></a>
<!-- Layout begins -->
- <div id="splashScreen">
- <div id="splashStatus"></div>
- </div>
<div id="statusPopup"></div>
<div id="popup"></div>
<div id="selectScreen">
@@ -71,7 +68,8 @@
<div id="optionsScreen">
<div id="optionsView">
<b>Server Configurations</b><br><br>
- Address (host:port) http:// <input type="text" id="widgetServerAddr" onkeydown="Options.onInput(this)" maxlength="25">
+ Address (host:port) http://<input type="text" id="widgetServerAddr" onkeydown='Options.onInput();' maxlength="25">
+
</div>
</div>
@@ -128,5 +126,10 @@
<div id="olTimeInfo"></div>
</div>
+
+ <div id="Spinning">
+ <img ></img>
+ </div>
+
</body>
</html>