From c07a11c527ce74de1a600e46c4edfcfe5d9bc78a Mon Sep 17 00:00:00 2001 From: "M. Voerman" Date: Thu, 10 Jan 2013 22:59:08 +0100 Subject: Scheduler service support Some cleaning up and fixes in the recorder & player routines. --- History | 5 ++ index.html | 278 +++++++++++++++++++++++++++++++++++++++++++++++++----------- settings.js | 1 + 3 files changed, 234 insertions(+), 50 deletions(-) diff --git a/History b/History index cdc01db..dba1fb4 100644 --- a/History +++ b/History @@ -1,3 +1,8 @@ +0.11 Switch to Scheduler services for settings timers. + Some fixes in the recorder & player routine + Better support for "VDR on SmartTV" + + 0.10 Added sub Listinges for use as Radio list / Protected List / SD/HD list etc (Use for Multicast Channels keyword MultiCast in Serveradres) (Multicast & streamdev is limited to 255 channels?) diff --git a/index.html b/index.html index 630c649..4e51144 100644 --- a/index.html +++ b/index.html @@ -24,7 +24,7 @@ // // -var Version = "0.10 2013/01/08" +var Version = "0.10 2013/01/xx" for (var i = minChan[0]; i < (maxChan[0]+1); i++) { EPG[0][4][i] = "";EPG[1][4][i] = "";EPG[0][5][i] = "";EPG[1][5][i] = "";EPG[0][7][i] = "";EPG[1][7][i] = ""; } for (var i = minChan[1]; i < (maxChan[1]+1); i++) { EPG[0][4][i] = "";EPG[1][4][i] = "";EPG[0][5][i] = "";EPG[1][5][i] = "";EPG[0][7][i] = "";EPG[1][7][i] = ""; } @@ -47,6 +47,15 @@ function onLoad() { // eitCache.setFilterMode(eitCache.FILTER_MODE_PF_ONLY); eitCache.addEventListener(eitCache.ON_CACHE_UPDATED, onCacheUpdated); mediaPlayer.addEventListener(mediaPlayer.ON_DATA_AVAILABLE,onDataAvailableEvent); + mediaRecorder.addEventListener(mediaRecorder.ON_STATE_CHANGED, onRecorderStateChanged); + + var ss = toi.schedulerService; + ss.addEventListener(ss.ON_SCHEDULED_START, onScheduledStart); + ss.addEventListener(ss.ON_SCHEDULED_STOP, onScheduledStop); + ss.setCategorySubscription(onScheduledStart, "*"); + ss.setCategorySubscription(onScheduledStop, "*"); + setOSDtimer(); + showOSD(); colorkeys.style.fontSize = fsKeys; colorkeys.innerHTML = "" + NN[4] + "" + NN[1] + " Schedule INFO "; @@ -81,6 +90,9 @@ function onUnload() { mediaRecorder.releaseInstance(); eitCache.removeEventListener(eitCache.ON_CACHE_UPDATED, onCacheUpdated); mediaPlayer.removeEventListener(mediaPlayer.ON_DATA_AVAILABLE,onDataAvailableEvent); + mediaRecorder.removeEventListener(mediaRecorder.ON_STATE_CHANGED, onRecorderStateChanged); + mediaRecorder.removeEventListener(mediaRecorder.ON_PARAMETER_CHANGED, onRecorderStateChanged); + } catch(e) { alert(e); @@ -715,19 +727,25 @@ function onKeyDown(event) { } break; case "MediaStop": + if (isRecording == 1) { + recordStop(); + isRecording = 0; + } else { try { SetLed(1,1,0); mediaPlayer.playFromPosition(mediaPlayer.POSITION_LIVE,mediaPlayer.PACE_PLAY); } catch(e) { alert(e); } + } break; case KEY_REC: case "MediaRecord": if (isRecording == 1) { recordStop(); } else { - recordStart(); + createNewAsset(); + recordStart(ServerAdres + channels[currChan]); } break; @@ -892,32 +910,31 @@ function updateOSDtime(timchan) { function settimer() { if(SwitchTimer) { + try { + switchtimerID = toi.schedulerService.schedule("activity_1","record_hd_from_ip", EPG[NowNext][2][currChan] ,0); + toi.schedulerService.setParameter(switchtimerID, "Type", "SwitchOnly"); + toi.schedulerService.setParameter(switchtimerID, "Channel", currChan.toString() ); + } + catch (e) { + alert(e); + } tijd = EPG[NowNext][2][currChan]; date = new Date(tijd*1000); tijd = date.toUTCString(); tijd = new Date(tijd); var tm = tijd.getMinutes(); var th = tijd.getHours(); - if(th<10) { - th = "0"+th; - } - if(tm<10) { - tm = "0"+tm; - } - dateCurrent = new Date(); - var StartTime = Math.floor((date.getTime() - dateCurrent.getTime())); - timerChan = currChan; - TimerActions = "isVisible = 0; isFullscreen = 1; FullScreen(); setVisible(isVisible); currChan = timerChan; play(timerChan); osdtimer.innerHTML = '';SetLed(0,0,0);switchicon = '\uE003';osdca.innerHTML = CAicon + switchicon;" - // only 1 switch timer possible - if(switchtimerID) { - clearTimeout(switchtimerID); - } - switchtimerID = setTimeout(TimerActions, StartTime); + if(tm<10) + { + tm = "0"+tm; + } + if(th<10) + { + th = "0"+th; + } + switchtimer.innerHTML = "

Name : " + EPG[NowNext][1][currChan] + "

channel : " + channelsnames[currChan] + "

Starttime : " + th + ":" + tm + "

"; - osdtimer.innerHTML = "

" + th + ":" + tm + "

"; - SetLed(0,2,1); - switchicon = "\uE00C"; - osdca.innerHTML = CAicon + switchicon; + setOSDtimer(); } else { // // No Switch timer so send timer info to Server @@ -925,7 +942,37 @@ function settimer() { } } -// linker n tekens van string + +function setOSDtimer() { + + tijd = toi.schedulerService.getNextStartTime("*"); + if (tijd !== 0) { + date = new Date(tijd*1000); + tijd = date.toUTCString(); + tijd = new Date(tijd); + var tm = tijd.getMinutes(); + var th = tijd.getHours(); + if(tm<10) + { + tm = "0"+tm; + } + if(th<10) + { + th = "0"+th; + } + osdtimer.innerHTML = "

" + th + ":" + tm + "

"; + SetLed(0,2,1); + switchicon = "\uE00C"; + osdca.innerHTML = CAicon + switchicon; + } else { + osdtimer.innerHTML = " "; + SetLed(0,0,0); + switchicon = '\uE003'; + osdca.innerHTML = CAicon + switchicon; + } +} + +// Left n characters of str function Left(str, n){ if (n <= 0) return ""; @@ -935,7 +982,7 @@ function Left(str, n){ return String(str).substring(0,n); } -// rechter n tekens van string +// Right n characters of str function Right(str, n){ if (n <= 0) return ""; @@ -1483,13 +1530,6 @@ function onKeyMenu(keyCode) { } else if (menu == 1) { ShowSubs = 1 - ShowSubs; videoplane.subtitles = Boolean(ShowSubs); // Enable subtitles or Disable subtitles - } else if (menu == 2) { - clearTimeout(switchtimerID); - switchtimerID = 0; - osdtimer.innerHTML = ""; - switchicon = "\uE003"; - osdca.innerHTML = CAicon + switchicon; - SetLed(0,0,0); } InitMenu(menu); @@ -1497,7 +1537,7 @@ function onKeyMenu(keyCode) { case KEY_2: if (menu == 0) { isSetupMenu = 0; - mediaList.style.opacity = 0.8; + mediaList.style.opacity = 0.9; mainmenu.style.opacity = 0; setTimeout("getRecList();LoadMediaSettings();",100); } @@ -1515,7 +1555,10 @@ function onKeyMenu(keyCode) { break; case KEY_3: if (menu == 0) { - menu = 2; + isSetupMenu = 0; + mediaList.style.opacity = 0.9; + mainmenu.style.opacity = 0; + LoadTimers(); } else if (menu == 1) { is = toi.informationService; if(subsmode == 0 ) { @@ -1558,7 +1601,7 @@ function onKeyMenu(keyCode) { case KEY_9: if (menu == 0) { isSetupMenu = 0; - mediaList.style.opacity = 0.8; + mediaList.style.opacity = 0.9; mainmenu.style.opacity = 0; getRecList2(); LoadMediaSettings(); @@ -1592,15 +1635,23 @@ if(menu == 1) { mainmenu.innerHTML = "

Settings

   Frontdisplay Clock : " + Boolean(showClock) + "\n   Prio audio track : " + (toi.informationService.getObject("cfg.media.audio.languagepriority")) + "\n   Preview guide : " + Boolean(SwitchGuide) + "\n   1 - Show Subs : " + Boolean(ShowSubs) + "\n   2 - Subs Type Prio : " + (toi.informationService.getObject("cfg.media.subtitling.typepriority")) + "\n   3 - Subs Mode Prio : " + (toi.informationService.getObject("cfg.media.subtitling.modepriority")) + "\n   4 - Audio Type Prio : " + (toi.informationService.getObject("cfg.media.audio.typepriority")) + "\n   5 - Protection : " + Boolean(ShowProtectedChannels) + "\n\n\n\n   0 - MainMenu 
"; } -if(menu == 2) { -// Timers menu - mainmenu.innerHTML = "

Timers

\n   1 - Switch timer : " + Boolean(switchtimerID) + "" + "\n\n\n\n   0 - MainMenu 
"; } +// End of Menu section + +// Timer Menu Section + +function LoadTimers() { + +// Timers menu + mainmenu.innerHTML = "

Timers

\n   Press OK to remove a timer" + "\n\n\n\n   0 - MainMenu 
"; + + + InitMenu(menu); } -// End of Menu section +// End of Timers Menu // Media Player Section @@ -1610,10 +1661,12 @@ function LoadMediaSettings() { currMed = 0; showMediaList(); mediaPlayer.addEventListener(mediaPlayer.ON_POSITION_CHANGED, ShowMediaOSD); + mediaPlayer.addEventListener(mediaPlayer.ON_STATE_CHANGED, onStateChanged); } function UnloadMediaSettings() { mediaPlayer.removeEventListener(mediaPlayer.ON_POSITION_CHANGED, ShowMediaOSD); + mediaPlayer.removeEventListener(mediaPlayer.ON_STATE_CHANGED, onStateChanged); mediaList.style.opacity = 0; mediaList.innerHTML = "

Please WAIT

"; showDisplay((currChan.toString()), false, 100, 0 ); @@ -1632,6 +1685,28 @@ function onKeyMedia(keyCode) { UnloadMediaSettings(); break; break; + case "Right": + if (mediaList.style.opacity != 0) { + incMed(9); + do + { + incMed(1); + } + while (!recTitl[currMed]); + showMediaList(); + } + break; + case "Left": + if (mediaList.style.opacity != 0) { + decMed(9); + do + { + decMed(1); + } + while (!recTitl[currMed]); + showMediaList(); + } + break; case "Down": if (mediaList.style.opacity != 0) { do @@ -1695,6 +1770,13 @@ function onKeyMedia(keyCode) { audio = 0; } break; + case KEY_REC: + case "MediaRecord": + createNewAsset(); + recordStart(recLink[currMed]); + UnloadMediaSettings(); +// setTimeout("recordStop();",((recDura[currMed] * 1000) + 5000)); + break; case "MediaRewind": if (mediaPlayer.getState() != mediaPlayer.STATE_IDLE) { mediaPlayer.play(-4000); @@ -1704,18 +1786,20 @@ function onKeyMedia(keyCode) { case "MediaForward": if (mediaPlayer.getState() != mediaPlayer.STATE_IDLE) { mediaPlayer.play(4000); +// mediaPlayer.playFromPosition(12000,1000); showDisplay("FF", false, 100, 0 ); } break; case "MediaStop": - if (mediaPlayer.getState() != mediaPlayer.STATE_IDLE) { - mediaPlayer.close(); - } + // if (mediaPlayer.getState() != mediaPlayer.STATE_IDLE) { + // mediaPlayer.close(); + // } + play(channels[currChan]); if (isRecording == 1) { recordStop(); isRecording = 0; } - mediaList.style.opacity = 0.8; + mediaList.style.opacity = 0.9; showDisplay("STOP", false, 100, 0 ); showMediaList(); break; @@ -1768,21 +1852,25 @@ for (i=0;i diff --git a/settings.js b/settings.js index 5e9c6a4..5cc6d68 100644 --- a/settings.js +++ b/settings.js @@ -211,5 +211,6 @@ var substype = 0; // "cfg.media.subtitling.typepriority","normal,hearing_impair var recTitl = new Array(); var recLink = new Array(); var recDesc = new Array(); +var recDura = new Array(); var nrMedia = 0; -- cgit v1.2.3