From c0b2614962d17b7585fb7c85c5a7f763c321c316 Mon Sep 17 00:00:00 2001 From: "M. Voerman" Date: Thu, 18 Jul 2013 00:12:59 +0200 Subject: Server based pause function. --- History | 5 +++- index.html | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++--------- lang_dut.js | 2 ++ lang_eng.js | 2 ++ language.js | 2 +- settings.js | 3 +-- 6 files changed, 81 insertions(+), 15 deletions(-) diff --git a/History b/History index 725b9bd..8b11642 100644 --- a/History +++ b/History @@ -5,7 +5,10 @@ VDR 1.7.29 0.21 Language in sepate file, link your lang_XXX.js to language.js to activate it. Updated EPG filter, (DVB-T defaults to German) - Audio, subs etc settings are now stored on the box. So they are kept after reboot. + Audio, subs etc settings are now stored on the box. So they are kept after reboot. + OSD Time out can be set from settings.js + Pause Live TV on Server + 0.20 Updated EPG filter diff --git a/index.html b/index.html index 11a6645..6311698 100644 --- a/index.html +++ b/index.html @@ -807,9 +807,11 @@ function onKeyDown(event) { if(isFullscreen && PauseOnServer) { if(mediaPlayer.getState() == mediaPlayer.STATE_PLAYING) { + isPause = 1; ServerPause(); SetLed(1,1,10); - setTimeout("mediaPlayer.play(0);",5000); +// setTimeout("mediaPlayer.play(0);",5000); + mediaPlayer.play(0); break; } if(mediaPlayer.getState() == mediaPlayer.STATE_PAUSED || mediaPlayer.getState() == mediaPlayer.STATE_FASTFORWARDING || @@ -2459,6 +2461,7 @@ function UnloadMediaSettings() { showDisplay((currChan.toString()), false, 100, 0 ); isMediaMenu = 0; isFullscreen = 1; + isPause = 0; if (mediaPlayer.getState() != mediaPlayer.STATE_PLAYING ) { play(channels[currChan]); } @@ -2693,8 +2696,10 @@ if (DelisOK) { videoplane.subtitles = Boolean(ShowSubs); // Enable subtitles or Disable subtitles break; case "Blue": - ShowInfo(); - osdepginfo.style.opacity = 1 - osdepginfo.style.opacity; + if ( isPause == 0 ) { + ShowInfo(); + osdepginfo.style.opacity = 1 - osdepginfo.style.opacity; + } break; case "Menu": osdepginfo.style.opacity = 0; @@ -2747,7 +2752,7 @@ if (DelisOK) { } break; case "MediaStop": - if (currMed == -1) { + if (currMed == -1 || isPause == 1) { osdepginfo.style.opacity = 0; isFullscreen = 1; play(channels[currChan]); UnloadMediaSettings(); @@ -3304,6 +3309,23 @@ function playRec(uri) { } +function pauseRec(uri) { + try { + if (mediaPlayer.getState() != mediaPlayer.STATE_IDLE) { + mediaPlayer.close(); + } + if (osdepginfo.style.opacity == 1) {osdepginfo.style.opacity = 0;} + mediaPlayer.open(uri); + mediaPlayer.play(0); + showDisplay("PAUS", false, 100, 0 ); + } catch (e) { + alert("Failed opening recording: " + e); + return; + } +} + + + function createNewAsset() { try { assetId = toi.assetManagerService.createAsset(toi.assetManagerService.ASSET_PVR); @@ -3409,17 +3431,15 @@ function ServerPause() { setTimeout("xmlhttp.open('POST',(RestFulAPI + '/remote/Record'),false);xmlhttp.send();",5000); //Show some info on screen - settimer(EPG[NowNext][2][currChan],"PAUSE",0); + settimer(EPG[NowNext][2][currChan],Lang[70],0); switchtimer.style.opacity = 1; setTimeout("switchtimer.style.opacity = 0; ", 7000); } catch(e) { alert("Sending Pause key to server problem: " + e); } - //Next steps: - //Find recording using restfulapi - //Open recording and pause. + setTimeout("getPauseFile();",6000); //end of function } @@ -3435,6 +3455,42 @@ try { } } + +function getPauseFile() { + +try { + xmlhttp=new XMLHttpRequest(); + xmlhttp.open("GET",(RestFulAPI + "/recordings.xml?" + new Date().getTime()),false); + xmlhttp.send(); + xmlDoc=xmlhttp.responseXML; + var x=xmlDoc.getElementsByTagName("recording"); + nrMedia = x.length - 1; + for (var i=0;i