From ec487342e840d92dbe556a5cede0073d11fb2862 Mon Sep 17 00:00:00 2001 From: thlo Date: Sun, 17 Mar 2013 11:34:56 +0100 Subject: Widget v0.92: * Widget version number on select screen. * Configurable timeout for direct access. * Direct access takes first digit. * Pause-Key toggles between pause and play. * First version of info overlay. * Bug fixes. --- smarttv-client/CSS/Main.css | 15 +++ smarttv-client/Javascript/Config.js | 161 +++++++----------------------- smarttv-client/Javascript/DirectAccess.js | 4 +- smarttv-client/Javascript/Display.js | 136 +++++++++++++++++++++---- smarttv-client/Javascript/Lang.js | 12 +++ smarttv-client/Javascript/Main.js | 157 ++++++++++++++++++----------- smarttv-client/Javascript/Player.js | 6 +- smarttv-client/Javascript/Timers.js | 64 ++++++++++++ smarttv-client/config.xml | 2 +- smarttv-client/index.html | 32 +++++- 10 files changed, 381 insertions(+), 208 deletions(-) create mode 100644 smarttv-client/Javascript/Lang.js create mode 100644 smarttv-client/Javascript/Timers.js (limited to 'smarttv-client') diff --git a/smarttv-client/CSS/Main.css b/smarttv-client/CSS/Main.css index b733c20..ca16181 100755 --- a/smarttv-client/CSS/Main.css +++ b/smarttv-client/CSS/Main.css @@ -136,6 +136,21 @@ body { } +#infoOverlay{ + position: absolute; + display: none; + left: 0px; top: 0px; + width: 960px; height: 30%; + border-style:solid; + z-index:10; + padding-top:20px; + padding-left:20px; + padding-right:20px; + background-color: darkblue; + background-color: rgba(0, 0, 139, 0.5); + background-color: -webkit-linear-gradient(-45deg, rgba(167,207,223,1) 0%,rgba(35,83,138,1) 100%); +} + #popup{ position: absolute; display: none; diff --git a/smarttv-client/Javascript/Config.js b/smarttv-client/Javascript/Config.js index b60d01d..38bed1c 100755 --- a/smarttv-client/Javascript/Config.js +++ b/smarttv-client/Javascript/Config.js @@ -17,7 +17,8 @@ var Config = { debug : false, usePdlForRecordings : true, uploadJsFile : "", - + directAcessTimeout : 1500, + widgetVersion : "unknown", deviceType : 0 // Used to differentiate between browsers and platforms // 0: Samsung @@ -72,8 +73,9 @@ Config.init = function () { } else { Config.doFirstLaunch(); -// Main.init(); - Display.showPopup ("WARNING: Cannot create widget folder. Try Config"); +// Display.showPopup ("WARNING: Cannot create widget folder. Try Config"); + Display.showPopup (Lang[Lang.sel].configInit); + // Main.logToServer("ERROR: Cannot create widget folder curWidget.id= " +curWidget.id); } return; @@ -88,35 +90,33 @@ Config.init = function () { Config.doFirstLaunch = function () { Config.firstLaunch = true; -// Main.init(); // Obsolete? Main.changeState(4); }; -/* -Config.fetchConfig = function () { - if (this.XHRObj == null) { - this.XHRObj = new XMLHttpRequest(); - } - - if (this.XHRObj) { - - this.XHRObj.onreadystatechange = function() { - if (Config.XHRObj.readyState == 4) { - Config.processConfig(); - } - }; - - this.XHRObj.open("GET", this.serverUrl + "/widget.conf", true); - this.XHRObj.send(null); - } + +Config.getWidgetVersion = function () { + $.ajax({ + url: "config.xml", + type : "GET", + success : function(data, status, XHR ) { + Config.widgetVersion = $(data).find('ver').text(); + Main.logToServer("Config.getWidgetVersion= " + Config.widgetVersion) ; + Display.updateWidgetVersion(Config.widgetVersion); + }, + error : function (XHR, status, error) { + Main.log("Config.getVersion ERROR" ) ; + Main.logToServer("Config.getVersion ERROR" ) ; + } + }); }; -*/ + Config.fetchConfig = function () { $.ajax({ url: this.serverUrl + "/widget.conf", type : "GET", success : function(data, status, XHR ) { + Main.log ("Parsing config XML now"); Main.logToServer("Parsing config XML now"); Config.format = $(data).find('format').text(); @@ -132,8 +132,12 @@ Config.fetchConfig = function () { Config.debug = ($(data).find('widgetdebug').text() == "true") ? true : false; Config.usePdlForRecordings = ($(data).find('usePdlForRecordings').text() == "false") ? false : true; Config.uploadJsFile = $(data).find('uploadJsFile').text(); - + Config.directAcessTimeout = $(data).find('directAcessTimeout').text(); + Player.skipDuration = Config.skipDuration; + if (Config.directAcessTimeout != "") { + DirectAccess.delay = Config.directAcessTimeout; + } Main.log("**** Config ****"); Main.log("serverUrl= " + Config.serverUrl); Main.log("format= " + Config.format); @@ -153,7 +157,9 @@ Config.fetchConfig = function () { }, error : function (XHR, status, error) { Main.log ("Config Server Error"); - Display.showPopup("Config Server Error " + XHR.status + " " + status); +// Display.showPopup("Config Server Error " + XHR.status + " " + status); + Display.showPopup(Lang[Lang.sel].configNoServer + " "+ XHR.status + " " + status); + Main.logToServer("Config Server Error " + XHR.status + " " + status); } @@ -194,13 +200,14 @@ Config.readContext = function () { while (line = fd.readLine()) { var avp = line.split(" "); -// Display.showPopup ("Reading Config: attr= " + avp[0] + " val= " + avp[1]); if (avp.length > 1) { Config.serverAddr = avp[1]; Config.serverUrl = "http://" + Config.serverAddr; } else { - Display.showPopup ("ERROR: Error in Config File. Try widget re-install."); +// Display.showPopup ("ERROR: Error in Config File. Try widget re-install."); + Display.showPopup (Lang[Lang.sel].configRead1); + // TODO: I should re-write the config file } } @@ -217,7 +224,9 @@ Config.readContext = function () { else { Main.log("Config.readContext: Widget Folder creation failed"); - Display.showPopup ("WARNING: ConfigRead Error and WidgetFolder creation failed.
Launching Config-Menu from here"); +// Display.showPopup ("WARNING: ConfigRead Error and WidgetFolder creation failed.
Launching Config-Menu from here"); + Display.showPopup (Lang[Lang.sel].configRead2); + // Main.log("-------------- Error: res = false ------------------------"); } Config.doFirstLaunch(); @@ -225,105 +234,7 @@ Config.readContext = function () { } }; -/* -Config.getXmlValue = function (itm) { - var val = this.xmlDocument.getElementsByTagName(itm); - var res = 0; - try { - res = val[0].firstChild.data; - } - catch (e) { - Main.logToServer("parsing widget.conf: Item= " + itm + " not found" + e); - Main.log ("parsing widget.conf: Item= " + itm + " not found e= " + e); - } - return res; - -}; -Config.getXmlString = function (itm) { - var val = this.xmlDocument.getElementsByTagName(itm); - - var res = ""; - try { - res = val[0].firstChild.data; - } - catch (e) { - Main.logToServer("parsing widget.conf: Item= " + itm + " not found" + e); - Main.log ("parsing widget.conf: Item= " + itm + " not found e= " + e); - }; - - return res; -}; -*/ -/* -Config.processConfig = function () { - if (this.XHRObj.status != 200) { - Main.log ("Config Server Error"); - Display.showPopup("Config Server Error " + this.XHRObj.status); - Main.logToServer("Config Server Error " + this.XHRObj.status); - } - else { - var xmlResponse = this.XHRObj.responseXML; - if (xmlResponse == null) { - Main.log ("xml error"); - Display.showPopup("Error in XML Config File"); - Main.logToServer("Error in XML Config File"); - return; - } - this.xmlDocument = xmlResponse.documentElement; - if (!this.xmlDocument ) { - Main.log("Failed to get valid Config XML"); - Display.showPopup("Failed to get valid Config XML"); - Main.logToServer("Failed to get valid Config XML"); - return; - } - else { - Config.firstLaunch = false; - - Main.log ("Parsing config XML now"); - Main.logToServer("Parsing config XML now"); - this.format = Config.getXmlString("format"); - var res = Config.getXmlValue("tgtBufferBitrate"); - if (res != 0) - this.tgtBufferBitrate = 1.0 * res; - res = Config.getXmlValue("totalBufferDuration"); - if (res != 0) this.totalBufferDuration = 1.0 * res; - - res= Config.getXmlValue("initialBuffer"); - if (res != 0) this.initialBuffer = 1.0 * res; - - res = Config.getXmlValue("pendingBuffer"); - if (res != 0) this.pendingBuffer = 1.0 * res; - - res = Config.getXmlValue("skipDuration"); - if (res != 0) this.skipDuration= 1.0 * res; - - res = Config.getXmlValue("initialTimeOut"); - if (res != 0) this.initialTimeOut = 1.0 * res; - - res = Config.getXmlValue("liveChannels"); - if (res != 0) this.liveChannels = res; - - Player.skipDuration = Config.skipDuration; - Main.log("**** Config ****"); - Main.log("serverUrl= " + Config.serverUrl); - Main.log("format= " + Config.format); - Main.log("tgtBufferBitrate= " + Config.tgtBufferBitrate); - Main.log("totalBufferDuration= " + Config.totalBufferDuration); - Main.log("initialBuffer= " + Config.initialBuffer); - Main.log("pendingBuffer= " + Config.pendingBuffer); - Main.log("skipDuration= " + Config.skipDuration); - Main.log("initialTimeOut= " + Config.initialTimeOut); - Main.log("liveChannels= " + Config.liveChannels); - - Main.log("**** /Config ****"); - }; - - }; - - Main.init(); -}; -*/ // This function cleans up after un-installation Config.reset = function () { var fileSystemObj = new FileSystem(); diff --git a/smarttv-client/Javascript/DirectAccess.js b/smarttv-client/Javascript/DirectAccess.js index 418a5c6..2406f89 100644 --- a/smarttv-client/Javascript/DirectAccess.js +++ b/smarttv-client/Javascript/DirectAccess.js @@ -82,7 +82,9 @@ DirectAccess.init = function (){ } }; -DirectAccess.show = function () { +DirectAccess.show = function (val) { + Main.log("DirectAccess.show " + val); + $("#directAccessText").text(val); $("#directChanAccess").show(); $("#directAccessAnchor").focus(); DirectAccess.timeout = Display.GetEpochTime() + (DirectAccess.delay / 1000.0); diff --git a/smarttv-client/Javascript/Display.js b/smarttv-client/Javascript/Display.js index 8d10024..66d22dd 100755 --- a/smarttv-client/Javascript/Display.js +++ b/smarttv-client/Javascript/Display.js @@ -16,6 +16,7 @@ var Display = volOlHandler : null, progOlHandler : null, popupOlHandler : null, + infoOlHandler : null, videoList : new Array() }; @@ -40,9 +41,11 @@ Display.init = function() this.progOlHandler = new OverlayHandler("ProgHndl"); this.volOlHandler = new OverlayHandler("VolHndl"); this.popupOlHandler = new OverlayHandler("PopupHndl"); + this.infoOlHandler = new OverlayHandler("InfoHndl"); this.progOlHandler.init(Display.handlerShowProgress, Display.handlerHideProgress); this.volOlHandler.init(Display.handlerShowVolume, Display.handlerHideVolume); this.popupOlHandler.init(Display.handlerShowPopup, Display.handlerHidePopup); + this.infoOlHandler.init(Display.handlerShowInfo, Display.handlerHideInfo); if (!this.statusDiv) { success = false; @@ -74,12 +77,11 @@ Display.init = function() elm.style.marginBottom= " 5px"; elm.style.textAlign = "center"; } - + Display.resetDescription(); Main.log("Display initialized" ); return success; }; - Display.putInnerHTML = function (elm, val) { switch (Config.deviceType) { case 0: @@ -209,6 +211,11 @@ Display.resetSelectItems = function (itm) { Display.selectItem(document.getElementById("selectItem"+itm)); }; +Display.updateWidgetVersion = function (ver) { + + $("#widgetVersion").text(" Version "+ ver); +}; + /* * Video Select Screen Functions * @@ -251,6 +258,7 @@ Display.show = function() { this.volOlHandler.cancel(); this.progOlHandler.cancel(); this.popupOlHandler.cancel(); + this.infoOlHandler.cancel(); $("#main").show(); }; @@ -380,16 +388,23 @@ Display.resetVideoList = function () { }; -Display.resetDescription = function () { +/*Display.resetDescription = function () { $("#description").text(""); // reset }; +*/ //Video Select Screen Display.handleDescription =function (selected) { if (Data.getCurrentItem().childs[selected].isFolder == true) { - Display.setDescription( "Dir: " +Data.getCurrentItem().childs[selected].title ); + $("#descTitle").text("Dir: " +Data.getCurrentItem().childs[selected].title); +// Display.setDescription( "Dir: " +Data.getCurrentItem().childs[selected].title ); + $("#descProg").text(""); + $("#descStart").text(""); + $("#descDuration").text(""); + $("#descRemaining").text(""); + $("#descDesc").text(""); } else { var itm = Data.getCurrentItem().childs[selected]; @@ -405,43 +420,69 @@ Display.handleDescription =function (selected) { var min = Display.getNumString (digi.getMinutes(), 2); var d_str =""; - var msg = ""; +// var msg = ""; switch (Main.state) { case Main.eLIVE: var now = Display.GetEpochTime(); d_str = hour + ":" + min; - msg += title + "
"; +/* msg += title + "
"; msg += ""+ prog + "
"; msg += "
Start: " + d_str + "
"; msg += "Duration: " + Display.durationString(length) + "h
"; msg += "Remaining: " + Display.durationString((itm.payload.start + length - now)); msg += "

"+ desc; - break; + */ + $("#descProg").show(); + $("#descRemaining").show(); + + $("#descTitle").text(title); + $("#descProg").text(prog); + $("#descStart").text("Start: " + d_str); + $("#descDuration").text("Duration: " + Display.durationString(length) + "h"); + $("#descRemaining").text("Remaining: " + Display.durationString((itm.payload.start + length - now))); + $("#descDesc").text(desc); + + break; case Main.eREC: d_str = mon + "/" + day + " " + hour + ":" + min; - +/* msg += "" + title + ""; msg += "

" + d_str; msg += " Duration: " + Display.durationString(length) + "h"; msg += "

"+ desc; - break; +*/ + $("#descTitle").text(title); + $("#descStart").text("Start: " + d_str); + $("#descDuration").text("Duration: " + Display.durationString(length) + "h"); + $("#descDesc").text(desc); + + break; case Main.eMED: - msg += "" + title + ""; +// msg += "" + title + ""; + $("#descTitle").text(title); break; default: Main.logToServer("ERROR in Display.handleDescription: Should not be here"); break; } - Display.setDescription(msg); +// Display.setDescription(msg); } }; - - - +Display.resetDescription = function () { + $("#descTitle").text(""); + $("#descProg").text(""); + $("#descStart").text(""); + $("#descDuration").text(""); + $("#descRemaining").text(""); + $("#descDesc").text(""); + + $("#descProg").hide(); + $("#descRemaining").hide(); +}; /* * this.currentWindow: Cursor (selected item) */ @@ -499,12 +540,13 @@ Display.setVideoListPosition = function(position, move) { } }; +/* Display.setDescription = function(description) { var descriptionElement = document.getElementById("description"); Display.putInnerHTML(descriptionElement, description); }; - +*/ Display.getDisplayTitle = function(item) { var res = {c1:"", c2:"", c3:""}; switch (Main.state) { @@ -741,6 +783,60 @@ Display.handlerHideVolume = function() { document.getElementById("volume").style.display="none"; }; +//--------------------------------------------------------- +/* + * Info Overlay handlers + */ +Display.showInfo = function(selected) { + var itm = Data.getCurrentItem().childs[selected]; + var title = itm.title; + var prog = itm.payload.prog; + var desc = itm.payload.desc; + var length = itm.payload.dur; + + var digi = new Date(parseInt(itm.payload.start*1000)); + var mon = Display.getNumString ((digi.getMonth()+1), 2); + var day = Display.getNumString (digi.getDate(), 2); + var hour = Display.getNumString (digi.getHours(), 2); + var min = Display.getNumString (digi.getMinutes(), 2); + + var d_str =""; + switch (Main.state) { + case Main.eLIVE: + var now = Display.GetEpochTime(); + + d_str = hour + ":" + min; + + $("#infoTitle").text(title + "\n" + prog); + $("#infoDuration").text("Duration: " + Display.durationString(length) + "h Remaining: " + Display.durationString((itm.payload.start + length - now))); + $("#infoDesc").text(desc); + break; + case Main.eREC: + d_str = mon + "/" + day + " " + hour + ":" + min; + $("#infoTitle").text(title); + $("#infoDuration").text(d_str + " Duration: " + Display.durationString(length) + "h"); + $("#infoDesc").text(desc); + break; + case Main.eMED: + $("#infoTitle").text(title); + break; + default: + Main.logToServer("ERROR in Display.handleDescription: Should not be here"); + break; + } + this.infoOlHandler.show(); + +}; + +Display.handlerShowInfo = function() { +// $("#infoOverlay").show(); + $("#infoOverlay").slideDown(300); +}; + +Display.handlerHideInfo = function() { +// $("#infoOverlay").hide(); + $("#infoOverlay").slideUp(300); +}; //--------------------------------------------------------- /* @@ -776,28 +872,26 @@ Display.showProgress = function() { }; Display.handlerHideProgress = function() { - document.getElementById("overlay").style.display="none"; + $("#overlay").fadeOut(300); }; Display.handlerShowProgress = function() { + $("#overlay").fadeIn(400); - document.getElementById("overlay").style.display="block"; if (Player.isRecording == true) { - document.getElementById("olRecProgressBar").style.display="block"; + $("#olRecProgressBar").show(); var now = Display.GetEpochTime(); var remaining = Math.round(((Player.startTime + Player.duration) - now) * 100/ Player.duration); -// Main.log (" remaining= " + remaining); var elm = document.getElementById("olRecProgressBar"); elm.style.display="block"; elm.style.width = remaining + "%"; elm.style.left = (100 - remaining) + "%"; } else - document.getElementById("olRecProgressBar").style.display="none"; + $("#olRecProgressBar").hide(); var timePercent = (Player.curPlayTime *100)/ Player.totalTime; -// Main.log("show OL Progress timePercent= " + timePercent); document.getElementById("olProgressBar").style.width = timePercent + "%"; diff --git a/smarttv-client/Javascript/Lang.js b/smarttv-client/Javascript/Lang.js new file mode 100644 index 0000000..985b0d8 --- /dev/null +++ b/smarttv-client/Javascript/Lang.js @@ -0,0 +1,12 @@ +var Lang = { + sel : "en", + en : {} +}; + +Lang["en"].configInit = "WARNING: Cannot create widget folder. Try Config"; +Lang["en"].configNoServer = "Config Server Error"; +Lang["en"].configReadContext1 = "ERROR: Error in Config File. Try widget re-install."; +Lang["en"].configReadContext2 = "WARNING: ConfigRead Error and WidgetFolder creation failed.
Launching Config-Menu from here"; + + + diff --git a/smarttv-client/Javascript/Main.js b/smarttv-client/Javascript/Main.js index f18948a..f2594d3 100755 --- a/smarttv-client/Javascript/Main.js +++ b/smarttv-client/Javascript/Main.js @@ -158,7 +158,9 @@ Main.init = function () { Server.updateVdrStatus(); DirectAccess.init(); + Config.getWidgetVersion(); // DirectAccess.show(); +// Timers.init(); // Display.initOlForRecordings(); /* * Fetch JS file @@ -685,7 +687,6 @@ cPlayStateKeyHndl.prototype.handleKeyDown = function (event) { Player.jumpToVideo(90); break; -// case tvKey.KEY_FF: case tvKey.KEY_RIGHT: Main.log("Right: Skip Forward"); Display.showProgress(); @@ -696,7 +697,6 @@ cPlayStateKeyHndl.prototype.handleKeyDown = function (event) { Player.skipForwardVideo(); break; -// case tvKey.KEY_RW: case tvKey.KEY_LEFT: Main.log("Left: Skip Backward"); Display.showProgress(); @@ -762,7 +762,12 @@ cPlayStateKeyHndl.prototype.handleKeyDown = function (event) { break; case tvKey.KEY_PAUSE: Main.log("PAUSE"); - Player.pauseVideo(); + if(Player.getState() == Player.PAUSED) { + Player.resumeVideo(); + } + else { + Player.pauseVideo(); + } break; case tvKey.KEY_UP: Player.adjustSkipDuration(1); @@ -773,27 +778,11 @@ cPlayStateKeyHndl.prototype.handleKeyDown = function (event) { Display.showProgress(); break; case tvKey.KEY_INFO: + Display.showInfo(Main.selectedVideo); + break; case tvKey.KEY_ASPECT: Player.toggleAspectRatio(); break; -/* case tvKey.KEY_UP: - case tvKey.KEY_PANEL_VOL_UP: - case tvKey.KEY_VOL_UP: - Main.log("VOL_UP"); - Display.showVolume(); - if(Main.mute == 0) - Audio.setRelativeVolume(0); - break; - - case tvKey.KEY_DOWN: - case tvKey.KEY_PANEL_VOL_DOWN: - case tvKey.KEY_VOL_DOWN: - Main.log("VOL_DOWN"); - Display.showVolume(); - if(Main.mute == 0) - Audio.setRelativeVolume(1); - break; -*/ default: Main.log("Calling Default Key Hanlder"); this.defaultKeyHandler.handleDefKeyDown(keyCode); @@ -825,22 +814,39 @@ cLivePlayStateKeyHndl.prototype.handleKeyDown = function (event) { Main.log(this.handlerName+": Key pressed: " + Main.getKeyCode(keyCode)); switch(keyCode) { - case tvKey.KEY_INFO: case tvKey.KEY_ASPECT: Player.toggleAspectRatio(); break; case tvKey.KEY_0: + DirectAccess.show("0"); + break; case tvKey.KEY_1: + DirectAccess.show("1"); + break; case tvKey.KEY_2: + DirectAccess.show("2"); + break; case tvKey.KEY_3: + DirectAccess.show("3"); + break; case tvKey.KEY_4: + DirectAccess.show("4"); + break; case tvKey.KEY_5: + DirectAccess.show("5"); + break; case tvKey.KEY_6: + DirectAccess.show("6"); + break; case tvKey.KEY_7: + DirectAccess.show("7"); + break; case tvKey.KEY_8: + DirectAccess.show("8"); + break; case tvKey.KEY_9: - DirectAccess.show(); + DirectAccess.show("9"); break; case tvKey.KEY_UP: case tvKey.KEY_CH_UP: @@ -851,7 +857,7 @@ cLivePlayStateKeyHndl.prototype.handleKeyDown = function (event) { // 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") { + if (Data.isRootFolder() != true) { // Main.selectedVideo = Data.folderUp(); var itm = Data.folderUp(); Main.selectedVideo = itm.id; @@ -879,7 +885,7 @@ cLivePlayStateKeyHndl.prototype.handleKeyDown = function (event) { // if yes, then one up if (Main.selectedVideo == 0) { //First VideoItem, - if (Data.isRootFolder() != "true") { + if (Data.isRootFolder() != true) { // Main.selectedVideo = Data.folderUp(); var itm = Data.folderUp(); Main.selectedVideo = itm.id; @@ -909,7 +915,17 @@ cLivePlayStateKeyHndl.prototype.handleKeyDown = function (event) { 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.getNumberOfVideoListItems())); + //thlo: here + + if (Data.isRootFolder() != true) { + Display.addHeadline(Data.getCurrentItem().title); + Display.setVideoList(Main.selectedVideo, Main.selectedVideo- ( Main.selectedVideo % Display.getNumberOfVideoListItems())); + } + else { + Display.removeHeadline(); + Display.setVideoList(Main.selectedVideo, Main.selectedVideo- ( Main.selectedVideo % Display.getNumberOfVideoListItems())); + } + Display.show(); widgetAPI.blockNavigation(event); @@ -917,29 +933,13 @@ cLivePlayStateKeyHndl.prototype.handleKeyDown = function (event) { case tvKey.KEY_PAUSE: Main.log("PAUSE"); break; - case tvKey.KEY_INFO: + case tvKey.KEY_INFO: + Display.showInfo(Main.selectedVideo); + break; case tvKey.KEY_ASPECT: Player.toggleAspectRatio(); break; -/* case tvKey.KEY_UP: - case tvKey.KEY_PANEL_VOL_UP: - case tvKey.KEY_VOL_UP: - Main.log("VOL_UP"); - Display.showVolume(); - if(Main.mute == 0) - Audio.setRelativeVolume(0); - break; - - case tvKey.KEY_DOWN: - case tvKey.KEY_PANEL_VOL_DOWN: - case tvKey.KEY_VOL_DOWN: - Main.log("VOL_DOWN"); - Display.showVolume(); - if(Main.mute == 0) - Audio.setRelativeVolume(1); - break; -*/ default: this.defaultKeyHandler.handleDefKeyDown(keyCode); break; @@ -961,18 +961,63 @@ cMenuKeyHndl.prototype.handleKeyDown = function (event) { switch(keyCode) { case tvKey.KEY_0: + if (Main.state == Main.eLIVE) { + Main.log("cMenu DirectAccess: keyCode= " + keyCode); + DirectAccess.show("0"); + } + break; case tvKey.KEY_1: + if (Main.state == Main.eLIVE) { + Main.log("cMenu DirectAccess: keyCode= " + keyCode); + DirectAccess.show("1"); + } + break; case tvKey.KEY_2: + if (Main.state == Main.eLIVE) { + Main.log("cMenu DirectAccess: keyCode= " + keyCode); + DirectAccess.show("2"); + } + break; case tvKey.KEY_3: + if (Main.state == Main.eLIVE) { + Main.log("cMenu DirectAccess: keyCode= " + keyCode); + DirectAccess.show("3"); + } + break; case tvKey.KEY_4: + if (Main.state == Main.eLIVE) { + Main.log("cMenu DirectAccess: keyCode= " + keyCode); + DirectAccess.show("4"); + } + break; case tvKey.KEY_5: + if (Main.state == Main.eLIVE) { + Main.log("cMenu DirectAccess: keyCode= " + keyCode); + DirectAccess.show("5"); + } + break; case tvKey.KEY_6: + if (Main.state == Main.eLIVE) { + Main.log("cMenu DirectAccess: keyCode= " + keyCode); + DirectAccess.show("6"); + } + break; case tvKey.KEY_7: + if (Main.state == Main.eLIVE) { + Main.log("cMenu DirectAccess: keyCode= " + keyCode); + DirectAccess.show("7"); + } + break; case tvKey.KEY_8: + if (Main.state == Main.eLIVE) { + Main.log("cMenu DirectAccess: keyCode= " + keyCode); + DirectAccess.show("8"); + } + break; case tvKey.KEY_9: if (Main.state == Main.eLIVE) { Main.log("cMenu DirectAccess: keyCode= " + keyCode); - DirectAccess.show(); + DirectAccess.show("9"); } break; @@ -1413,6 +1458,16 @@ Main.tvKeys = { KEY_STOP :27, // ESC // KEY_MUTE :27, + KEY_1 :49, + KEY_2 :50, + KEY_3 :51, + KEY_4 :52, + KEY_5 :53, + KEY_6 :54, + KEY_7 :55, + KEY_8 :56, + KEY_9 :57, + KEY_0 :48, // Un-used keycodes KEY_RETURN :88, @@ -1426,16 +1481,6 @@ Main.tvKeys = { KEY_FF :72, KEY_PLAY :71, KEY_STOP :70, - KEY_1 :101, - KEY_2 :98, - KEY_3 :6, - KEY_4 :8, - KEY_5 :9, - KEY_6 :10, - KEY_7 :12, -// KEY_8 :13, - KEY_9 :14, - KEY_0 :17, KEY_PANEL_CH_UP :104, KEY_PANEL_CH_DOWN :106, diff --git a/smarttv-client/Javascript/Player.js b/smarttv-client/Javascript/Player.js index 67c747e..8f7a5cd 100755 --- a/smarttv-client/Javascript/Player.js +++ b/smarttv-client/Javascript/Player.js @@ -338,7 +338,7 @@ Player.playVideo = function(resume_pos) { Main.logToServer("Player.play with ?time=" + resume_pos); } - if ((this.mFormat != this.ePDL) && (this.isLive == false)){ + if ((this.mFormat == this.eHLS) && (this.isLive == false)){ Notify.showNotify("No Trickplay", true); } Audio.plugin.SetSystemMute(false); @@ -400,6 +400,7 @@ Player.resumeVideo = function() { }; Player.jumpToVideo = function(percent) { + Spinner.show(); if (this.isLive == true) { return; } @@ -407,7 +408,6 @@ Player.jumpToVideo = function(percent) { Main.logToServer ("Player.jumpToVideo: Player not Playing"); return; } - Spinner.show(); Player.bufferState = 0; Display.showProgress(); @@ -460,6 +460,7 @@ Player.skipForwardVideo = function() { if (Player.isRecording == false) res = this.plugin.JumpForward(Player.skipDuration); else { + Spinner.show(); this.bufferState = 0; this.plugin.Stop(); var old = Player.curPlayTime; @@ -485,6 +486,7 @@ Player.skipBackwardVideo = function() { if (Player.isRecording == false) res = this.plugin.JumpBackward(Player.skipDuration); else { + Spinner.show(); this.bufferState = 0; this.plugin.Stop(); var tgt = (Player.curPlayTime/1000.0) - Player.skipDuration; diff --git a/smarttv-client/Javascript/Timers.js b/smarttv-client/Javascript/Timers.js new file mode 100644 index 0000000..c7110c7 --- /dev/null +++ b/smarttv-client/Javascript/Timers.js @@ -0,0 +1,64 @@ +var Timers = { + haveRapi : false, + timerList : {} +}; + +Timers.init = function() { + var url = "http://192.168.1.122:8002/info.xml"; + $.ajax({ + url: url, + type : "GET", + success : function(data, status, XHR ) { + Timers.haveRapi = true; + Main.log ("Timers: Got response"); + Timers.readTimers(); + + }, + error : function (jqXHR, status, error) { + Timers.haveRapi = false; + Main.log ("Timers: Not found!!!"); + } + }); +}; + +Timers.readTimers = function () { + if (Timers.haveRapi == false) { + Main.log ("Timers.readTimers: no restful API!!!"); + return; + } + var url = "http://192.168.1.122:8002/timers.xml"; + $.ajax({ + url: url, + type : "GET", + success : function(data, status, XHR ) { + Main.log ("Timers.readTimer: Success"); + Main.log(" Count= " + $(data).find("count").text()); + $(data).find("timer").each(function () { + Main.log("timer: "); + Timers.curItem = {}; + $(this).find("param").each(function () { + Main.log(" + " + $(this).attr("name") + " val= " +$(this).text()); + Timers.curItem[$(this).attr("name")] = $(this).text(); + }); +/* for (var prop in Timers.curItem) { + Main.log (" -" + prop + " : " + Timers.curItem[prop]); + } + */ + Main.log("Adding id " +Timers.curItem["id"]); + Timers.timerList[Timers.curItem["id"]] = Timers.curItem; + Timers.curItem = {}; + }); + Main.log("Summary"); + for (var id in Timers.timerList) { + Main.log (id + " : "); + for (var prop in Timers.timerList[id]) { + Main.log (" - " + prop + " : " + Timers.timerList[id][prop]); + } + + } + }, + error : function (jqXHR, status, error) { + Main.log ("Timers.readTimer: Failure"); + } + }); +}; \ No newline at end of file diff --git a/smarttv-client/config.xml b/smarttv-client/config.xml index 9595184..cd6d56c 100755 --- a/smarttv-client/config.xml +++ b/smarttv-client/config.xml @@ -9,7 +9,7 @@ Images/icon/SmartTvWeb_115.png Images/icon/SmartTvWeb_85.png Images/icon/SmartTvWeb_95.png - 0.91 + 0.92 y y diff --git a/smarttv-client/index.html b/smarttv-client/index.html index 3651fad..3a2f188 100755 --- a/smarttv-client/index.html +++ b/smarttv-client/index.html @@ -33,6 +33,8 @@ + + @@ -68,6 +70,7 @@
+
@@ -101,7 +104,22 @@
-
+
+
+ + + + + + +
+
+
+
+
+
+
+
@@ -150,6 +168,16 @@
+
+ + + + +
+
+
+
+
@@ -161,7 +189,7 @@ -
+
-- cgit v1.2.3