Last active
September 15, 2017 22:52
-
-
Save mcfiredrill/4951364 to your computer and use it in GitHub Desktop.
retrieving metadata from icecast streams for an html5 audio player
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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