0

I have a m3u file here. When I downloaded the file and opened it in iTunes the program successfully started playing the stream audio and showed me the artist name and the song title. Moreover iTunes sends notification that track is changed and shows artist name and song title!

I wonder how iTunes guess this? The file doesn't have list of artists, it only has the link to the streaming audio. When I go this address mentioned in the file I can see a web page with some info. Does iTunes parse this pages and look for artist name? Don't think so...

Can anyone explain to me how to get song info from m3u file that contains only a link to an audio stream like iTunes does? Sample code in Obj-C or Swift of how to do this programmatically will be highly appreciated!

pulp
  • 1,768
  • 2
  • 16
  • 24
  • There's an answer for this here, though it was never accepted: http://stackoverflow.com/a/29629781/4076315 – BSMP May 18 '15 at 18:45
  • @BSMP I'm afraid this question is not similar to mine. In this question the author has m3u file with song info, I have file only with a link to some ip with audio stream. But iTunes still has song info, so I'm curios how it's getting it. – pulp May 18 '15 at 18:49

1 Answers1

2

It comes down in the audio stream itself (using the Icecast protocol), rather than from the m3u file. You can prove this by opening the m3u file, taking the HTTP url inside, and putting it into VLC and you'll see the track data is still there.

There's a bit more info on this question: How do I extract streamed "now playing" data embedded in an Icecast audio (radio) stream on Samsung Smart-TV

There's also some obj-c specific stuff on this question: Getting SHOUTcast metadata on the Mac

And an explanation of the protocol here: http://www.smackfu.com/stuff/programming/shoutcast.html

Also if you're curious as to how I figured out the stream was an Icecast one, I opened Wireshark and filtered it by "ip.src == 79.120.77.11" and then started the stream, and in one of the first few packets there was a bit of data starting "icy-notice" and a mention of Shoutcast. A couple of packets later there's also the title of the radio station.

chedabob
  • 5,835
  • 2
  • 24
  • 44