diff options
author | M. Voerman <rekordc@gmail.com> | 2013-01-13 12:43:19 +0100 |
---|---|---|
committer | M. Voerman <rekordc@gmail.com> | 2013-01-13 12:43:19 +0100 |
commit | ea570e05e4f15d99fd185afc0b0079747e837c18 (patch) | |
tree | 598db8f41da08546f9ebaaf820d7aa2785e8a443 | |
parent | fc89d8d68f16cb4b92bbbbc95dd5a50ce9835684 (diff) | |
download | vdr-vipclient-ea570e05e4f15d99fd185afc0b0079747e837c18.tar.gz vdr-vipclient-ea570e05e4f15d99fd185afc0b0079747e837c18.tar.bz2 |
Info menu added
Standby now closes stream
-rw-r--r-- | index.html | 71 | ||||
-rw-r--r-- | settings.js | 19 |
2 files changed, 72 insertions, 18 deletions
@@ -48,7 +48,12 @@ function onLoad() { // eitCache.setFilterMode(eitCache.FILTER_MODE_PF_ONLY); eitCache.addEventListener(eitCache.ON_CACHE_UPDATED, onCacheUpdated); mediaPlayer.addEventListener(mediaPlayer.ON_DATA_AVAILABLE,onDataAvailableEvent); + if (mediaRecorder) { mediaRecorder.addEventListener(mediaRecorder.ON_STATE_CHANGED, onRecorderStateChanged); + } + + toi.informationService.addEventListener(toi.informationService.ON_OBJECTS_CHANGED, onEvent); + toi.informationService.subscribeObject(onEvent, "var.io.state", true); var ss = toi.schedulerService; ss.addEventListener(ss.ON_SCHEDULED_START, onScheduledStart); @@ -78,7 +83,22 @@ function onLoad() { mediaList.innerHTML = "<h1><center style='font-size:" + fsRec + ";color:white;'> Please WAIT </center></h1>"; } - +function onEvent(event) { +var numObjs = event.objectNames.length; + for (var i=0; i<numObjs; i++) { + if(event.objectNames[i]="var.io.state" && toi.informationService.getObject(event.objectNames[i])="standby"){ + try { + mediaPlayer.close(); + mediaPlayer.releaseInstance(); + } catch(e) { + alert(e); + } + } else if(event.objectNames[i]="var.io.state" && toi.informationService.getObject(event.objectNames[i])="normal"){ + play(channels[currChan]); + } + } +} + function onUnload() { try { mediaPlayer.close(); @@ -89,6 +109,7 @@ function onUnload() { } mediaRecorder.close(); mediaRecorder.releaseInstance(); + toi.informationService.removeEventListener(toi.informationService.ON_OBJECTS_CHANGED, onEvent); eitCache.removeEventListener(eitCache.ON_CACHE_UPDATED, onCacheUpdated); mediaPlayer.removeEventListener(mediaPlayer.ON_DATA_AVAILABLE,onDataAvailableEvent); mediaRecorder.removeEventListener(mediaRecorder.ON_STATE_CHANGED, onRecorderStateChanged); @@ -130,6 +151,7 @@ function createRecorder() { mediaRecorder = toi.mediaService.createRecorderInstance(); } catch(e) { alert("Cannot create media recorder: " + e); + mediaRecorder = ""; } } @@ -672,7 +694,7 @@ function onKeyDown(event) { osdmute.style.opacity = mute; break; case "VolumeUp": - Volume = Volume + 10; + Volume = Volume + VolumeStep; if (Volume > 100) { Volume = 100; } @@ -680,7 +702,7 @@ function onKeyDown(event) { showVolume(); break; case "VolumeDown": - Volume = Volume - 10; + Volume = Volume - VolumeStep; if (Volume < 0) { Volume = 0; } @@ -1645,7 +1667,11 @@ function onKeyMenu(keyCode) { menu = 3; playMPD(MPDAddress); InitMenu(menu); + } else if (menu == 1) { + menu = 4; // INFO menu + InitMenu(menu); } + break; case KEY_0: if (menu !== 0) { @@ -1661,14 +1687,14 @@ function onKeyMenu(keyCode) { osdmute.style.opacity = mute; break; case "VolumeUp": - Volume = Volume + 10; + Volume = Volume + VolumeStep; if (Volume > 100) { Volume = 100; } toi.audioOutputService.setVolume(AudioOut, Volume); break; case "VolumeDown": - Volume = Volume - 10; + Volume = Volume - VolumeStep; if (Volume < 0) { Volume = 0; } @@ -1700,7 +1726,7 @@ function playMPD(uri) { function InitMenu(menu) { if(menu == 0) { // Main Menu - mainmenu.innerHTML = "<h1><center style='font-size:" + fsMenuMain + ";color:white;'> MainMenu \n ( " + Version + " )</center></h1><pre style='color:black;font-size:" + fsMenu + ";'> 1 - SettingsMenu \n 2 - Recordings \n 3 - TimersMenu\n 4 -\n 5 -\n 6 -\n 7 -\n 8 -\n 9 - MPD Server Connection\n\n BLUE - Restart Portal </pre>"; + mainmenu.innerHTML = "<h1><center style='font-size:" + fsMenuMain + ";color:white;'> MainMenu \n ( " + Version + " )</center></h1><pre style='color:black;font-size:" + fsMenu + ";'> 1 - SettingsMenu \n 2 - Recordings \n 3 - TimersMenu\n\n\n\n\n\n 9 - MPD Server Connection\n\n BLUE - Restart Portal </pre>"; } if(menu == 1) { // settings menu @@ -1712,7 +1738,7 @@ if(menu == 1) { // settings menu if (ShowProtectedChannels) { htmltext = htmltext + "\uE017"; } else { htmltext = htmltext + "\uE016"; } htmltext = htmltext + " Protection\n 8 - "; if (SwitchGuide) { htmltext = htmltext + "\uE017"; } else { htmltext = htmltext + "\uE016"; } - htmltext = htmltext + " Preview guide\n\n\n 0 - MainMenu </pre>"; + htmltext = htmltext + " Preview guide\n 9 - Show INFO\n 0 - MainMenu </pre>"; mainmenu.innerHTML = htmltext; } @@ -1746,6 +1772,33 @@ if(menu == 3) { // MPD Menu mainmenu.innerHTML = "<h1><center style='font-size:" + fsMenuMain + ";color:white;'> MPD Connection </center></h1><pre style='color:black;font-size:" + fsMenu + ";'> MENU to exit \n 0 - back to MainMenu </pre>"; } +if(menu == 4) { // INFO Menu + var htmltext = "<h1><center style='font-size:" + fsMenuMain + ";color:white;'> INFO </center></h1><pre style='color:black;font-size:" + fsMenu + ";'>"; + try { + is = toi.informationService; + + htmltext = htmltext + "\n Product name: " + is.getObject("config.productdisplayname"); + htmltext = htmltext + "\n Build date : " + is.getObject("config.build.date"); +// htmltext = htmltext + "\n IO State: " + is.getObject("var.io.state"); + + htmltext = htmltext + "\n\n IP address:" + is.getObject("config.ipaddress"); + var x = is.getObject("cfg.ip.eth0.mode"); + if (x == "DHCP") { htmltext = htmltext + "\n \uE017 "; } else { htmltext = htmltext + "\n \uE016 "; } + htmltext = htmltext + "DHCP"; + var x = is.getObject("var.capabilities.dvr"); + if (x !== "FALSE") { htmltext = htmltext + "\n \uE017 "; } else { htmltext = htmltext + "\n \uE016 "; } + htmltext = htmltext + "DVR "; + + + } catch(e) { + alert("Error : " + e); + } + htmltext = htmltext + "\n\n\n\n\n 0 - back to MainMenu </pre>"; + mainmenu.innerHTML = htmltext; + +} + + } // end of initmenu function LoadTimers() { @@ -1943,7 +1996,7 @@ function onKeyMedia(keyCode) { osdmute.style.opacity = mute; break; case "VolumeUp": - Volume = Volume + 10; + Volume = Volume + VolumeStep; if (Volume > 100) { Volume = 100; } @@ -1951,7 +2004,7 @@ function onKeyMedia(keyCode) { showVolume(); break; case "VolumeDown": - Volume = Volume - 10; + Volume = Volume - VolumeStep; if (Volume < 0) { Volume = 0; } diff --git a/settings.js b/settings.js index 8ef6a6c..2c69afc 100644 --- a/settings.js +++ b/settings.js @@ -6,8 +6,8 @@ // 1280x720 // 1920x1080 -var Xfactor = 1280 / 720; -var Yfactor = 720 / 576; +var Xfactor = 1920 / 720; +var Yfactor = 1080 / 576; var showClock = 0; // 0 = no, 1 = yes @@ -26,15 +26,16 @@ NN[3] = "TIMER"; NN[4] = "-----"; var ShowProtectedChannels = 1; // Default don't show protected channels. -var StartVolume = 50; // Volume on (re)start of the portal. +var StartVolume = 30; // Volume on (re)start of the portal. +var VolumeStep = 5; // Steps the volume buttons make var currChan = 10; // default channel var ChanGroup = 0; // default TV group var minChan = new Array(); var maxChan = new Array(); var defChan = new Array(); var baseChn = new Array(); var protChn = new Array(); var ServerAdres = new Array(); // Define settings for Channels. // Server for Recordings -var recServ = "http://192.168.3.15:8000"; -var MPDAddress = "http://192.168.3.15:8888/mpd.mp3"; +var recServ = "http://192.168.1.15:8000"; +var MPDAddress = "http://192.168.1.15:8888/mpd.mp3"; // Radio channels.js Settings minChan[9] = 9001; @@ -42,7 +43,7 @@ maxChan[9] = 9099; // set not too far from max rd channel to speed up zapping defChan[9] = 9051; baseChn[9] = 9000; protChn[9] = 0; -ServerAdres[9] = "http://192.168.3.15:3000/"; +ServerAdres[9] = "http://192.168.1.15:3000/"; // Protected channels.js Settings minChan[6] = 6001; @@ -50,7 +51,7 @@ maxChan[6] = 6040; // set not too far from max prt channel to speed up zapping defChan[6] = 6001; baseChn[6] = 6000; protChn[6] = 1; -ServerAdres[6] = "http://192.168.3.15:3000/"; +ServerAdres[6] = "http://192.168.1.15:3000/"; // TV channels.js Settings minChan[0] = 1; @@ -58,7 +59,7 @@ maxChan[0] = 999; // set not too far from max TV channel to speed up zapping defChan[0] = currChan; baseChn[0] = 0; protChn[0] = 0; -ServerAdres[0] = "http://192.168.3.15:3000/"; +ServerAdres[0] = "http://192.168.1.15:3000/"; //HD list minChan[1] = 1001; @@ -66,7 +67,7 @@ maxChan[1] = 1999; // set not too far from max HD channel to speed up zapping defChan[1] = 1001; baseChn[1] = 1000; protChn[1] = 0; -ServerAdres[1] = "http://192.168.3.15:3000/"; +ServerAdres[1] = "http://192.168.1.15:3000/"; // MultiCast minChan[5] = 5001; |