How to extract streaming “now playing” data embedded in Icecast audio (radio) stream on Samsung Smart-TV

I am creating a Samsung TV app for a radio station and they provide “Now Playing” information in the Icecast stream. Is it possible (and how do I) extract this information?

+4
source share
5 answers

Shoutcast supports " Icy-MetaData strong>" - an additional field in the request header. When it is installed, its request to the cricket server embeds the metadata about the stream at periodic intervals (once every “ lexical-metal ” bytes) in the encoded audio stream itself. The icy-metaint value is determined by the shoutcast server configuration and is sent to the client as part of the initial response.

Send a message to Shoutcast’s Internet Broadcasting Protocol to learn more about Icy: metadata and sample code in C.

A somewhat technical discussion is also available at http://forums.radiotoolbox.com/viewtopic.php?t=74

+1
source

Yes it is possible. Metadata is interleaved into stream data at a specified interval. Basically, you read 8192 bytes (or whatever is indicated in the Icy-MetaInt response Icy-MetaInt ), and then you read the metadata block.

The first byte of this metadata block tells you the length of the data. A length of 0 means no updated metadata.

Once you read the meta block, return to reading the stream data.

I have all this in more detail in my answer here: fooobar.com/questions/301373 / ... As long as I know that you are not writing PHP, the director is identical no matter what the language.

0
source

There is no way to get this meta from the main player.

Maybe you can use the jQuery.stream plugin to get the meta directly, but you need to configure Access-Control-Allow-Origin on you icecast server - but I have no idea if this will work.

The best solution here would be to use this script: http://code.google.com/p/icecast-now-playing-script/

So, you install this script on your web server, and from the SmartTV application you will AJAX it for a while while your stream is playing.

0
source

I just created a radio player for icecast and centova, it uses lastFM api to retrieve the metadata of the song. https://github.com/johndavedecano/Icecast-Centova-LastFM-API

0
source

If you do this for a radio station, then they can provide this data through the XSLT Icecast function. Some random old XSLT examples for providing stream metadata that I did at some point.

Another option is to run Icecast 2.4.1 or add two files (xml2json.xsl status-json.xsl) to the old version.

Please note that only Icecast 2.4.1 or later supports the addition of CORS / ACAO headers, which may be required to access data from a website / website.

If you do not directly cooperate with the radio station and cannot ask them to do this, do not pay attention to this answer. Someone might find this helpful though.

0
source

Source: https://habr.com/ru/post/1434006/


All Articles