From a17e8d4f3939461e140fb0366f79ccf748cce571 Mon Sep 17 00:00:00 2001 From: "M. Voerman" Date: Sun, 16 Dec 2012 15:06:37 +0100 Subject: Changed to SVG, --> !!needs SVG bootimage!! --- History | 3 + index.html | 1405 ------------------------------------------------------------ index.svg | 92 ++++ main.js | 1352 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1447 insertions(+), 1405 deletions(-) delete mode 100644 index.html create mode 100644 index.svg create mode 100644 main.js diff --git a/History b/History index bc4b2f8..40f299a 100644 --- a/History +++ b/History @@ -1,3 +1,6 @@ +0.10 Changed from webkit to svg, easier for Skinning, 720, 1080 size OSD. + + 0.04 Volume OSD bar Media Player added. Only Play/ Pause & FF, no REW. diff --git a/index.html b/index.html deleted file mode 100644 index 7c658bd..0000000 --- a/index.html +++ /dev/null @@ -1,1405 +0,0 @@ - - - - - - - - -
-
- -
----- Next Schedule INFO
- - -
--------- GUIDE ----
- -
-
- - - - -
Volume :
-
- -
-
-
-
-
-
- -
- -
-
- -
-
- -
- - - - - diff --git a/index.svg b/index.svg new file mode 100644 index 0000000..e50aba3 --- /dev/null +++ b/index.svg @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + Audio Track Information + This portal displays information about the audio tracks + found in the current stream + + + Press UP and DOWN to change TV channel + Press LEFT and RIGHT to change audio track + + + + Current audio track: + - + + + + Encoding: + - + + Sample rate: + - + + Format: + - + + Mode: + - + + Language: + - + + Subtitle: + - + + Audience type: + - + + Component tag: + - + + + + + - + + + + + + + + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..4e29bb9 --- /dev/null +++ b/main.js @@ -0,0 +1,1352 @@ +// +// Javascript VDR client for Motorola VIP19x0 & VIP19x3 +// +// Martin Voerman Rekordc@gmail.com +// +// TODO +// +// Sound mapping for AC3 +// auto epg switch language for EIT Cache +// +// make VDR connection +// get/set/create/edit timers +// make/view recordings +// +// Mainmenu +// set/save changes to cfg.custom.xxx +// change IP server +// + +var Version = "0.10 2012/12/xx" +var nrChannels = channels.length; +var nrMedia = recording.length - 1; + +window.onkeydown = onKeyDown; + +function onLoad() { + createPlayer(); + embedTeletextPlugin(); + toi.audioOutputService.setVolume(AudioOut, StartVolume); + toi.audioOutputService.setMuteState(AudioOut, false); + showDisplay((currChan.toString()), false, 100, 0 ); + play(channels[currChan]); + eitCache = toi.dvbEitService.createInstance(); + eitCache.setFilterMode(eitCache.FILTER_MODE_PF_AND_SCHEDULE); +// eitCache.setFilterMode(eitCache.FILTER_MODE_PF_ONLY); + eitCache.addEventListener(eitCache.ON_CACHE_UPDATED, onCacheUpdated); + showOSD(); +} + + +function onUnload() { + try { + mediaPlayer.close(); + mediaPlayer.releaseInstance(); + } catch(e) { + alert(e); + } +} + +function incChan(step) { + currChan = currChan + step; + if (currChan == nrChannels) { + currChan = 1; + } + osdnr.style.opacity = isFullscreen; + OSDchannr(currChan); +} + +function decChan(step) { + currChan = currChan - step; + if (currChan == 0) { + currChan = nrChannels - 1; + } + osdnr.style.opacity = isFullscreen; + OSDchannr(currChan); +} + +function createPlayer() { + try { + mediaPlayer = toi.mediaService.createPlayerInstance(); + } catch(e) { + alert("Failed creating player: " + e); + } +} + +function play(uri) { + try { + if (mediaPlayer.getState() != mediaPlayer.STATE_IDLE) { + mediaPlayer.close(); + } + uri = ServerAdres + uri; + mediaPlayer.open(uri); + mediaPlayer.play(1000); + if(isFullscreen) { + showOSD(); + } + showDisplay((currChan.toString()), false, 100, 0 ); + } catch (e) { + alert("Failed opening stream: " + e); + return; + } +} + +function preview(urip) { + if(SwitchGuide) { + play(urip); + } + showChannelList(); + if (isSchedule) { + GetSchedule(currChan,10); + } +} + + +function FullScreen() { + videoplane.style.width = "100%"; + videoplane.style.height = "100%"; + videoplane.style.left = "0px"; + videoplane.style.top = "0px"; +} + + +function onKeyDown(event) { + if(isVisible) { + onKeyTeletext(event.keyIdentifier); + } else if(isMediaMenu) { + onKeyMedia(event.keyIdentifier); + } else if(isSetupMenu) { + onKeyMenu(event.keyIdentifier); + } else { + + switch(event.keyIdentifier) { + case "Up": + if(isFullscreen) { + count = 0; + prevChan = currChan; + do + { + incChan(1); + } + while (!channels[currChan]); + play(channels[currChan]); + } else { + // swap up <> down in guide mode + count = 0; + do + { + decChan(1); + } + while (!channels[currChan]); + preview(channels[currChan]); + } + break; + case "Down": + if(isFullscreen) { + count = 0; + prevChan = currChan; + do + { + decChan(1); + } + while (!channels[currChan]); + play(channels[currChan]); + } else { + // swap up <> down in guide mode + count = 0; + do + { + incChan(1); + } + while (!channels[currChan]); + preview(channels[currChan]); + } + break; + case "Left": + count = 0; + prevChan = currChan; + if (currChan > 9) { + decChan(9); + } else { + currChan = nrChannels - currChan; + } + do + { + decChan(1); + } + while (!channels[currChan]); + if(isFullscreen) { + play(channels[currChan]); + } else { + preview(channels[currChan]); + } + break; + case "Right": + count = 0; + prevChan = currChan; + if (currChan < (nrChannels - 9 )) { + incChan(9); + } else { + currChan = nrChannels - currChan; + } + do + { + incChan(1); + } + while (!channels[currChan]); + if(isFullscreen) { + play(channels[currChan]); + } else { + preview(channels[currChan]); + } + break; + case "Red": + if(isFullscreen) { + if(showClock == 0 ) { + showDisplay("", true, 80, 1 ); + showClock = 1; + } else if(showClock == 1 ) { + showClock = 0; + showDisplay((currChan.toString()), false, 100, 0 ); + } + } else { + if(NowNext) { + settimer(); + switchtimer.style.opacity = 1; + setTimeout("switchtimer.style.opacity = 0; ", 2000); +// } else { +// switchtimer.innerHTML = "
Program is running use OK to switch
"; +// switchtimer.style.opacity = 1; +// setTimeout("switchtimer.style.opacity = 0; ", 2000); + } + } + break; + case "Green": + if(isFullscreen) { + if(!epgactive) { + audio = audio + 1; + is = toi.informationService; + if(audio == 1) { + is.setObject("cfg.media.audio.languagepriority","dut,eng",is.STORAGE_VOLATILE); + osdlang.style.opacity = 1; + osdlang.innerHTML = "Nederlands" + setTimeout("osdlang.style.opacity = 0; ", 3000); + } else if(audio == 2) { + is.setObject("cfg.media.audio.languagepriority","ger,deu,eng",is.STORAGE_VOLATILE); + osdlang.style.opacity = 1; + osdlang.innerHTML = "Deutsch" + setTimeout("osdlang.style.opacity = 0; ", 3000); + } else if(audio == 3) { + is.setObject("cfg.media.audio.languagepriority","eng",is.STORAGE_VOLATILE); + osdlang.style.opacity = 1; + osdlang.innerHTML = "English" + setTimeout("osdlang.style.opacity = 0; ", 3000); + audio = 0; + } + } else { + osdepginfo.style.opacity = 1 - osdepginfo.style.opacity ; + osdepginfonext.style.opacity = 1 - osdepginfo.style.opacity; + } + } else { + colorkeys.innerHTML = "" + NN[3 + NowNext] + "" + NN[NowNext] + " Schedule INFO "; + NowNext = 1 - NowNext; + showChannelList(); + } + + break; + case "Yellow": + if(isFullscreen) { + if(!epgactive) { + GetSchedule(currChan,15); + schedule.style.opacity = 1; + schedule.style.height = "75%"; + setTimeout("schedule.style.opacity = 0;schedule.style.height = '45%';", 3000); + } + } else { + GetSchedule(currChan,10); + schedule.style.opacity = 1 - schedule.style.opacity; + channelList.style.opacity = 1 - schedule.style.opacity; + schedkeys.style.opacity = schedule.style.opacity; + colorkeys.style.opacity = 1 - schedule.style.opacity; + isSchedule = schedule.style.opacity; + } + break; + case "Blue": + if(isFullscreen) { + RestartPortal(); + } else { + SetOsdInfo(); + osdepginfo.style.opacity = 1 - NowNext; + osdepginfonext.style.opacity = NowNext; + setTimeout("epgactive = 0; osdepginfo.style.opacity = 0; osdepginfonext.style.opacity = 0;", 5000); + } + break; + case "BrowserBack": + if(count) { + count = 0; + osdnr.style.opacity = 0; + if(isFullscreen) { + showDisplay((currChan.toString()), false, 100, 0 ); + } + Change = 0; + } else { + if(isFullscreen) { + //SHOW epg info + SetOsdInfo(); + osdepginfo.style.opacity = 1; + osdepginfonext.style.opacity = 0; + epgactive = 1; + setTimeout("epgactive = 0; osdepginfo.style.opacity = 0; osdepginfonext.style.opacity = 0;", 5000); + } else if(!isFullscreen){ + isFullscreen = 1; + FullScreen(); + currChan = preChan; + } + } + break; + + case "Enter": + // OK key on frontpanel + case "Accept": + if(isFullscreen) { + // fullscreen + if(!count) { + showOSD(); + } else { + CheckChannel(Change); + count = 0; + if(ChangeOK) { + play(channels[currChan]); + ChangeOK = 0; + } + } + } else { + // if not fullscreen + if(count){ + CheckChannel(Change); + count = 0; + if(ChangeOK) { + preview(channels[currChan]); + ChangeOK = 0; + } + } else { + isFullscreen = 1; + FullScreen(); + play(channels[currChan]); + } + } + break; + + case "Menu": + if(isFullscreen) { + isSetupMenu = 1; + mainmenu.style.opacity = 1; + InitMenu(); + } + break; + case "Scroll": + if(isFullscreen) { + NowNext = 0; + videoplane.style.width = "320px"; + videoplane.style.height = "240px"; + videoplane.style.left = "380px"; + videoplane.style.top = "300px"; + showChannelList(); + isFullscreen = 0; + if(!SwitchGuide) { + preChan = currChan; + } + } else { + isFullscreen = 1; + FullScreen(); + if(!SwitchGuide) { + currChan = preChan; + } + } + break; + case "TV": + currChan = prevChan; + showDisplay((currChan.toString()), false, 100, 0 ); + play(channels[currChan]); + break; + + case KEY_0: + digit = 0; + Makedigit(); + break; + case KEY_1: + digit = 1; + Makedigit(); + break; + case KEY_2: + digit = 2; + Makedigit(); + break; + case KEY_3: + digit = 3; + Makedigit(); + break; + case KEY_4: + digit = 4; + Makedigit(); + break; + case KEY_5: + digit = 5; + Makedigit(); + break; + case KEY_6: + digit = 6; + Makedigit(); + break; + case KEY_7: + digit = 7; + Makedigit(); + break; + case KEY_8: + digit = 8; + Makedigit(); + break; + case KEY_9: + digit = 9; + Makedigit(); + break; + case "Teletext": + if(isFullscreen) { + isVisible = 1; + setVisible(isVisible); + } + break; + case "VolumeMute": + state = toi.audioOutputService.getMuteState(AudioOut); + toi.audioOutputService.setMuteState(AudioOut, !state); + mute = 1 - state; + osdmute.style.opacity = mute; + break; + case "VolumeUp": + Volume = Volume + 10; + if (Volume > 100) { + Volume = 100; + } + toi.audioOutputService.setVolume(AudioOut, Volume); + showVolume(); + break; + case "VolumeDown": + Volume = Volume - 10; + if (Volume < 0) { + Volume = 0; + } + toi.audioOutputService.setVolume(AudioOut, Volume); + showVolume(); + break; + + case "MediaRewind": + break; + case "MediaForward": + break; + case "MediaPlayPause": + break; + case "MediaStop": + mediaList.style.opacity = 0.8; + isMediaMenu = 1; + showDisplay("STOP", false, 100, 0 ); + currMed = 0; + showMediaList(); + break; + case "MediaRecord": + break; + + default: + break; + } + } +} + +function Makedigit() { + prevChan = currChan; + Change = (Change*10) + digit; + count = count + 1; + osdnr.style.opacity = isFullscreen; + OSDchannr(Change); + if(isFullscreen) { + showDisplay((Change.toString()), false, 100, 0 ); + } + + if (count>2) { + CheckChannel(Change); + count = 0; + } + if(ChangeOK) { + if(isFullscreen) { + play(channels[currChan]); + } else { + preview(channels[currChan]); + } + ChangeOK = 0; + } +} + +function CheckChannel(CheckThis) { +// function to check if channel exists + if(channels[CheckThis]) { + ChangeOK = 1; + currChan = CheckThis; + } else { + ChangeOK = 0; + } + if(prevChan == currChan) { + ChangeOK = 0 ; + } + osdnr.style.opacity = 0; + if(isFullscreen) { + showDisplay((currChan.toString()), false, 100, 0 ); + } + Change = 0; + +} + + +function showDisplay(showtxt,colonState,intensity,currentMode) { + if(!showClock){ + toi.frontPanelService.setSegmentDisplayState(toi.statics.ToiFrontPanelServiceSegmentDisplayState.create(showtxt,colonState,intensity,currentMode)); + } +} + +function SetLed(NumLed,color,blinkfreq){ + var fps = toi.frontPanelService; + var state = toi.statics.ToiFrontPanelServiceLedState.create(color, blinkfreq); + fps.setLedState(NumLed, state); +} + + +function showOSD() { + if (osdtimeout) { + clearTimeout(osdtimeout); + } + SetOsdInfo(); + opacity = 1; + OSD(opacity); + osdtimeout = setTimeout("fadeOut()", 3000); +} + +function showVolume() { + if (osdVolumetimeout) { + clearTimeout(osdVolumetimeout); + } + osdvolume.innerHTML = "VOLUME : \uE007" + (new Array(Volume)).join("\uE008") + (new Array(100 - Volume)).join("\uE009") + "\uE00A"; + osdvolume.style.opacity = 1; + osdVolumetimeout = setTimeout("osdvolume.style.opacity = 0;", 3000); +} + + +function OSD(opacity) { + osdmain.style.opacity = opacity; + osdnr.style.opacity = opacity; + osdtime.style.opacity = opacity; + osdname.style.opacity = opacity; + osdepg.style.opacity = opacity; + osdca.style.opacity = opacity; + osdtimer.style.opacity = opacity; +} + + +function SetOsdInfo() { + OSDchannr(currChan); + date_time(); + GetEPG(currChan); + OSDhtml(); + return; +} + +function onCacheUpdated() { + if (osdtimeout) { + GetEPG(currChan); + SetOsdInfo(); + } +// if (!isFullscreen) { +// showChannelList(); +// } + if (isSchedule) { + GetSchedule(currChan,10); + } + +} + +function OSDchannr(channr) { + osdnr.innerHTML = "
" + channr + "
"; +} + +function OSDhtml(){ + osdtime.innerHTML = "" + result +""; + osdname.innerHTML = "" + Left(channelsnames[currChan],30) + ""; + osdepg.innerHTML = "

" + EPG[0][7][currChan] + "

\n

" + EPG[1][7][currChan] + "

"; + osdepginfo.innerHTML = "

" + EPG[0][7][currChan] + "

\n

" + EPG[0][4][currChan] + "

\n

" + Left(EPG[0][5][epgchan],750) + "

"; + osdepginfonext.innerHTML = "

" + EPG[1][7][currChan] + "

\n

" + EPG[1][4][currChan] + "

\n

" + Left(EPG[1][5][epgchan],750) + "

"; +} + + + +function settimer() { + if(SwitchTimer) { + 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);" + // only 1 switch timer possible + if(switchtimerID) { + clearTimeout(switchtimerID); + } + switchtimerID = setTimeout(TimerActions, StartTime); + switchtimer.innerHTML = "

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

channel : " + channelsnames[currChan] + "

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

"; + osdtimer.innerHTML = "

" + th + ":" + tm + "

"; + SetLed(0,2,1); + } else { + // + // No Switch timer so send timer info to Server + // + } +} + +// linker n tekens van string +function Left(str, n){ + if (n <= 0) + return ""; + else if (n > String(str).length) + return str; + else + return String(str).substring(0,n); +} + +// rechter n tekens van string +function Right(str, n){ + if (n <= 0) + return ""; + else if (n > String(str).length) + return str; + else { + var iLen = String(str).length; + return String(str).substring(iLen, iLen - n); + } +} + +function fadeIn() { + opacity += 0.2; + OSD(opcity); + if (opacity >= 1) { + setTimeout("fadeOut()", 200); + return; + } + setTimeout("fadeIn()", 100); +} + +function fadeOut() { + opacity -= 0.2; + OSD(opacity); + if (opacity <= 0) { + return; + } + setTimeout("fadeOut()", 100); +} + +function RestartPortal(){ + + try { + ids = toi.applicationService.getApplicationIds(); + for ( i = 0; i < ids.length; ++i ){ + info = toi.applicationService.getInfo(ids[i]); + if (info.applicationName == "WebKit Portal"){ + dump("Killing app " + ids[i] + ": " + info.applicationName); + toi.applicationService.kill(ids[i]); + } + } + } + catch(e) { dump(e) }; +} + +function date_time() +{ + date = new Date; + year = date.getFullYear(); + month = date.getMonth(); + d = date.getDate(); + day = date.getDay(); + h = date.getHours(); + if(h<10) + { + h = "0"+h; + } + m = date.getMinutes(); + if(m<10) + { + m = "0"+m; + } + s = date.getSeconds(); + if(s<10) + { + s = "0"+s; + } + result = ''+days[day]+' '+d+' '+months[month]+' '+year+' '+h+':'+m; + return; +} + +// EPG Section + +function GetEPG(epgchan) +{ + EPG[0][7][epgchan] = ""; + EPGShortnow = ""; + EPGExtnow = ""; + EPG[1][7][epgchan] = ""; + EPGShortnext = ""; + EPGExtnext = ""; + cds = 0; + try { + // streaminfo + // SI[x] 0-sat,1-NID,2-TID,3-SID + SI=channels[epgchan].split("-"); + is = toi.informationService; + is.setObject("cfg.locale.ui","ger",is.STORAGE_VOLATILE); + if(SI[0]=="S28.2E") { + is.setObject("cfg.locale.ui","eng",is.STORAGE_VOLATILE); + } + if((SI[0]=="S23.5E" && SI[1]=="3") || SI[2]=="1026" || SI[2]=="1097" || SI[2]=="1105" || SI[2]=="1119") { + is.setObject("cfg.locale.ui","dut",is.STORAGE_VOLATILE); + cds = 1; + } + + eitService = toi.statics.ToiDvbEitCacheServiceItem.create(SI[1],SI[2],SI[3]); + eitCache.addService(eitService); + event = eitCache.getPresentEvent(eitService); + if(event.freeCaMode){ + osdca.innerHTML = "\uE00D"; + } else { + osdca.innerHTML = "\uE00F"; + } + + if (event.name) + { + events = eitCache.getEvents(eitService, 1000000000, 2000000000); + extEventsnow = eitCache.getExtendedEventInfo(eitService, events.infoSequence[0].eventId); + extEventsnext = eitCache.getExtendedEventInfo(eitService, events.infoSequence[1].eventId); + EPGShortnow = extEventsnow.shortInfo; + EPGShortnext = extEventsnext.shortInfo; + EPGExtnow = extEventsnow.extendedInfo; + EPGExtnext = extEventsnext.extendedInfo; + } + + EPG[0][1][epgchan] = event.name; + EPG[0][2][epgchan] = event.time; + EPG[0][3][epgchan] = (event.duration/60); + EPG[0][4][epgchan] = ""; + EPG[0][5][epgchan] = ""; + + if(EPGShortnow) { + EPG[0][4][epgchan] = EPGShortnow; + } + if(EPGExtnow) { + EPG[0][5][epgchan] = EPGExtnow; + } + + tijd = event.time; + date = new Date(tijd*1000); + tijd = date.toUTCString(); + tijd = new Date(tijd); + dateCurrent = new Date(); + var EPGminutes = Math.floor((dateCurrent.getTime() - date.getTime()) /1000/60); + var tm = tijd.getMinutes(); + var th = tijd.getHours(); + if(th<10) + { + th = "0"+th; + } + if(tm<10) + { + tm = "0"+tm; + } + if(cds){ + // CDS has short info, other providers, a little longer. + EPG[0][7][epgchan] = th + ":" + tm + " (" + EPGminutes + " / " + ((event.duration/60)-EPGminutes).toFixed(0) + ")" + " " + event.name + " " + EPGShortnow; + } else { + EPG[0][7][epgchan] = th + ":" + tm + " (" + EPGminutes + " / " + ((event.duration/60)-EPGminutes).toFixed(0) + ")" + " " + event.name + " "; + } + if (!event.time) + { + EPG[0][7][epgchan] = " "; + } + + + event = eitCache.getFollowingEvent(eitService); + + EPG[1][1][epgchan] = event.name; + EPG[1][2][epgchan] = event.time; + EPG[1][3][epgchan] = (event.duration/60); + EPG[1][4][epgchan] = ""; + EPG[1][5][epgchan] = ""; + + if(EPGShortnext) { + EPG[1][4][epgchan] = EPGShortnext; + } + if(EPGExtnext) { + EPG[1][5][epgchan] = EPGExtnext; + } + + tijd = event.time; + 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; + } + + if(cds){ + // CDS has short info, other providers, a little longer. + EPG[1][7][epgchan] = th + ":" + tm + " (" + (event.duration/60).toFixed(0) + ")" + " " + event.name + " " + EPGShortnext; + } else { + EPG[1][7][epgchan] = th + ":" + tm + " (" + (event.duration/60).toFixed(0) + ")" + " " + event.name + " "; + } + if (!event.time) + { + EPG[1][7][epgchan] = " "; + } + + + } catch(e) { + alert("Get EPG problem: " + e); + } +} + + + +function GetSchedule(schchan,tablelength){ + try { + SI=channels[schchan].split("-"); + is = toi.informationService; + is.setObject("cfg.locale.ui","ger",is.STORAGE_VOLATILE); + if(SI[0]=="S28.2E") { + is.setObject("cfg.locale.ui","eng",is.STORAGE_VOLATILE); + } + if((SI[0]=="S23.5E" && SI[1]=="3") || SI[2]=="1026" || SI[2]=="1097" || SI[2]=="1105" || SI[2]=="1119") { + is.setObject("cfg.locale.ui","dut",is.STORAGE_VOLATILE); + cds = 1; + } + + eitService = toi.statics.ToiDvbEitCacheServiceItem.create(SI[1],SI[2],SI[3]); + eitCache.addService(eitService); + event = eitCache.getPresentEvent(eitService); + events = eitCache.getEvents(eitService, 1000000000, 2000000000); + + if (event.name) { + if (events.more) { + var t = eitCache.getEvents(eitService, 1000000000, 2000000000); + events.infoSequence.concat(t.infoSequence); + events.more = t.more; + } + + var txt = ""; + var i = 0; + for (i = 0; i < events.infoSequence.length && i < tablelength; i++) { + + while ((i > 0) && (events.infoSequence[i].eventId == events.infoSequence[(i-1)].eventId)) { + i = i +1; + } + + tijd = events.infoSequence[i].time; + 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; + } + + txt = txt + ""; + } + txt = txt + "
" + th + ":" + tm + " (" + events.infoSequence[i].duration/60 + ") " + events.infoSequence[i].name + "
"; + schedule.innerHTML = channelsnames[schchan] + txt; + } else { + schedule.innerHTML = "

" + channelsnames[schchan] + "

"; + } + + } catch(e) { + alert("Get EPG problem: " + e); + schedule.innerHTML = "

" + channelsnames[schchan] + "

NO EPG

"; + } + +} + +// End of EPG section + + + +// Channelslist / EPG Guide +// +// show currchan - 5 +// highlite currchan +// show currchan + 5 +// +// check if chan is OK +// +function showChannelList() { + var liststyle = ""; + var htmlstring = ""; + listChan = currChan-5; + for(var i=currChan-5; i<=currChan+5; i++) { + if (listChan<1) { + listChan=nrChannels-2; + } + if (listChan>nrChannels-2) { + listChan=0; + } + do + { + listChan = listChan + 1; + } + while (!channels[listChan] && (listChan" + listChan + "" + Left(channelsnames[listChan],15) + "" + Left(EpgInfo[NowNext],64) + ""; + } + htmlstring = htmlstring + "
"; + channelList.innerHTML = htmlstring; + chanlistepg.innerHTML = "

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

" + Left(EPG[NowNext][4][currChan],250) + "

" ; + +} + +// END of Channelslist / EPG Guide + +// TeleTXT section + +function embedTeletextPlugin() { + teletext = document.createElement("embed"); + teletext.id = "teletext"; + teletext.type = "application/motorola-teletext-plugin"; + teletext.style.position = "absolute"; + teletext.style.width = "100%"; + teletext.style.height = "100%"; + teletext.style.top = "10px"; // has to be 1 rather than 0 + teletext.style.left = "10px"; // has to be 1 rather than 0 + teletext.style.zIndex = "501"; + return teletext; +} + + +function setVisible(isVisible) { + if (isVisible) { + videoplane.style.width = "50%"; + videoplane.style.left = "50%"; + document.body.appendChild(teletext); + teletext.style.width = "50%"; + teletext.style.visibility = "visible"; + channelList.style.visibility = "hidden"; + colorkeys.style.visibility = "hidden"; + } else { + teletext.style.visibility = "hidden"; + channelList.style.visibility = "visible"; + colorkeys.style.visibility = "visible"; + } +} + + +function onKeyTeletext(keyCode) { + switch(keyCode) { + case "Left": + teletext.api.gotoNextPage(); + break; + case "Right": + teletext.api.gotoPreviousPage(); + break; + case "Red": + teletext.api.inputRedKey(); + break; + case "Green": + teletext.api.inputGreenKey(); + break; + case "Yellow": + teletext.api.inputYellowKey(); + break; + case "Blue": + teletext.api.inputCyanKey(); + break; + case "MediaRewind": + teletext.api.gotoPreviousSubpage(); + break; + case "MediaForward": + teletext.api.gotoNextSubpage(); + break; + case "MediaStop": + teletext.style.width = "100%"; + teletext.api.transparent = !teletext.api.transparent; + FullScreen(); + break; + case "BrowserBack": + case "Teletext": + isVisible = 0; + FullScreen(); + setVisible(isVisible); + break; + + case "TV": + teletext.api.gotoIndexPage(); + break; + + case KEY_0: + teletext.api.inputDigit(0); + break; + case KEY_1: + teletext.api.inputDigit(1); + break; + case KEY_2: + teletext.api.inputDigit(2); + break; + case KEY_3: + teletext.api.inputDigit(3); + break; + case KEY_4: + teletext.api.inputDigit(4); + break; + case KEY_5: + teletext.api.inputDigit(5); + break; + case KEY_6: + teletext.api.inputDigit(6); + break; + case KEY_7: + teletext.api.inputDigit(7); + break; + case KEY_8: + teletext.api.inputDigit(8); + break; + case KEY_9: + teletext.api.inputDigit(9); + break; + + + + } +} + +// end of TeleTXT section + + +// Menu section + +function onKeyMenu(keyCode) { + switch(keyCode) { + case "Menu": + case "BrowserBack": + isSetupMenu = 0; + mainmenu.style.opacity = 0; + break; + case "Left": + break; + case "Right": + break; + case "Red": + if(showClock == 0 ) { + showDisplay("", true, 80, 1 ); + showClock = 1; + } else if(showClock == 1 ) { + showClock = 0; + showDisplay((currChan.toString()), false, 100, 0 ); + } + InitMenu(); + break; + case "Green": + audio = audio + 1; + is = toi.informationService; + if(audio == 1) { + is.setObject("cfg.media.audio.languagepriority","dut,eng",is.STORAGE_VOLATILE); + } else if(audio == 2) { + is.setObject("cfg.media.audio.languagepriority","ger,deu,eng",is.STORAGE_VOLATILE); + } else if(audio == 3) { + is.setObject("cfg.media.audio.languagepriority","eng",is.STORAGE_VOLATILE); + audio = 0; + } + InitMenu(); + break; + case "Yellow": + clearTimeout(switchtimerID); + switchtimerID = 0; + InitMenu(); + osdtimer.innerHTML = ""; + SetLed(0,0,0); + break; + case "Blue": + if(SwitchGuide == 0 ) { + SwitchGuide = 1; + } else if(SwitchGuide == 1 ) { + SwitchGuide = 0; + } + InitMenu(); + break; + case "MediaRewind": + break; + case "MediaForward": + break; + case "MediaStop": + break; + case "Teletext": + break; + case "TV": + break; + case KEY_0: + break; + case KEY_1: + break; + case KEY_2: + break; + case KEY_3: + break; + case KEY_4: + break; + case KEY_5: + break; + case KEY_6: + break; + case KEY_7: + break; + case KEY_8: + break; + case KEY_9: + break; + } +} + +function InitMenu() { + mainmenu.innerHTML = "

SETTINGS

Frontdisplay Clock : " + showClock + "

Prio audio track : " + (toi.informationService.getObject("cfg.media.audio.languagepriority")) + "

Switch timer : " + Boolean(switchtimerID) + "

Preview guide : " + SwitchGuide + "

"; +} + +// End of Menu section + +// Media Player Section + +function onKeyMedia(keyCode) { + switch(keyCode) { + case "BrowserBack": + case "TV": + mediaList.style.opacity = 0; + showDisplay((currChan.toString()), false, 100, 0 ); + isMediaMenu = 0; + play(channels[currChan]); + break; + break; + case "Down": + if (mediaList.style.opacity != 0) { + do + { + incMed(1); + } + while (!recording[currMed]); + showMediaList(); + } else { + speed = 0; + mediaPlayer.play(0); + showDisplay("PAUS", false, 100, 0 ); + } + break; + case "Up": + if (mediaList.style.opacity != 0) { + do + { + decMed(1); + } + while (!recording[currMed]); + showMediaList(); + } else { + speed = 1000; + mediaPlayer.play(1000); + showDisplay("PLAY", false, 100, 0 ); + } + break; + case "Accept": + if (mediaList.style.opacity != 0) { + mediaList.style.opacity = 0; + speed = 1000; + playRec(recording[currMed]); + } else { + osdmedia.style.opacity = 1 - osdmedia.style.opacity; + ShowMediaOSD(); +// mediaPlayer.playFromPosition(60000,1000); + } + break; + case "Green": + audio = audio + 1; + is = toi.informationService; + if(audio == 1) { + is.setObject("cfg.media.audio.languagepriority","dut,eng",is.STORAGE_VOLATILE); + osdlang.style.opacity = 1; + osdlang.innerHTML = "Nederlands" + setTimeout("osdlang.style.opacity = 0; ", 3000); + } else if(audio == 2) { + is.setObject("cfg.media.audio.languagepriority","ger,deu,eng",is.STORAGE_VOLATILE); + osdlang.style.opacity = 1; + osdlang.innerHTML = "Deutsch" + setTimeout("osdlang.style.opacity = 0; ", 3000); + } else if(audio == 3) { + is.setObject("cfg.media.audio.languagepriority","eng",is.STORAGE_VOLATILE); + osdlang.style.opacity = 1; + osdlang.innerHTML = "English" + setTimeout("osdlang.style.opacity = 0; ", 3000); + audio = 0; + } + break; + case "MediaRewind": + if (mediaPlayer.getState() != mediaPlayer.STATE_IDLE) { + speed = speed - 1000; + if (speed < -9000) { + speed = -9000; + } + mediaPlayer.play(speed); + showDisplay("PL" + ((speed/1000).toString()), false, 100, 0 ); + } + break; + case "MediaForward": + if (mediaPlayer.getState() != mediaPlayer.STATE_IDLE) { + speed = speed + 1000; + if (speed > 9000) { + speed = 9000; + } + mediaPlayer.play(speed); + showDisplay("PL" + ((speed/1000).toString()), false, 100, 0 ); + } + break; + case "MediaStop": + if (mediaPlayer.getState() != mediaPlayer.STATE_IDLE) { + mediaPlayer.close(); + } + speed = 1000; + mediaList.style.opacity = 0.8; + showDisplay("STOP", false, 100, 0 ); + showMediaList(); + break; + case "MediaPlayPause": + if (mediaPlayer.getState() != mediaPlayer.STATE_PAUSED) { + mediaPlayer.play(0); + showDisplay("PAUS", false, 100, 0 ); + } else { + speed = 1000; + mediaPlayer.play(1000); + showDisplay("PLAY", false, 100, 0 ); + } + break; + case "VolumeMute": + state = toi.audioOutputService.getMuteState(AudioOut); + toi.audioOutputService.setMuteState(AudioOut, !state); + mute = 1 - state; + osdmute.style.opacity = mute; + break; + case "VolumeUp": + Volume = Volume + 10; + if (Volume > 100) { + Volume = 100; + } + toi.audioOutputService.setVolume(AudioOut, Volume); + showVolume(); + break; + case "VolumeDown": + Volume = Volume - 10; + if (Volume < 0) { + Volume = 0; + } + toi.audioOutputService.setVolume(AudioOut, Volume); + showVolume(); + break; + default: + break; + } +} + +function showMediaList() { + var liststyle = ""; + var htmlstring = "

RECORDINGS

"; + listMed = currMed-7; + for(var i=currMed-7; i<=currMed+7; i++) { + if (listMed<0) { + listMed=nrMedia-2; + } + if (listMed>nrMedia-1) { + listMed= -1; + } + do + { + listMed = listMed + 1; + } + while (!recording[listMed] && (listMed\uE003\uE003" + Left(recording[listMed],60) + ""; + } + htmlstring = htmlstring + "
"; + mediaList.innerHTML = htmlstring; +} + + +function incMed(step) { + currMed = currMed + step; + if (currMed == nrMedia + 1) { + currMed = 0; + } +} + +function decMed(step) { + currMed = currMed - step; + if (currMed < 0) { + currMed = nrMedia; + } +} + +function playRec(uri) { + try { + if (mediaPlayer.getState() != mediaPlayer.STATE_IDLE) { + mediaPlayer.close(); + } + uri = "file://" + uri; + mediaPlayer.open(uri); + mediaPlayer.play(1000); + showDisplay("PLAY", false, 100, 0 ); + } catch (e) { + alert("Failed opening recording: " + e); + return; + } +} + + +function ShowMediaOSD() { +// Display Name/ length + osdmedia.innerHTML = " Elapsed time : " + mediaPlayer.getPosition() + ""; +} + + -- cgit v1.2.3