Skip to content

Instantly share code, notes, and snippets.

@mcfiredrill
Last active September 15, 2017 22:52
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcfiredrill/4951364 to your computer and use it in GitHub Desktop.
Save mcfiredrill/4951364 to your computer and use it in GitHub Desktop.
retrieving metadata from icecast streams for an html5 audio player
possible solutions
===================
1. On the server side, make a request to the stream with this request header:
Icy-MetaData:1
This will return a response header like this:
icy-metaint:8192
This supposedly tells you there is a metadata packet in the stream every 8192 bytes.
You could read in the metadata in a program on the server this way, and when it changes,
send a message to the client using SSEs or something.
2. Poll the server from the client. The easiest way would be to just parse the icecast's
status.xml page and use the "current song" field. This would be much simpler and you
wouldn't really notice much of a difference from the first method.
3. attach a function to on_metadata in liquidsoap to write to a socket or something. Have
the server be aware of this (maybe with fsevent gem?) and write an sse to the client.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment