notandy / ympd

Standalone MPD Web GUI written in C, utilizing Websockets and Bootstrap/JS
http://www.ympd.org
GNU General Public License v2.0
515 stars 143 forks source link

Local playback of audio streams #96

Closed LordMyschkin closed 8 years ago

LordMyschkin commented 8 years ago

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?

ajs124 commented 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.

SuperBFG7 commented 8 years ago

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.

LordMyschkin commented 8 years ago

@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.

SuperBFG7 commented 8 years ago

if anybody can point me towards how mpd.js can access variables (like the mpdhost) I think I could make this configurable.

LordMyschkin commented 8 years ago

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?

SuperBFG7 commented 8 years ago

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

SuperBFG7 commented 8 years ago

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.

LordMyschkin commented 8 years ago

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!!

SuperBFG7 commented 8 years ago

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).

LordMyschkin commented 8 years ago

Should not be that much of a problem - maybe I can contribute that small improvement, if I find the time.

LordMyschkin commented 8 years ago

Everything works like I'd expect it. May I close the issue then?

SuperBFG7 commented 8 years ago

@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. :)