diff options
author | thlo <smarttv640@gmail.com> | 2013-03-03 21:42:04 +0100 |
---|---|---|
committer | thlo <t.lohmar@gmx.de> | 2013-03-03 21:42:04 +0100 |
commit | 026e7f57858e873f2f81ecd6c3fbe1ee0f0d7203 (patch) | |
tree | 370047071a9bf415580aa984e8186ed4acf8e18f | |
parent | 65255cd25a87509c0a75c4e09ebd33977e54ed9c (diff) | |
download | vdr-plugin-smarttvweb-026e7f57858e873f2f81ecd6c3fbe1ee0f0d7203.tar.gz vdr-plugin-smarttvweb-026e7f57858e873f2f81ecd6c3fbe1ee0f0d7203.tar.bz2 |
Version 0.91.
Direct Channel Access added for Live and Channel Numbers.
Folder Headlines.
Cropped Picture Size.
-rwxr-xr-x | smarttv-client/Javascript/Data.js | 47 | ||||
-rw-r--r-- | smarttv-client/Javascript/DirectAccess.js | 220 | ||||
-rwxr-xr-x | smarttv-client/Javascript/Display.js | 217 | ||||
-rwxr-xr-x | smarttv-client/Javascript/Main.js | 108 | ||||
-rwxr-xr-x | smarttv-client/Javascript/Player.js | 121 | ||||
-rwxr-xr-x | smarttv-client/Javascript/Server.js | 3 | ||||
-rwxr-xr-x | smarttv-client/config.xml | 2 | ||||
-rwxr-xr-x | smarttv-client/index.html | 13 |
8 files changed, 535 insertions, 196 deletions
diff --git a/smarttv-client/Javascript/Data.js b/smarttv-client/Javascript/Data.js index 1a325f8..112785e 100755 --- a/smarttv-client/Javascript/Data.js +++ b/smarttv-client/Javascript/Data.js @@ -2,6 +2,8 @@ var Data = {
assets : new Item,
folderList : [],
+ createAccessMap : false,
+ directAccessMap : {}
};
Array.prototype.remove = function(from, to) {
@@ -13,8 +15,8 @@ Array.prototype.remove = function(from, to) { Data.reset = function() {
this.assets = null;
this.assets = new Item;
-
this.folderList = [];
+ this.createAccessMap = false;
// this.folderList.push({item : this.assets, id: 0});
Main.log("Data.reset: folderList.push. this.folderList.length= " + this.folderList.length);
@@ -25,9 +27,9 @@ Data.completed= function(sort) { this.assets.sortPayload();
this.folderList.push({item : this.assets, id: 0});
- Main.log("Data.completed: folderList.push. this.folderList.length= " + this.folderList.length);
- Main.log ("Data.completed()= " +this.folderList.length);
-
+ Main.log("---------- completed ------------");
+ Main.log("Data.completed: Data.folderList.length= " + this.folderList.length);
+ Main.log("Data.completed(): createAccessMap= " + ((this.createAccessMap == true) ? "true": "false"));
};
Data.selectFolder = function (idx, first_idx) {
@@ -51,6 +53,9 @@ Data.isRootFolder = function() { };
Data.addItem = function(t_list, pyld) {
+ if (this.createAccessMap == true) {
+ this.directAccessMap[pyld.num] = [];
+ }
this.assets.addChild(t_list, pyld, 0);
};
@@ -60,6 +65,22 @@ Data.dumpFolderStruct = function(){ Main.log("---------- dumpFolderStruct Done -------");
};
+Data.dumpDirectAccessMap = function(){
+ Main.log("---------- dumpDirectAccessMap ------------");
+ for(var prop in this.directAccessMap) {
+ var s = "";
+ for (var i = 0; i < this.directAccessMap[prop].length; i++)
+ s = s + "i= " + i + " = " + this.directAccessMap[prop][i] + " ";
+ Main.log(prop + ": " + s);
+ }
+/* var i = 1;
+ for (i = 1; i < 20; i++)
+ Main.log(i + ": " + this.directAccessMap[""+i]);
+*/
+ Main.log("---------- dumpDirectAccessMap Done -------");
+
+};
+
Data.findEpgUpdateTime = function() {
return this.assets.findEpgUpdateTime(Display.GetEpochTime() + 10000, "", 0);
// min, guid, level
@@ -114,16 +135,18 @@ Item.prototype.getItem = function (title) { Item.prototype.addChild = function (key, pyld, level) {
if (key.length == 1) {
+ if (Data.createAccessMap == true) {
+ Data.directAccessMap[pyld.num].push(this.childs.length);
+ // this.titles.push({title: pyld.startstr + " - " + key , pyld : pyld});
+ }
var folder = new Item;
-// folder.title = pyld.startstr + " - " + key;
folder.title = key[0];
folder.payload = pyld;
folder.isFolder = false;
this.childs.push(folder);
-// this.titles.push({title: pyld.startstr + " - " + key , pyld : pyld});
- }
+ }
else {
- if (level > 10) {
+ if (level > 20) {
Main.log(" too many levels");
return;
}
@@ -131,13 +154,19 @@ Item.prototype.addChild = function (key, pyld, level) { var found = false;
for (var i = 0; i < this.childs.length; i++) {
if (this.childs[i].title == t) {
+ if (Data.createAccessMap == true) {
+ Data.directAccessMap[pyld.num].push(i); // should start from 1
+ }
this.childs[i].addChild(key, pyld, level +1);
found = true;
- break;
+ break;
}
}
if (found == false) {
var folder = new Item;
+ if (Data.createAccessMap == true) {
+ Data.directAccessMap[pyld.num].push(this.childs.length); // should start from 1
+ }
folder.title = t;
folder.addChild(key, pyld, level+1);
this.childs.push(folder);
diff --git a/smarttv-client/Javascript/DirectAccess.js b/smarttv-client/Javascript/DirectAccess.js new file mode 100644 index 0000000..73d9fdf --- /dev/null +++ b/smarttv-client/Javascript/DirectAccess.js @@ -0,0 +1,220 @@ +DirectAccess = {
+ created: false,
+ returnCallback : null,
+ timeout : 0,
+ timeoutObj : null,
+ delay : 1500
+};
+
+/*
+There is the Data.directAccessMap which contains an array for each channel number
+
+When I do a direct access, then I first need to "go down to root" and then apply the positions from the array.
+
+Main.selectedVideo needs to point to the selected video of that current folder
+
+
+*/
+
+DirectAccess.selectNewChannel = function (num) {
+ Main.log("DirectAccess.selectNewChannel: val= (" + num + ")");
+ if (!(num in Data.directAccessMap)){
+ Main.log("DirectAccess.selectNewChannel: val= (" + num +") not found!");
+ Notify.showNotify("Not Found", true);
+
+/* Player.stopVideo();
+ Main.changeState(0);
+ widgetAPI.blockNavigation(event);
+*/
+ return;
+ }
+
+ Main.log("DirectAccess.selectNewChannel num= " + num + " Data.directAccessMap[num]= " +Data.directAccessMap[num] );
+ if (Data.isRootFolder() != true) {
+ var itm = Data.folderUp();
+ Main.selectedVideo = itm.id;
+ }
+ // now I should be in root
+ switch(Data.directAccessMap[num].length) {
+ case 1:
+ Main.selectedVideo= Data.directAccessMap[num][0];
+ Main.log("DirectAccess.selectNewChannel num=" + num +" - Case 1: Main.selectedVideo= "+ Main.selectedVideo);
+ break;
+ case 2:
+ Main.log("DirectAccess.selectNewChannel num=" + num +" - Case 2: Data.directAccessMap[num][0]= "+ Data.directAccessMap[num][0] + " Data.directAccessMap[num][1]= " + Data.directAccessMap[num][1]);
+ if (Data.getCurrentItem().childs[Data.directAccessMap[num][0]].isFolder == true) {
+ Data.selectFolder(Data.directAccessMap[num][0], Data.directAccessMap[num][0]);
+ Main.selectedVideo= Data.directAccessMap[num][1];
+ }
+ else {
+ // Error: Should be a folder, if there is two elms in directAccessMap
+ Display.showPopup("directAccess Failed: Inconsistency in directAccessMap");
+ Main.log("ERROR in selectNewChannel num=" + num +"- Case 2: Data.directAccessMap[num][0]= "+ Data.directAccessMap[num][0] + " Data.directAccessMap[num][1]= " + Data.directAccessMap[num][1]);
+
+ Player.stopVideo();
+ Main.changeState(0);
+ widgetAPI.blockNavigation(event);
+ }
+ break;
+ default:
+ Display.showPopup("directAccess Failed: Inconsistency in directAccessMap. More than 2 elms");
+ Main.log("ERROR in selectNewChannel num=" + num +" - Data.directAccessMap[num].length= "+ Data.directAccessMap[num].length);
+ Player.stopVideo();
+ Main.changeState(0);
+ widgetAPI.blockNavigation(event);
+
+ return;
+ break;
+ }
+
+ Player.stopVideo();
+ Main.playItem();
+
+
+ //
+};
+
+DirectAccess.init = function (){
+ if (this.created == false) {
+ DirectAccess.createStyleSheet();
+ $("#directChanAccess").hide();
+ this.created = true;
+ }
+};
+
+DirectAccess.show = function () {
+ $("#directChanAccess").show();
+ $("#directAccessAnchor").focus();
+ DirectAccess.timeout = Display.GetEpochTime() + (DirectAccess.delay / 1000.0);
+ DirectAccess.timeoutObj = window.setTimeout( function() {DirectAccess.handleTimeout();}, DirectAccess.delay);
+ Main.log("DirectAccess.show: now= "+ Display.GetEpochTime() +" timeout= " + DirectAccess.timeout +" delta= " + (DirectAccess.timeout -Display.GetEpochTime()));
+ };
+
+
+DirectAccess.hide = function () {
+ Main.log("DirectAccess.hide: timeout= " + DirectAccess.timeout);
+ if (DirectAccess.timeoutObj != null) {
+ window.clearTimeout(DirectAccess.timeoutObj);
+ DirectAccess.timeoutObj = null;
+ };
+ $("#directAccessAnchor").val("");
+
+ $("#directChanAccess").hide();
+ $("#directAccessAnchor").blur();
+ Main.enableKeys();
+};
+
+DirectAccess.handleTimeout = function () {
+ Main.log("DirectAccess.handleTimeout");
+ DirectAccess.timeoutObj = null;
+ if (Display.GetEpochTime() < DirectAccess.timeout) {
+ var delta = (DirectAccess.timeout -Display.GetEpochTime()) *1000.0;
+ DirectAccess.timeoutObj = window.setTimeout( DirectAccess.handleTimeout, delta);
+ DirectAccess.timeout = Display.GetEpochTime() + (delta / 1000.0);
+ Main.log("DirectAccess.timeout: " + DirectAccess.timeout);
+ }
+ else {
+ Main.log("DirectAccess.timeout: handleEnter");
+ DirectAccess.handleEnter();
+ };
+};
+
+DirectAccess.extendTimer = function () {
+ DirectAccess.timeout = Display.GetEpochTime() + (DirectAccess.delay / 1000.0);
+ Main.log("DirectAccess.extendTimer: " + DirectAccess.timeout);
+};
+
+DirectAccess.cancel = function () {
+ DirectAccess.hide();
+};
+
+DirectAccess.handleEnter = function () {
+ Main.log("DirectAccess.handleEnter val= " +$("#directAccessAnchor").val() );
+ DirectAccess.selectNewChannel($("#directAccessAnchor").val());
+ DirectAccess.hide();
+
+ // find entry according to number
+};
+
+DirectAccess.createStyleSheet = function () {
+ var sheet = $("<style>");
+ sheet.attr({type : 'text/css',
+ innerHTML : '\
+ #directChanAccess { left: 70%; top: 10px; width:10%; height: 10%; position: absolute; \
+ text-align:center; \
+ background:rgba(0,0,139, 0.8);\
+ border-width:1px;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;}\
+ #directAccessAnchor {background-color:transparent;text-align: right;font-size:20px}\
+ '});
+
+ $('body').append(sheet);
+};
+
+DirectAccess.onInput = function () {
+ var keyCode = event.keyCode;
+ var input ="";
+ if (input.length == 4)
+ input= $("#directAccessAnchor").val().slice(1);
+ else
+ input= $("#directAccessAnchor").val();
+// $("#directAccessAnchor").val(input.slice(1));
+ Main.log("DirectAccess.onInput: " + keyCode + " Val= " + $("#directAccessAnchor").val());
+ DirectAccess.extendTimer();
+ switch(keyCode) {
+ case tvKey.KEY_0:
+ $("#directAccessAnchor").val(input + "0");
+ widgetAPI.blockNavigation(event);
+
+ break;
+ case tvKey.KEY_1:
+ $("#directAccessAnchor").val(input + "1");
+ widgetAPI.blockNavigation(event);
+ break;
+ case tvKey.KEY_2:
+ $("#directAccessAnchor").val(input + "2");
+ widgetAPI.blockNavigation(event);
+ break;
+ case tvKey.KEY_3:
+ $("#directAccessAnchor").val(input + "3");
+ widgetAPI.blockNavigation(event);
+ break;
+ case tvKey.KEY_4:
+ $("#directAccessAnchor").val(input + "4");
+ widgetAPI.blockNavigation(event);
+ break;
+ case tvKey.KEY_5:
+ $("#directAccessAnchor").val(input + "5");
+ widgetAPI.blockNavigation(event);
+ break;
+ case tvKey.KEY_6:
+ $("#directAccessAnchor").val(input + "6");
+ widgetAPI.blockNavigation(event);
+ break;
+ case tvKey.KEY_7:
+ $("#directAccessAnchor").val(input + "7");
+ widgetAPI.blockNavigation(event);
+ break;
+ case tvKey.KEY_8:
+ $("#directAccessAnchor").val(input + "8");
+ widgetAPI.blockNavigation(event);
+ break;
+ case tvKey.KEY_9:
+ $("#directAccessAnchor").val(input + "9");
+ widgetAPI.blockNavigation(event);
+ break;
+ case tvKey.KEY_ENTER:
+ //Search channel
+ DirectAccess.handleEnter ();
+ widgetAPI.blockNavigation(event);
+ break;
+ case tvKey.KEY_RETURN:
+ case tvKey.KEY_EXIT:
+ DirectAccess.hide();
+ if (this.returnCallback != null)
+ this.returnCallback();
+ widgetAPI.blockNavigation(event);
+ break;
+ };
+ widgetAPI.blockNavigation(event);
+};
\ No newline at end of file diff --git a/smarttv-client/Javascript/Display.js b/smarttv-client/Javascript/Display.js index a391491..c3df32f 100755 --- a/smarttv-client/Javascript/Display.js +++ b/smarttv-client/Javascript/Display.js @@ -6,15 +6,13 @@ var Display = bufferingElm : null,
FIRSTIDX : 0,
LASTIDX : 15,
- itemHeight : 0,
- currentWindow : 0,
+ currentWindow : 0, // always from 0 ...
olTitle : "",
olStartStop: "",
SELECTOR : 0,
LIST : 1,
-// folderPath : new Array(),
volOlHandler : null,
progOlHandler : null,
popupOlHandler : null,
@@ -38,7 +36,6 @@ Display.init = function() this.bufferingElm = document.getElementById("bufferingBar");
-// Main.log("Display.init now=" + this.pluginTime.GetEpochTime());
this.progOlHandler = new OverlayHandler("ProgHndl");
this.volOlHandler = new OverlayHandler("VolHndl");
@@ -47,12 +44,11 @@ Display.init = function() this.volOlHandler.init(Display.handlerShowVolume, Display.handlerHideVolume);
this.popupOlHandler.init(Display.handlerShowPopup, Display.handlerHidePopup);
- if (!this.statusDiv)
- {
+ if (!this.statusDiv) {
success = false;
}
- for (var i = 0; i <= this.LASTIDX; i++) {
+ for (var i = this.FIRSTIDX; i <= this.LASTIDX; i++) {
var elm = $("#video"+i);
$(elm).css({"width" : "100%", "text-align": "left", "padding-top": "4px", "padding-bottom": "5px" });
$(elm).append($("<div>").css({ "display": "inline-block", "width":"20%",
@@ -63,19 +59,6 @@ Display.init = function() "height": "14px"}));
}
-
-/* for (var i = 0; i <= this.LASTIDX; 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%",
- "overflow": "hidden", "text-overflow":"ellipsis"}));
- $(elm).append($("<div>").css({ "display": "inline-block", "padding-top": "4px", "padding-bottom": "6px", "width":"70%",
- "overflow": "hidden", "text-overflow":"ellipsis"}));
- $(elm).append($("<div>").css({ "display": "inline-block", "padding-top": "4px", "padding-bottom": "6px", "width":"5%"
- }));
- }
-*/
-
var done = false;
var i = 0;
@@ -84,7 +67,6 @@ Display.init = function() var elm = document.getElementById("selectItem"+i);
if (elm == null) {
done = true;
- Main.log( " only found to selectItem"+ (i-1));
break;
}
elm.style.paddingBottom = "3px";
@@ -99,7 +81,6 @@ Display.init = function() Display.putInnerHTML = function (elm, val) {
-// alert(Config.deviceType + " " +elm + " " + val);
switch (Config.deviceType) {
case 0:
// Samsung specific handling of innerHtml
@@ -186,7 +167,6 @@ Display.selectItem = function (item) { item.style.borderRadius= "3px";
item.style["-webkit-box-shadow"] = "2px 2px 1px 2px rgba(0,0,0, 0.5)";
// item.style.backgroundColor = "white";
-
};
Display.unselectItem = function (item) {
@@ -222,7 +202,6 @@ Display.resetSelectItems = function (itm) { var elm = document.getElementById("selectItem"+i);
if (elm == null) {
done = true;
- Main.log( " only found to selectItem"+ (i-1));
break;
}
Display.unselectItem(elm);
@@ -234,8 +213,36 @@ Display.resetSelectItems = function (itm) { * Video Select Screen Functions
*
*/
+
+Display.addHeadline = function (name) {
+// Add the headline to first element
+// Main.log("Display.addHeadline " + name);
+ Display.setVideoItem(document.getElementById("video0"), {c1: "", c2: name, c3: ""});
+ Display.FIRSTIDX= 1;
+
+ var item = document.getElementById("video0");
+ item.style.color = "black";
+// item.style.background = "linear-gradient(0deg, #1e5799 0%,#2989d8 41%,#7db9e8 100%)";
+ item.style.background = "-webkit-linear-gradient(top, #1e5799 0%,#2989d8 41%,#7db9e8 100%)";
+ item.style.borderRadius= "3px";
+ item.style["-webkit-box-shadow"] = "2px 2px 1px 2px rgba(0,0,0, 0.5)";
+
+};
+
+Display.removeHeadline = function () {
+// Main.log("Display.removeHeadline ");
+ Display.FIRSTIDX= 0;
+
+ var item = document.getElementById("video0");
+ item.style.color = "white";
+ item.style.backgroundColor = "transparent";
+ item.style.background = "transparent";
+ item.style.borderRadius= "0px";
+ item.style["-webkit-box-shadow"] = "";
+
+};
+
Display.hide = function() {
-// document.getElementById("main").style.display="none";
$("#main").hide();
};
@@ -244,10 +251,7 @@ Display.show = function() { this.volOlHandler.cancel();
this.progOlHandler.cancel();
this.popupOlHandler.cancel();
-// document.getElementById("main").style.display="block";
$("#main").show();
-
- this.itemHeight = Math.round(parseInt($("#videoList").height()) / (this.LASTIDX +1) );
};
Display.tuneLeftSide = function() {
@@ -271,38 +275,39 @@ Display.tuneLeftSide = function() { Main.logToServer("ERROR in Display.tuneLeftSide. Should not be here");
break;
}
-// Main.log("Display.tuneLeftSide: w1= " + res.w1 +" w2= " + res.w2 + " w3= " + res.w3 );
return res;
};
+Display.getNumberOfVideoListItems = function () {
+ return (Display.LASTIDX + 1 - Display.FIRSTIDX);
+};
+
Display.setVideoList = function(selected, first) {
var listHTML = "";
var res = {};
-// var first_item = selected;
var first_item = first; //thlo
-// var first_item = selected - ( selected % (Display.LASTIDX +1))
+
+// Main.log("Display.setVideoList selected= " + selected + " first= " + first + " curWin= " + this.currentWindow + " NoOfItems= " + Display.getNumberOfVideoListItems());
tab_style = Display.tuneLeftSide();
var i=0;
- var max_idx = (Data.getVideoCount() < (this.LASTIDX +1)) ? Data.getVideoCount() :(this.LASTIDX+1) ;
- Main.log("Display.setVideoList title= " +Data.getCurrentItem().childs[selected].title + " selected= " + selected + " first_item= " + first_item);
+ var max_idx = (Data.getVideoCount() < Display.getNumberOfVideoListItems()) ? Data.getVideoCount() :(Display.getNumberOfVideoListItems()) ;
+// Main.log("Display.setVideoList max_idx= " + max_idx + " NoOfItems= " + Display.getNumberOfVideoListItems());
+// Main.log("Display.setVideoList title= " +Data.getCurrentItem().childs[selected].title + " selected= " + selected + " first_item= " + first_item + " FIRSTIDX= " + this.FIRSTIDX);
this.handleDescription(selected);
-// for (i = 0; i <= this.LASTIDX; i++) {
var idx = 0;
for (i = 0; i < max_idx; i++) {
if ((first_item+i) <0) {
// wrap around
-// res = {c1: "", c2: "", c3: ""};
-// Main.log ("first_item= " + first_item + " i= " + i + " VideoCount()= " +Data.getVideoCount() );
idx = (first_item+i) + Data.getVideoCount();
res = Display.getDisplayTitle (Data.getCurrentItem().childs[(first_item+i) + Data.getVideoCount()]);
}
else if ((first_item+i) >= Data.getVideoCount()) {
- Main.log ("first_item= " + first_item + " i= " + i + " VideoCount()= " +Data.getVideoCount() );
+// Main.log ("first_item= " + first_item + " i= " + i + " VideoCount()= " +Data.getVideoCount() );
idx = (first_item+i) - Data.getVideoCount();
res = Display.getDisplayTitle (Data.getCurrentItem().childs[(first_item+i) - Data.getVideoCount()]);
}
@@ -310,27 +315,24 @@ Display.setVideoList = function(selected, first) { idx = first_item+i;
res = Display.getDisplayTitle (Data.getCurrentItem().childs[first_item+i]);
}
- this.videoList[i] = document.getElementById("video"+i);
- Display.setVideoItem(this.videoList[i], res, (idx == 0)? true : false, tab_style);
- // TODO: mark element with position == 0
-
- this.unselectItem(this.videoList[i]);
+ this.videoList[i + this.FIRSTIDX] = document.getElementById("video"+(i+ this.FIRSTIDX));
+ Display.setVideoItem(this.videoList[(i+ this.FIRSTIDX)], res, (idx == 0)? true : false, tab_style);
+ this.unselectItem(this.videoList[(i+ this.FIRSTIDX)]);
}
- if (max_idx < (this.LASTIDX +1)) {
- for (i = max_idx; i <= this.LASTIDX; i++) {
- this.videoList[i] = document.getElementById("video"+i);
- Display.setVideoItem(this.videoList[i], {c1: "", c2: "", c3: ""}, false, tab_style);
-
+ if (max_idx < Display.getNumberOfVideoListItems()) {
+ for (i = max_idx; i < Display.getNumberOfVideoListItems(); i++) {
+ this.videoList[(i+ this.FIRSTIDX)] = document.getElementById("video"+(i+ this.FIRSTIDX));
+ Display.setVideoItem(this.videoList[(i+ this.FIRSTIDX)], {c1: "", c2: "", c3: ""}, false, tab_style);
+ this.unselectItem(this.videoList[i+ this.FIRSTIDX]);
}
}
this.currentWindow = (selected - first_item);
- this.selectItem(this.videoList[this.currentWindow]);
+ this.selectItem(this.videoList[(this.currentWindow+ this.FIRSTIDX)]);
listHTML = (selected +1) + " / " + Data.getVideoCount();
$("#videoCount").text(listHTML);
-// Display.putInnerHTML(document.getElementById("videoCount"), listHTML);
};
Display.setVideoItem = function (elm, cnt, top, style) {
@@ -341,7 +343,6 @@ Display.setVideoItem = function (elm, cnt, top, style) { if (typeof(style) != "undefined") {
-// Main.log ("Display.setVideoItem: change style w1= " + style.w1 + " w2= " + style.w2 + " w3= " + style.w3);
$(elm).children("div").eq(0).css("width", style.w1 );
$(elm).children("div").eq(1).css("width", style.w2 );
$(elm).children("div").eq(2).css("width", style.w3 );
@@ -359,6 +360,9 @@ Display.setVideoItem = function (elm, cnt, top, style) { Display.resetVideoList = function () {
var done = false;
var i = 0;
+
+ Display.removeHeadline();
+
while (done != true) {
var elm = document.getElementById("video"+i);
if (elm == null) {
@@ -379,7 +383,6 @@ Display.resetDescription = function () { //Video Select Screen
Display.handleDescription =function (selected) {
-// Main.log("Display.handleDescription ");
if (Data.getCurrentItem().childs[selected].isFolder == true) {
Display.setDescription( "Dir: " +Data.getCurrentItem().childs[selected].title );
@@ -409,7 +412,6 @@ Display.handleDescription =function (selected) { msg += "<b>"+ prog + "</b><br>";
msg += "<br>Start: " + d_str + "<br>";
msg += "Duration: " + Display.durationString(length) + "h<br>";
-// Main.log("itm.payload.start= " + itm.payload.start + " length= " + length + " now= " +now);
msg += "Remaining: " + Display.durationString((itm.payload.start + length - now));
msg += "<br><br>"+ desc;
break;
@@ -439,62 +441,56 @@ Display.handleDescription =function (selected) { /*
* this.currentWindow: Cursor (selected item)
*/
-Display.setVideoListPosition = function(position, move) {
-// Main.log ("Display.setVideoListPosition title= " +Data.getCurrentItem().childs[position].title + " move= " +move);
-// Main.log("Display.setVideoListPosition vidCount= " + Data.getVideoCount() + " LASTIDX= " + this.LASTIDX);
+Display.setVideoListPosition = function(position, move) {
+// Main.log("Display.setVideoListPosition position= " + position );
this.handleDescription(position);
$("#videoCount").text((position + 1) + " / " + Data.getVideoCount());
-
- if(Data.getVideoCount() <= (this.LASTIDX+1)) {
- // videos fit into the video list. No spill overs.
+
+ if(Data.getVideoCount() <= Display.getNumberOfVideoListItems()) {
+ // videos fit into the video list. No spill overs, so no scrolling.
this.currentWindow = position;
-// Main.log("Display.setVideoListPosition: currentWindow= " + this.currentWindow)
- for (var i = 0; i < Data.getVideoCount(); i++)
- {
- if(i == position)
- this.selectItem(this.videoList[i]);
+ for (var i = 0; i < Data.getVideoCount(); i++) {
+ if(i == this.currentWindow)
+ this.selectItem(this.videoList[(i+ this.FIRSTIDX)]);
else
- this.unselectItem(this.videoList[i]);
-
+ this.unselectItem(this.videoList[(i+ this.FIRSTIDX)]);
}
+
}
- else if((this.currentWindow!=this.LASTIDX && move==Main.DOWN) || (this.currentWindow!=this.FIRSTIDX && move==Main.UP))
- {
- // Just move cursor
+ else if((this.currentWindow!=(this.LASTIDX -this.FIRSTIDX) && move==Main.DOWN) || (this.currentWindow!=0 && move==Main.UP)) {
+ // Just move cursor, all items used
if(move == Main.DOWN)
this.currentWindow ++;
else
this.currentWindow --;
-
- for (var i = 0; i <= this.LASTIDX; i++) {
+ for (var i = 0; i < Display.getNumberOfVideoListItems(); i++) {
if(i == this.currentWindow)
- this.selectItem(this.videoList[i]);
+ this.selectItem(this.videoList[(i+this.FIRSTIDX)]);
else
- this.unselectItem(this.videoList[i]);
+ this.unselectItem(this.videoList[(i+this.FIRSTIDX)]);
}
}
- else if(this.currentWindow == this.LASTIDX && move == Main.DOWN) {
+ else if(this.currentWindow == (this.LASTIDX -this.FIRSTIDX)&& move == Main.DOWN) {
// Next Page
- Main.log("Display.setVideoListPosition: next page. position= " + position);
+// Main.log("Display.setVideoListPosition: next page. position= " + position);
var c_pos = position - this.currentWindow;
if (c_pos < 0)
c_pos += Data.getVideoCount();
- for(i = 0; i <= this.LASTIDX; i++) {
-// var idx = (i + position - this.currentWindow) %Data.getVideoCount();
+
+ for(i = 0; i < Display.getNumberOfVideoListItems(); i++) {
var idx = (i + c_pos) %Data.getVideoCount();
Main.log("idx= " + idx);
- Display.setVideoItem(this.videoList[i], Display.getDisplayTitle (Data.getCurrentItem().childs[idx]), (idx == 0)? true: false);
- // TODO: mark element with position == 0
+ Display.setVideoItem(this.videoList[(i+this.FIRSTIDX)], Display.getDisplayTitle (Data.getCurrentItem().childs[idx]), (idx == 0)? true: false);
}
}
- else if(this.currentWindow == this.FIRSTIDX && move == Main.UP) {
+ else if(this.currentWindow == 0 && move == Main.UP) {
// Previous Page
- Main.log("Display.setVideoListPosition: previous page. position= " + position);
- for(i = 0; i <= this.LASTIDX; i++) {
+// Main.log("Display.setVideoListPosition: previous page. position= " + position);
+
+ for(i = 0; i < Display.getNumberOfVideoListItems(); i++) {
var idx = (i + position) %Data.getVideoCount();
- Display.setVideoItem(this.videoList[i], Display.getDisplayTitle (Data.getCurrentItem().childs[idx]), (idx == 0) ?true: false);
- // TODO: mark element with position == 0
+ Display.setVideoItem(this.videoList[(i+this.FIRSTIDX)], Display.getDisplayTitle (Data.getCurrentItem().childs[idx]), (idx == 0) ?true: false);
}
}
};
@@ -515,6 +511,7 @@ Display.getDisplayTitle = function(item) { res.c3 = "<" + Display.getNumString(item.childs.length, 2) +">";
}
else {
+ res.c1 = item.payload.num;
res.c2 = item.title;
}
break;
@@ -599,10 +596,8 @@ Display.updateOlForLive = function (start_time, duration, now) { Player.totalTime = Data.getCurrentItem().childs[Main.selectedVideo].payload.dur * 1000;
Player.totalTimeStr =Display.durationString(Player.totalTime / 1000.0);
-// Display.updateTotalTime(Player.totalTime);
- var digi = new Date((Data.getCurrentItem().childs[Main.selectedVideo].payload.start*1000));
- Main.log (" Date(): StartTime= " + digi.getHours() + ":" + digi.getMinutes() + ":" + digi.getSeconds());
-// Player.cptOffset = (now - Data.getCurrentItem().childs[Main.selectedVideo].payload.start) * 1000;
+// var digi = new Date((Data.getCurrentItem().childs[Main.selectedVideo].payload.start*1000));
+// Main.log (" Date(): StartTime= " + digi.getHours() + ":" + digi.getMinutes() + ":" + digi.getSeconds());
Player.setCurrentPlayTimeOffset((now - Data.getCurrentItem().childs[Main.selectedVideo].payload.start) * 1000);
Player.OnCurrentPlayTime(0); // updates the HTML elements of the Progressbar
};
@@ -610,23 +605,15 @@ Display.updateOlForLive = function (start_time, duration, now) { Display.setOlTitle = function (title) {
this.olTitle = title;
$("#olTitle").text(this.olTitle);
-// Main.log("Display.setOlTitle: font-size=" + $("#olTitle").css("font-size"));
-// Main.log("Display.setOlTitle: height=" + $("#olTitle").css("height"));
-// Main.log("Display.setOlTitle: outerHeight=" + $("#olTitle").outerHeight());
-
-// var elm = document.getElementById("olTitle");
-// Display.putInnerHTML(elm, Display.olTitle);
};
Display.resetStartStop = function () {
- Main.log("Display.resetStartStop");
+// Main.log("Display.resetStartStop");
Display.olStartStop = "";
Display.hideOlStartStop();
$("#olStartStop").text("");
-/* var elm = document.getElementById("olStartStop");
- Display.putInnerHTML(elm, Display.olStartStop);
-*/
};
+
Display.setStartStop = function(start, stop) {
this.olStartStop = "";
Display.showOlStartStop();
@@ -647,13 +634,10 @@ Display.setStartStop = function(start, stop) { $("#olStartStop").text(Display.olStartStop);
-/* var elm = document.getElementById("olStartStop");
- Display.putInnerHTML(elm, Display.olStartStop);
- */
};
Display.setSkipDuration = function(duration) {
- Main.log("Display.setSkipDuration: duration= " +duration);
+// Main.log("Display.setSkipDuration: duration= " +duration);
this.olStartStop = "";
// if (this.olStartStop == "")
Display.showOlStartStop();
@@ -661,10 +645,6 @@ Display.setSkipDuration = function(duration) { this.olStartStop = duration;
$("#olStartStop").text("Next Skip: " + Display.olStartStop+"sec");
-
-/* var elm = document.getElementById("olStartStop");
- Display.putInnerHTML(elm, "Next Skip: " + Display.olStartStop+"sec");
- */
};
Display.setTrickplay = function(direction, multiple) {
@@ -675,24 +655,16 @@ Display.setTrickplay = function(direction, multiple) { 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);
-// var timeElement = document.getElementById("olTimeInfo");
-// Display.putInnerHTML(timeElement, Player.curPlayTimeStr + " / " + Player.totalTimeStr);
$("#olTimeInfo").text(Player.curPlayTimeStr + " / " + Player.totalTimeStr);
};
Display.updateProgressBar = function () {
var timePercent = (Player.curPlayTime *100)/ Player.totalTime;
-// document.getElementById("olProgressBar").style.width = Math.round(timePercent) + "%";
$("#olProgressBar").css("width", (Math.round(timePercent) + "%"));
};
@@ -700,19 +672,14 @@ Display.updateRecBar = function (start_time, duration){ var now = Display.GetEpochTime();
var remaining = Math.round(((start_time + duration) - now) * 100/ duration);
-// Main.log (" remaining= " + remaining + " start= " + start_time + " dur= " + duration);
-// var elm = document.getElementById("olRecProgressBar");
$("#olRecProgressBar").show();
-// elm.style.display="block";
$("#olRecProgressBar").css({"width": (remaining + "%"), "left": ((100 - remaining) + "%")});
-// elm.style.width = remaining + "%";
-// elm.style.left = (100 - remaining) + "%";
};
Display.status = function(status) {
- Main.log("Display.status: " +status);
+// Main.log("Display.status: " +status);
Display.putInnerHTML(this.statusDiv, status);
Display.putInnerHTML(this.statusPopup, status);
};
@@ -815,7 +782,7 @@ Display.handlerShowProgress = function() { document.getElementById("olRecProgressBar").style.display="block";
var now = Display.GetEpochTime();
var remaining = Math.round(((Player.startTime + Player.duration) - now) * 100/ Player.duration);
- Main.log (" remaining= " + remaining);
+// Main.log (" remaining= " + remaining);
var elm = document.getElementById("olRecProgressBar");
elm.style.display="block";
elm.style.width = remaining + "%";
@@ -826,13 +793,11 @@ Display.handlerShowProgress = function() { var timePercent = (Player.curPlayTime *100)/ Player.totalTime;
- Main.log("show OL Progress timePercent= " + timePercent);
+// Main.log("show OL Progress timePercent= " + timePercent);
document.getElementById("olProgressBar").style.width = timePercent + "%";
$("#olTimeInfo").text(Player.curPlayTimeStr + " / " + Player.totalTimeStr);
-// var timeElement = document.getElementById("olTimeInfo");
-// Display.putInnerHTML(timeElement, Player.curPlayTimeStr + " / " + Player.totalTimeStr);
var Digital=new Date();
var hours=Digital.getHours();
@@ -840,8 +805,6 @@ Display.handlerShowProgress = function() { if (minutes<=9)
minutes='0'+minutes;
$("#olNow").text(hours + ':' + minutes);
-// var nowElement = document.getElementById("olNow");
-// Display.putInnerHTML(nowElement, hours + ':' + minutes);
};
@@ -906,7 +869,6 @@ OverlayHandler.prototype.init = function(showcb, hidecb) { success = false;
}
*/
- // Main.log(this.handlerName + " is initialized");
return success;
};
@@ -933,12 +895,10 @@ OverlayHandler.prototype.checkHideCallback = function () { OverlayHandler.prototype.show = function() {
if (!this.active ) {
-// this.startTime = this.pluginTime.GetEpochTime();
this.startTime = Display.GetEpochTime();
this.hideTime = this.startTime + (this.olDelay / 1000);
-// Main.log(this.handlerName + " showing " + this.handlerName + " from= " + this.startTime + " to at least= " + this.hideTime);
if (this.showCallback) {
this.showCallback();
@@ -959,7 +919,6 @@ OverlayHandler.prototype.cancel = function () { if (!this.active)
return;
-// Main.log("cancel for handler " + this.handlerName);
if (this.hideCallback) {
this.hideCallback();
}
diff --git a/smarttv-client/Javascript/Main.js b/smarttv-client/Javascript/Main.js index 9bbf34e..f18948a 100755 --- a/smarttv-client/Javascript/Main.js +++ b/smarttv-client/Javascript/Main.js @@ -29,13 +29,6 @@ catch (e) { */
-/*
- * TODO:
- * Audio Track Select
- * Screensaver (using setOnScreenSaver() from common modules)
- */
-
-
var Main = {
state : 0, // selectScreen
@@ -104,8 +97,6 @@ Main.onLoad = function() { this.menuKeyHndl = new cMenuKeyHndl(this.defKeyHndl);
this.selectMenuKeyHndl = new cSelectMenuKeyHndl(this.defKeyHndl);
- Main.log (" created KeyHandlers");
-
Config.init();
};
@@ -146,10 +137,13 @@ Main.init = function () { Display.setVideoList(Main.selectedVideo, Main.selectedVideo);
Spinner.hide();
Display.show();
-// if (Player.isLive == true) {
+
+ if (Data.createAccessMap == true) {
+ Data.dumpDirectAccessMap();
+ }
if (Main.state == Main.eLIVE) {
- Epg.startEpgUpdating();
- }
+ Epg.startEpgUpdating();
+ }
};
// Enable key event processing
@@ -161,9 +155,10 @@ Main.init = function () { }
ClockHandler.start("#selectNow");
-
Server.updateVdrStatus();
+ DirectAccess.init();
+// DirectAccess.show();
// Display.initOlForRecordings();
/*
* Fetch JS file
@@ -292,6 +287,7 @@ Main.liveSelected = function() { Player.isLive = true;
Server.setSort(false);
Server.errorCallback = Main.serverError;
+ Data.createAccessMap = true;
Spinner.show();
Server.fetchVideoList(Config.serverUrl + "/channels.xml?channels="+Config.liveChannels); /* Request video information from server */
};
@@ -309,7 +305,6 @@ Main.recordingsSelected = function() { Server.errorCallback = Main.serverError;
};
*/
-// Player.isLive = false; // TODO: obsolete
Server.setSort(true);
/* if (Config.format == "") {
Server.fetchVideoList(Config.serverUrl + "/recordings.xml?model=samsung");
@@ -433,8 +428,6 @@ Main.playItem = function (url) { Display.showProgress();
Player.isLive = true;
-// Player.bufferState = 0; //TODO: Obsolete
-// Player.isRecording = false; //TODO: Obsolete
Display.updateOlForLive (start_time, duration, now);
Main.log ("Live now= " + now + " StartTime= " + Data.getCurrentItem().childs[Main.selectedVideo].payload.start + " offset= " +Player.cptOffset );
@@ -446,16 +439,11 @@ Main.playItem = function (url) { Player.playVideo(-1);
break;
case Main.eREC:
-// Display.resetStartStop(); //TODO Obsolete
-// Main.getResume(Data.getCurrentItem().childs[Main.selectedVideo].payload.guid);
var url_ext = "";
Player.mFormat = Player.ePDL;
// Server.getResume(Player.guid);
-// Player.setCurrentPlayTimeOffset(0); //TODO: reset at stop
-// Player.isLive = false; //TODO: reset at stop
-// Player.isRecording = false; //TODO: reset at stop
Main.log(" playItem: now= " + now + " start_time= " + start_time + " dur= " + duration + " (Start + Dur - now)= " + ((start_time + duration) -now));
Player.totalTime = Data.getCurrentItem().childs[Main.selectedVideo].payload.dur * 1000;
@@ -528,14 +516,9 @@ Main.playItem = function (url) { Display.showProgress();
Player.mFormat = Player.ePDL;
-// Player.setCurrentPlayTimeOffset(0); //TODO: reset at stop
-// Player.isLive = false; //TODO: reset at stop
-// Player.isRecording = false;//TODO: reset at stop
Main.log(" playItem: now= " + now + " start_time= " + start_time + " dur= " + duration + " (Start + Dur - now)= " + ((start_time + duration) -now));
- // document.getElementById("olRecProgressBar").display="none"; //TODO: reset at stop
Display.setOlTitle(Data.getCurrentItem().childs[Main.selectedVideo].title);
-// Display.resetStartStop(); //TODO: reset at stop
Player.setVideoURL( Data.getCurrentItem().childs[Main.selectedVideo].payload.link);
Player.playVideo(-1);
@@ -556,7 +539,9 @@ Main.selectPageUp = function() { return;
};
*/
- Main.previousVideo(Display.LASTIDX + 1);
+// Main.previousVideo(Display.LASTIDX + 1);
+ Main.previousVideo(Display.getNumberOfVideoListItems());
+
/* this.selectedVideo = (this.selectedVideo - (Display.LASTIDX + 1));
if (this.selectedVideo < 0) {
this.selectedVideo = 0;
@@ -571,7 +556,8 @@ Main.selectPageUp = function() { };
Main.selectPageDown = function() {
- Main.nextVideo (Display.LASTIDX + 1);
+// Main.nextVideo (Display.LASTIDX + 1);
+ Main.nextVideo (Display.getNumberOfVideoListItems());
/* this.selectedVideo = (this.selectedVideo + Display.LASTIDX + 1);
if (this.selectedVideo >= Data.getVideoCount()) {
@@ -587,6 +573,10 @@ Main.selectPageDown = function() { Main.nextVideo = function(no) {
// Just move the selectedVideo pointer and ensure wrap around
+ // Should I do anything, when no < Data.getVideoCount()?
+ if (no > Data.getVideoCount())
+ return;
+ Main.log("Main.nextVideo: selVid(in)= " + this.selectedVideo + " no= " + no + " vids= " + Data.getVideoCount() + " (no% Data.getVideoCount())= " +(no% Data.getVideoCount()));
this.selectedVideo = (this.selectedVideo + (no% Data.getVideoCount())) % Data.getVideoCount();
Main.log("Main.nextVideo= " + this.selectedVideo + " no= " + no);
};
@@ -596,6 +586,8 @@ Main.previousVideo = function(no) { // Issue: I deduct a number, which is larger than videoCount
// only jumps, which are mod videoCount?
+ if (no > Data.getVideoCount())
+ return;
this.selectedVideo = (this.selectedVideo - (no% Data.getVideoCount()));
if (this.selectedVideo < 0) {
Main.log("Main.previousVideo: below Zero (" +this.selectedVideo+"), adding " + Data.getVideoCount());
@@ -635,7 +627,6 @@ function cPlayStateKeyHndl(def_hndl) { cPlayStateKeyHndl.prototype.handleKeyDown = function (event) {
-// var keyCode = event.keyCode;
var keyCode = event.keyCode;
if(Player.getState() == Player.STOPPED) {
@@ -724,7 +715,8 @@ cPlayStateKeyHndl.prototype.handleKeyDown = function (event) { Notify.showNotify("Recording!!!", true);
}
else */
- if (Player.mFormat != Player.ePDL )
+// if (Player.mFormat != Player.ePDL )
+ if (Player.mFormat == Player.eHLS )
Notify.showNotify("Not supported", true);
else
Player.fastForwardVideo();
@@ -737,7 +729,8 @@ cPlayStateKeyHndl.prototype.handleKeyDown = function (event) { Notify.showNotify("Recording!!!", true);
}
else */
- if (Player.mFormat != Player.ePDL )
+// if (Player.mFormat != Player.ePDL )
+ if (Player.mFormat == Player.eHLS )
Notify.showNotify("Not supported", true);
else
Player.RewindVideo();
@@ -779,6 +772,7 @@ cPlayStateKeyHndl.prototype.handleKeyDown = function (event) { Player.adjustSkipDuration(2);
Display.showProgress();
break;
+ case tvKey.KEY_INFO:
case tvKey.KEY_ASPECT:
Player.toggleAspectRatio();
break;
@@ -831,7 +825,23 @@ cLivePlayStateKeyHndl.prototype.handleKeyDown = function (event) { Main.log(this.handlerName+": Key pressed: " + Main.getKeyCode(keyCode));
switch(keyCode) {
-// case tvKey.KEY_1:
+ case tvKey.KEY_INFO:
+ case tvKey.KEY_ASPECT:
+ Player.toggleAspectRatio();
+ break;
+
+ case tvKey.KEY_0:
+ case tvKey.KEY_1:
+ case tvKey.KEY_2:
+ case tvKey.KEY_3:
+ case tvKey.KEY_4:
+ case tvKey.KEY_5:
+ case tvKey.KEY_6:
+ case tvKey.KEY_7:
+ case tvKey.KEY_8:
+ case tvKey.KEY_9:
+ DirectAccess.show();
+ break;
case tvKey.KEY_UP:
case tvKey.KEY_CH_UP:
Main.log("Prog Up");
@@ -881,9 +891,7 @@ cLivePlayStateKeyHndl.prototype.handleKeyDown = function (event) { Data.selectFolder(Main.selectedVideo, Main.selectedVideo);
Main.selectedVideo= Data.getVideoCount()-1;
}
-
-// Main.previousVideo(1);
-
+
Main.playItem();
break;
@@ -900,7 +908,8 @@ cLivePlayStateKeyHndl.prototype.handleKeyDown = function (event) { case tvKey.KEY_STOP:
Main.log("STOP");
Player.stopVideo();
- Display.setVideoList(Main.selectedVideo, Main.selectedVideo- ( Main.selectedVideo % (Display.LASTIDX +1)));
+// Display.setVideoList(Main.selectedVideo, Main.selectedVideo- ( Main.selectedVideo % (Display.LASTIDX +1)));
+ Display.setVideoList(Main.selectedVideo, Main.selectedVideo- ( Main.selectedVideo % Display.getNumberOfVideoListItems()));
Display.show();
widgetAPI.blockNavigation(event);
@@ -908,6 +917,7 @@ cLivePlayStateKeyHndl.prototype.handleKeyDown = function (event) { case tvKey.KEY_PAUSE:
Main.log("PAUSE");
break;
+ case tvKey.KEY_INFO:
case tvKey.KEY_ASPECT:
Player.toggleAspectRatio();
break;
@@ -950,6 +960,21 @@ cMenuKeyHndl.prototype.handleKeyDown = function (event) { var keyCode = event.keyCode;
switch(keyCode) {
+ case tvKey.KEY_0:
+ case tvKey.KEY_1:
+ case tvKey.KEY_2:
+ case tvKey.KEY_3:
+ case tvKey.KEY_4:
+ case tvKey.KEY_5:
+ case tvKey.KEY_6:
+ case tvKey.KEY_7:
+ case tvKey.KEY_8:
+ case tvKey.KEY_9:
+ if (Main.state == Main.eLIVE) {
+ Main.log("cMenu DirectAccess: keyCode= " + keyCode);
+ DirectAccess.show();
+ }
+ break;
case tvKey.KEY_RIGHT:
@@ -980,7 +1005,9 @@ cMenuKeyHndl.prototype.handleKeyDown = function (event) { Main.log ("selectFolder= " +Main.selectedVideo);
Data.selectFolder(Main.selectedVideo, (Main.selectedVideo - Display.currentWindow));
Main.selectedVideo= 0;
+ Display.addHeadline(Data.getCurrentItem().title);
Display.setVideoList(Main.selectedVideo, Main.selectedVideo); // thlo
+
}
else{
/* Display.hide();
@@ -1002,6 +1029,12 @@ cMenuKeyHndl.prototype.handleKeyDown = function (event) { var itm = Data.folderUp();
Main.selectedVideo = itm.id;
Main.log("folderUp selectedVideo= " + Main.selectedVideo);
+ if (Data.isRootFolder() == true) {
+ Display.removeHeadline();
+ }
+ else {
+ Display.addHeadline(Data.getCurrentItem().title);
+ }
Display.setVideoList(Main.selectedVideo, itm.first); // thlo
}
widgetAPI.blockNavigation(event);
@@ -1400,7 +1433,7 @@ Main.tvKeys = { KEY_5 :9,
KEY_6 :10,
KEY_7 :12,
- KEY_8 :13,
+// KEY_8 :13,
KEY_9 :14,
KEY_0 :17,
@@ -1429,3 +1462,4 @@ Main.tvKeys = { };
+
\ No newline at end of file diff --git a/smarttv-client/Javascript/Player.js b/smarttv-client/Javascript/Player.js index c04eb75..67c747e 100755 --- a/smarttv-client/Javascript/Player.js +++ b/smarttv-client/Javascript/Player.js @@ -51,6 +51,7 @@ var Player = eASP16to9 :0,
eASP4to3 :1,
+ eASPcrop16to9 :2,
bufferStartTime : 0,
requestStartTime :0
@@ -84,7 +85,31 @@ Player.resetAtStop = function () { };
Player.toggleAspectRatio = function () {
- if (this.aspectRatio == this.eASP16to9) {
+/* var height = Player.plugin.GetVideoHeight();
+ var width = Player.plugin.GetVideoWidth();
+ Main.logToServer ("Resolution= " + width + " x " + height );
+ Main.log ("Resolution= " + width + " x " + height );
+*/
+ switch (this.aspectRatio) {
+ case this.eASP16to9:
+ //it is 16 to 9, so do 4 to 3
+ this.aspectRatio = this.eASP4to3;
+ Notify.showNotify("4 : 3", true);
+ break;
+ case this.eASP4to3:
+ // it is 4 to 3. do cropped do 16 to 9
+ this.aspectRatio = this.eASPcrop16to9;
+ Notify.showNotify("Crop 16 : 9", true);
+ break;
+ case this.eASPcrop16to9:
+ // it is cropped 16 to 9
+ this.aspectRatio = this.eASP16to9;
+ Notify.showNotify("16 : 9", true);
+ Main.logToServer("Player.toggleAspectRatio: 16 by 9 Now");
+ break;
+ }
+ Player.setFullscreen();
+/* if (this.aspectRatio == this.eASP16to9) {
// Do 4 to 3
this.plugin.SetDisplayArea(120, 0, 720, 540);
// 4/3 = x/540
@@ -97,6 +122,57 @@ Player.toggleAspectRatio = function () { this.aspectRatio = this.eASP16to9;
Main.logToServer("Player.toggleAspectRatio: 16 by 9 Now");
}
+ */
+};
+
+
+Player.setWindow = function() {
+// this.plugin.SetDisplayArea(458, 58, 472, 270);
+};
+
+Player.setFullscreen = function() {
+// this.plugin.SetDisplayArea(0, 0, 960, 540);
+
+ var h = Player.plugin.GetVideoHeight();
+ var w = Player.plugin.GetVideoWidth();
+ Main.logToServer ("Resolution= " + w + " x " + h );
+ Main.log ("Resolution= " + w + " x " + h );
+
+ switch (this.aspectRatio) {
+ case this.eASP16to9:
+ this.plugin.SetDisplayArea(0, 0, 960, 540);
+ this.plugin.SetCropArea(0, 0, w, h);
+ Main.logToServer("Player.toggleAspectRatio: 16 by 9 Now");
+ break;
+ case this.eASP4to3:
+ // it is 4 to 3. do cropped do 16 to 9
+ this.plugin.SetDisplayArea(120, 0, 720, 540);
+ this.plugin.SetCropArea(0, 0, w, h);
+ // 4/3 = x/540
+ Main.logToServer("Player.toggleAspectRatio: 4 by 3 Now");
+ break;
+ case this.eASPcrop16to9:
+ // it is cropped 16 to 9
+ var z = Math.ceil(w*w*27 /(h*64));
+ Main.logToServer("Player.toggleAspectRatio: Crop 16 by 9 Now: z= " + z);
+ this.plugin.SetDisplayArea(0, 0, 960, 540);
+ this.plugin.SetCropArea(0, Math.round((h-z)/2), w, z);
+ break;
+ }
+/* 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() {
@@ -156,13 +232,6 @@ Player.deinit = function() }
};
-Player.setWindow = function() {
-// this.plugin.SetDisplayArea(458, 58, 472, 270);
-};
-
-Player.setFullscreen = function() {
- this.plugin.SetDisplayArea(0, 0, 960, 540);
-};
Player.setBuffer = function (){
var res = true;
@@ -222,6 +291,7 @@ Player.playVideo = function(resume_pos) { Main.log("No videos to play");
}
else {
+ Player.setFullscreen();
Player.bufferState = 0;
Display.bufferUpdate();
@@ -237,7 +307,7 @@ Player.playVideo = function(resume_pos) { Display.showProgress();
this.state = this.PLAYING;
- Player.setBuffer();
+// Player.setBuffer();
Player.ResetTrickPlay();
Player.skipDuration = Config.skipDuration; // reset
@@ -245,10 +315,15 @@ Player.playVideo = function(resume_pos) { this.requestStartTime = new Date().getTime();
if (Player.isRecording == false) {
- if (resume_pos == -1)
- this.plugin.Play( this.url );
+ if (resume_pos == -1) {
+// this.plugin.Play( this.url );
+ this.plugin.InitPlayer(this.url);
+ Player.setBuffer();
+ this.plugin.StartPlayback();
+ }
else {
Main.logToServer ("Player.playVideo: resume_pos= " +resume_pos);
+ Player.setBuffer();
this.plugin.ResumePlay(this.url, resume_pos);
}
}
@@ -256,7 +331,10 @@ Player.playVideo = function(resume_pos) { if (resume_pos == -1)
resume_pos = 0;
Player.setCurrentPlayTimeOffset(resume_pos * 1000.0);
- this.plugin.Play( this.url+ "?time=" + resume_pos );
+// this.plugin.Play( this.url+ "?time=" + resume_pos );
+ this.plugin.InitPlayer(this.url+ "?time=" + resume_pos );
+ Player.setBuffer();
+ this.plugin.StartPlayback();
Main.logToServer("Player.play with ?time=" + resume_pos);
}
@@ -352,7 +430,11 @@ Player.jumpToVideo = function(percent) { var old = Player.curPlayTime;
Player.setCurrentPlayTimeOffset(tgt * 1000.0);
- res = this.plugin.Play( this.url+ "?time=" + tgt );
+
+// res = this.plugin.Play( this.url+ "?time=" + tgt );
+ this.plugin.InitPlayer(this.url+ "?time=" + tgt );
+ res = this.plugin.StartPlayback();
+
Main.logToServer("Player.play with ?time=" + tgt);
if (res == false)
Player.setCurrentPlayTimeOffset(old);
@@ -383,7 +465,10 @@ Player.skipForwardVideo = function() { var old = Player.curPlayTime;
var tgt = (Player.curPlayTime/1000.0) + Player.skipDuration;
Player.setCurrentPlayTimeOffset(tgt * 1000.0);
- res = this.plugin.Play( this.url+ "?time=" + tgt );
+// res = this.plugin.Play( this.url+ "?time=" + tgt );
+ this.plugin.InitPlayer(this.url+ "?time=" + tgt );
+ res = this.plugin.StartPlayback();
+
Main.logToServer("Player.skipForwardVideo with ?time=" + tgt);
if (res == false)
Player.setCurrentPlayTimeOffset(old);
@@ -406,7 +491,10 @@ Player.skipBackwardVideo = function() { if (tgt < 0)
tgt = 0;
Player.setCurrentPlayTimeOffset(tgt * 1000.0);
- res = this.plugin.Play( this.url+ "?time=" + tgt );
+// res = this.plugin.Play( this.url+ "?time=" + tgt );
+ this.plugin.InitPlayer(this.url+ "?time=" + tgt );
+ res = this.plugin.StartPlayback();
+
Main.logToServer("Player.skipBackwardVideo with ?time=" + tgt);
if (res == false)
Player.setCurrentPlayTimeOffset(old);
@@ -588,7 +676,7 @@ Player.onBufferingStart = function() { Player.onBufferingProgress = function(percent)
{
// should trigger from here the overlay
- Display.status("Buffering:" + percent + "%");
+// Display.status("Buffering:" + percent + "%");
Player.bufferState = percent;
Display.bufferUpdate();
@@ -632,6 +720,7 @@ Player.OnCurrentPlayTime = function(time) { Player.OnStreamInfoReady = function() {
Main.log("*** OnStreamInfoReady ***");
+ Player.setFullscreen();
// Main.logToServer("GetCurrentBitrates= " + Player.plugin.GetCurrentBitrates());
if ((Player.isLive == false) && (Player.isRecording == false)) {
Player.totalTime = Player.plugin.GetDuration();
diff --git a/smarttv-client/Javascript/Server.js b/smarttv-client/Javascript/Server.js index 0139582..ec969b8 100755 --- a/smarttv-client/Javascript/Server.js +++ b/smarttv-client/Javascript/Server.js @@ -43,6 +43,7 @@ Server.fetchVideoList = function(url) { var fps = parseFloat($(this).find('fps').text());
var ispes = $(this).find('ispes').text();
var isnew = $(this).find('isnew').text();
+ var num = parseInt($(this).find('number').text());
// Main.log("Server.fetchVideoList: title= " + title + " start= " + startVal + " dur= " + durVal + " fps= " + fps);
if (Main.state == Main.eLIVE) {
@@ -51,7 +52,7 @@ Server.fetchVideoList = function(url) { var title_list = title.split("~");
Data.addItem( title_list, {link : link, prog: programme, desc: description, guid : guid, start: startVal,
- dur: durVal, ispes : ispes, isnew : isnew, fps : fps});
+ dur: durVal, ispes : ispes, isnew : isnew, fps : fps, num : num});
}); // each
diff --git a/smarttv-client/config.xml b/smarttv-client/config.xml index a763e37..9595184 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.90</ver>
+ <ver>0.91</ver>
<mgrver></mgrver>
<fullwidget>y</fullwidget>
<movie>y</movie>
diff --git a/smarttv-client/index.html b/smarttv-client/index.html index 7661321..903db08 100755 --- a/smarttv-client/index.html +++ b/smarttv-client/index.html @@ -32,7 +32,8 @@ <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>
-
+ <script language="javascript" type="text/javascript" src="Javascript/DirectAccess.js"></script>
+
<!-- Style sheets -->
<link rel="stylesheet" href="CSS/Main.css" type="text/css">
@@ -160,6 +161,12 @@ <a href='javascript:void(0);' id='yn-buttons-anchor' ></a>
<!-- onkeydown='Buttons.onPrInput();'-->
</div>
-
- </body>
+ <div id="directChanAccess">
+ <table style="height: 100%; width: 80%">
+ <tr><td>
+ <input type="text" id="directAccessAnchor" onkeydown='DirectAccess.onInput();' maxlength="4" size="4">
+ </td></tr>
+ </table>
+ </div>
+ </body>
</html>
|