This project has moved. For the latest updates, please go here.

Streamed MP3, a few problems and challenges

Sep 9, 2013 at 10:05 AM
I'm creating a simple Internet Radio but are running into a few problems/challenges..

I'm using BufferedWaveProvider, basically the code from the Demo with a few changes.

Problem:
Often, the exception "AcmNotPossible calling acmStreamConvert" is thrown when starting the stream. I can't really figure out why, it seems pretty random. This error also occoures in the Demo!
Mark if you want to look into this, i got a good reproduceable sourcecode you can look at :)

Challenge:
If you play a stream in VLC player, like this one:
http://onair.100fmlive.dk:80/100fm_live.mp3
under MediaInformation, it somehow know that the station is called Radio100, where does it get that information from?

Challenge:
Is it possible to know what song is playing at the moment? i guess not?
Coordinator
Sep 9, 2013 at 1:36 PM
I guess it sends some ID3v2 tags through. The ACM error is likely down to destination buffer not big enough. See how many input bytes are being passed into AcmStream.Convert, and what size destination buffer is being used.
Sep 9, 2013 at 1:39 PM
How would i know if the stream contains tag info? and when? and how do i read it from the stream?
Sep 9, 2013 at 1:49 PM
I'm not that much into the NAudio code to know what you are talking about i'm afraid :D

But this is a SS where the exception has been thrown:

AcmStreamHeader.cs line 60:
http://postimg.org/image/hja2ql00b/

Does that give any information?
Sep 9, 2013 at 10:11 PM
Edited Sep 9, 2013 at 10:12 PM
Okay figured out how to get the Stream name and tag info, if any..

If the server is delivering the data, it can be returned by adding a header request:

HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(station.Url);
webRequest.Headers.Add("icy-metadata", "1");

And read like this:

Dictionary<string, string> Headers = new Dictionary<string, string>();

foreach (string key in response.Headers.Keys)
{
  Headers.Add(key.ToLower(), response.Headers[key]);
}

This returns name, url, description etc from the stream, if it exists. But not the artist and title, it is read from the endless stream.. See this link for more info:
https://github.com/icedream/restreamer/blob/master/csharp/Restreamer/LivestreamReceiver.cs