metadata from stream

Oct 10, 2014 at 7:08 PM
Hi where can I find an example on how to get the metadata from a stream...
like streaming from a radio...
Oct 11, 2014 at 6:03 PM
What kind of metadata are you looking to read? You will need to make some code changes and I can (probably) point you in the right direction, but getting at HTTP headers is different from extracting inline metadata data from a Shoutcast stream.
Oct 14, 2014 at 8:32 PM
The idea is to get from the stream (as Shoutcast does for example)

I'll post a few URL later to work with
Oct 15, 2014 at 11:46 PM
Feel free to PM them if you don't want to post them in public.

For this, you will probably want to subclass SM.Media.MP3.Mp3Parser. Mp3MediaParser and Mp3MediaParserFactory probably also need to be modified to find the alternate Mp3Parser. I should probably make some general way of doing this since I've had several questions about Shoutcast metadata in the last few weeks (and some kind of metadata filters to AudioParserBase?). That way, one could add customized audio stream filters instead of hacking the individual parsers.

Once you have your custom Mp3Parser, override "void ProcessData(byte[] buffer, int offset, int length)" to take out your metadata, and pass the remainder to the base class ProcessData. The handler should not block on anything. To get the metadata to the rest of your app, register something with the IoC container (e.g., in InitializeMediaStream(), call _mediaStreamFacade.Builder.RegisterSingleton<IYourTypeHere>(someInstanceOfAClassSupportingYourTypeHere)") and add "IYourTypeHere" as an argument to the Mp3Parser subclass' constructor (the IoC container should do the rest). You will probably want to report the current stream position when reporting the metadata since the playback will be a few seconds after the frames are parsed; you can get at it through "this.Position".

I'm going by the seat of my pants here, so apologies if I'm forgetting something.

Oh: Substitute AAC for MP3, if you are playing an AAC stream.
Oct 27, 2014 at 11:38 AM
Thank you!

As soon as I reach that stage on my app where I need it I'll PM ;)

Right now the metadata was push to another release...