Closed LordMyschkin closed 8 years ago
The thing is, this feature is basically completely unrelated to ympd.
You just have to configure mpd correctly and plug the http url into basically any media player, like vlc, mplayer and probably even windows media player.
Also, as far as I remember @parabelboi's branch hardcoded his stream url, which is pretty bad UX for an enduser.
I don't agree that it is unrelated: this way you can access your music library at home from anywhere (office, school, cell phone etc.) without the need to start anything more than the browser. I've been looking for something like this to listen to the music from my raspberry pi at home.
For the hardcoded stream URL however I agree: should be automatically detected or at least configurable.
@ajs124 is of course right - there are many other ways to accomplish the goal of playing the stream online. but doing it out of the interface makes it feel just like a local media player - which is really cool, beside the drawback of the laggy stream. And - indeed - in work, I do not have a media player to install. @parabelboi's solution is far from being perfect, but it works - and I am really sorry for not being able to improve and complete this myself.
if anybody can point me towards how mpd.js can access variables (like the mpdhost) I think I could make this configurable.
Maybe this is not the right way o do it - because if you configure it on the server, you have to access the same address in local and in remote networks. Why not code it into the settings subwindow and save it as cookie?
I don't like cookies, but you are probably right. I guess the two most probable URLs are probably already known and can be used as defaults: 1) a different port on the same host ympd is running (if mpd and ympd are run on the same host) 2) the mpdhost (if mpd is run on a different host)
the first can probably be done entirely in JS and for the second the JS would need to know the mpdhost
I had another go at this, see https://github.com/SuperBFG7/ympd/tree/local_play
It tries to auto guess the stream URL: 1) if mpdhost = 127.0.0.1 --> the stream must be accessible on the same hostname you used to access ympd in the browser 2) if not --> try the mpdhost
The port is assumed to be the default (8000). I think this should work for most cases. And if not: you can edit the stream URL in settings (applies only to this browser session). Most likely the host is already correct and you only need to change the port.
Works great for me, adjusting the port is nice, and if i really have to change it every time I run ympd in the browser, i will - although I'd still love this setting preserved (i have two streams, one in high quality on 8888 and a second one for remote playback on 8889 in low quality) Plus i love the new, reduced toggle design of the local playback button. Thank you!!
Right now the stream URL used is stored in a hidden input next to the audio tag and extracted every time you hit play or open settings. Changing this to use a cookie should be possible and I'd be happy to merge such a change (don't know anything about cookies in JavaScript myself and probably won't find the time to learn in the next few weeks).
Should not be that much of a problem - maybe I can contribute that small improvement, if I find the time.
Everything works like I'd expect it. May I close the issue then?
@LordMyschkin btw. I just noticed that you can have the same port for different streams. For example one with 128k and one with 256k. As long as only one of the outputs is active. :)
It would just be great if you'd consider to include the local playback of audio streams, just like parabelboi already did more than a year ago; I exclusivly use his version altough it has not been modified for more than a year. https://github.com/notandy/ympd/issues/16 Am I the only one to enjoy that feature?