diff --git a/CMakeLists.txt b/CMakeLists.txt index 7bd4b70..21b085d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,7 @@ file(GLOB RESOURCES htdocs/css/*.min.css htdocs/fonts/* htdocs/index.html + htdocs/player.html ) set(SOURCES diff --git a/htdocs/index.html b/htdocs/index.html index f954071..26981fb 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -61,13 +61,17 @@
+ + diff --git a/htdocs/js/mpd.js b/htdocs/js/mpd.js index e85192c..f172e4c 100644 --- a/htdocs/js/mpd.js +++ b/htdocs/js/mpd.js @@ -580,17 +580,19 @@ function clickLocalPlay() { $("#localplay-icon").removeClass("glyphicon-play").removeClass("glyphicon-pause"); if ( player.paused ) { - if ( $("#localstream").val() == "" ) { - $("#localstream").change(function(){ clickLocalPlay(); $(this).unbind("change"); }); + var mpdstream = $.cookie("mpdstream"); + + if ( mpdstream ) { + player.src = mpdstream; + console.log("playing mpd stream: " + player.src); + player.load(); + player.play(); + $("#localplay-icon").addClass("glyphicon-pause"); + } else { + $("#mpdstream").change(function(){ clickLocalPlay(); $(this).unbind("change"); }); $("#localplay-icon").addClass("glyphicon-play"); getHost(); - return; } - player.src = $("#localstream").val(); - console.log("playing mpd stream: " + player.src); - player.load(); - player.play(); - $("#localplay-icon").addClass("glyphicon-pause"); } else { player.pause(); player.src=''; @@ -600,18 +602,21 @@ function clickLocalPlay() { } function setLocalStream(mpdhost) { - if ( $("#localstream").val() != "" ) - return; + var mpdstream = $.cookie("mpdstream"); + + if ( !mpdstream ) { + mpdstream = "http://"; + if ( mpdhost == "127.0.0.1" ) + mpdstream += window.location.hostname; + else + mpdstream += mpdhost; + mpdstream += ":8000/"; + + $.cookie("mpdstream", mpdstream, { expires: 424242 }); + } - var mpdstream = "http://"; - if ( mpdhost == "127.0.0.1" ) - mpdstream += window.location.hostname; - else - mpdstream += mpdhost; - mpdstream += ":8000/"; $("#mpdstream").val(mpdstream); - $("#localstream").val(mpdstream); - $("#localstream").change(); + $("#mpdstream").change(); } function basename(path) { @@ -741,7 +746,7 @@ function confirmSettings() { socket.send('MPD_API_SET_MPDPASS,'+$('#mpd_pw').val()); } socket.send('MPD_API_SET_MPDHOST,'+$('#mpdport').val()+','+$('#mpdhost').val()); - $("#localstream").val($("#mpdstream").val()); + $.cookie("mpdstream", $("#mpdstream").val(), { expires: 424242 }); $('#settings').modal('hide'); } diff --git a/htdocs/player.html b/htdocs/player.html new file mode 100644 index 0000000..83b4621 --- /dev/null +++ b/htdocs/player.html @@ -0,0 +1,68 @@ + + + + + + + + + + + ympd player + + + + + + + + + + + + + +
+
+
+ + +
+
+
+ + + + + + + +