summaryrefslogtreecommitdiff
path: root/index.html
diff options
context:
space:
mode:
authorM. Voerman <rekordc@gmail.com>2013-01-15 13:10:50 +0100
committerM. Voerman <rekordc@gmail.com>2013-01-15 13:10:50 +0100
commitccb6b85143b4bdbf4ee01365fe9398e15ae1504b (patch)
tree0c07a5e9b451136dfc85538b9bd5536948e01a1a /index.html
parent61c4e59768842e5708bf60571c63f22091b3db4a (diff)
downloadvdr-vipclient-ccb6b85143b4bdbf4ee01365fe9398e15ae1504b.tar.gz
vdr-vipclient-ccb6b85143b4bdbf4ee01365fe9398e15ae1504b.tar.bz2
Plays now http streams from MPD
Diffstat (limited to 'index.html')
-rw-r--r--index.html63
1 files changed, 43 insertions, 20 deletions
diff --git a/index.html b/index.html
index eccb122..0ae0488 100644
--- a/index.html
+++ b/index.html
@@ -1481,13 +1481,13 @@ function onKeyMenu(keyCode) {
switch(keyCode) {
case "BrowserBack":
if (menu !== 0) {
- if (menu == 3 ) { isFullscreen = 0; play(channels[currChan]); isFullscreen = 1; }
+ if (menu == 3 ) { isFullscreen = 0; play(channels[currChan]); isFullscreen = 1; mediaPlayer.removeEventListener(mediaPlayer.ON_STATE_CHANGED, MPD);}
menu = 0;
InitMenu(menu);
break;
}
case "Menu":
- if (menu == 3 ) { play(channels[currChan]); }
+ if (menu == 3 ) { play(channels[currChan]); mediaPlayer.removeEventListener(mediaPlayer.ON_STATE_CHANGED, MPD);}
isSetupMenu = 0;
mainmenu.style.opacity = 0;
break;
@@ -1662,7 +1662,7 @@ function onKeyMenu(keyCode) {
InitMenu(menu);
break;
case KEY_9:
- if (menu == 0) {
+ if (menu == 0 || menu == 3) {
menu = 3;
playMPD(MPDAddress);
InitMenu(menu);
@@ -1674,7 +1674,7 @@ function onKeyMenu(keyCode) {
break;
case KEY_0:
if (menu !== 0) {
- if (menu == 3 ) { isFullscreen = 0; play(channels[currChan]); isFullscreen = 1; }
+ if (menu == 3 ) { isFullscreen = 0; play(channels[currChan]); isFullscreen = 1; mediaPlayer.removeEventListener(mediaPlayer.ON_STATE_CHANGED, MPD);}
menu = 0;
InitMenu(menu);
}
@@ -1706,22 +1706,6 @@ function onKeyMenu(keyCode) {
}
-function playMPD(uri) {
- try {
- if (mediaPlayer.getState() != mediaPlayer.STATE_IDLE) {
- mediaPlayer.close();
- }
- mediaPlayer.open(uri);
- mediaPlayer.play(1000);
- showDisplay("MPD", false, 100, 0 );
- } catch (e) {
- alert("Failed opening recording: " + e);
- return;
- }
-}
-
-
-
function InitMenu(menu) {
if(menu == 0) { // Main Menu
@@ -1834,6 +1818,45 @@ function LoadTimers() {
// End of Menu section
+// MPD Section
+
+function MPD(ev) {
+ alert("Media player state changed: state=" + ev.state + ", reason=" + ev.reason + ", code=" + ev.code);
+
+ if ( ev.state == 6 && ev.reason == "HostUnreachable" ) {
+ showDisplay("ERRR", false, 100, 0 );
+ 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 \n 9 - Retry \n\n<center style='color:white;'>ERROR Connecting to MPD server : \n" + MPDAddress + "</center></pre>";
+ } else if ( ev.state == 2 ) { // && ev.reason == "PositionEnd" ) {
+ showDisplay("STOP", false, 100, 0 );
+ 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 \n 9 - Reconnect \n\n<center style='color:white;'>Connected to MPD server : \n" + MPDAddress + "\nbut streaming ended</center></pre>";
+ } else if ( ev.state == 3 && ev.reason == "CommandPlay" ) {
+ showDisplay("MPD", false, 100, 0 );
+ 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 \n\n\n<center style='color:white;'>Connected to MPD server : \n" + MPDAddress + "</center></pre>";
+ } else {
+ showDisplay("ERRR", false, 100, 0 );
+ 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 \n 9 - Reconnect \n\n<center style='color:white;'>Error : " + ev.state + "\n Reason : " + ev.reason + "</center></pre>";
+ }
+
+}
+
+function playMPD(uri) {
+ try {
+ if (mediaPlayer.getState() != mediaPlayer.STATE_IDLE) {
+ mediaPlayer.close();
+ }
+ mediaPlayer.open(uri);
+ mediaPlayer.play(1000);
+ if (!MPDListener) { mediaPlayer.addEventListener(mediaPlayer.ON_STATE_CHANGED, MPD); }
+ MPDListener = 1;
+ } catch (e) {
+ alert("Failed opening recording: " + e);
+ return;
+ }
+}
+
+
+// End of MPD Section
+
// Media Player Section
function LoadMediaSettings() {