notandy / ympd

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

Inline <audio> tag #183

Open kousu opened 5 years ago

kousu commented 5 years ago

I would like ympd to be the only UI I need to offer to users in my house. I have mpd configured to be streaming-only, and these days the <audio> tag is super slick and pretty reliable so I feel like we should be able to do an all-in-one thing these days!

Here's my mpd.conf, based on the default sample, so probably it's what most people are also running:

$ cat /etc/mpd.conf 
# See: /usr/share/doc/mpd/mpdconf.example

pid_file "/run/mpd/mpd.pid"
db_file "/var/lib/mpd/mpd.db"
state_file "/var/lib/mpd/mpdstate"
playlist_directory "/var/lib/mpd/playlists"

audio_output {
       type            "httpd"
       name            "radio"
       encoder         "vorbis"                # optional, vorbis or lame
       port            "8000"
       bind_to_address "0.0.0.0"               # optional, IPv4 or IPv6
       quality         "6.0"                   # do not define if bitrate is defined
       format          "44100:16:1"
       max_clients     "50"                     # optional 0=no limit
}

I would like to add

<audio src=":8000"></audio>

Somewhere in index.html and have it play.

There's a few subtleties about this:

1) that URL is impossible.

zuglufttier commented 5 years ago
3. I want to be able to give people a link to ympd and have it Just Work, so it should also say ``<audio ... autoplay>`, but playing continuously is tricky:

   * When mpd runs out of tracks or is paused, it shuts down the http stream, and most players (VLC, mplayer, etc) need to be manually reset. Firefox too. It would be good if there was a `setInterval()` wrapped around it to try to reconnect every so often.

Did you see this? https://www.musicpd.org/doc/html/user.html#config-audio-output There is an option always_on for audio outputs that may solve at least that problem ;)