Retrieving Media Information from background audio stream in Windows Phone

591 views Asked by At

I have a live mp3 stream that I am playing using the BackgroundAudioAgent and an AudioPlayerAgent. Since the feed is a mp3 stream I didn't see a reason to create a AudioStreamingAgent. The stream plays as expected.

Is it possible to get track information from the audio stream? For example, when I play the stream in VLC it lists the artist/title/etc about the currently playing song. This meta information is provided in the stream; however, the BackgroundAudioAgent doesn't seem to use this information or update when the track changes.

I know it is possible to manually set the track information for the background agent, but I am trying to get is grab that information from the stream itself. Is this possible with an AudioPlayerAgent? Do I have to create an AudioStreamingAgent for this?

//This is how I am currently setting the audio track
AudioTrack track = new AudioTrack(new Uri(SourceString, UriKind.RelativeOrAbsolute), null, null, null, null);

Thanks in advance for your help.

1

There are 1 answers

0
Chris Gonzales On BEST ANSWER

Unfortunately you do have to create an AudioStreamingAgent. According to James Dailey (MSFT) the AudioPlayerAgent only uses the ID3 tag of the media file to grab track information. In order to get track information from a stream, you have write your own class to handle the stream.

Creating a AudioStreamingAgent isn't a trivial task. I was hoping to avoid it if possible but this seams to be the only way to get the required track information.

Source