I am am using the AxWindowsMediaPlayer control to build a small Windows web radio developed in C#
.
This works out well. My StatusChange
event handler extracts the name of the current radio station:
private void axWindowsMediaPlayer1_StatusChange(object sender, EventArgs e)
{
IWMPMedia cm = axWindowsMediaPlayer1.currentMedia;
if (cm != null)
{
title = cm.getItemInfo("Title");
}
}
To polish up my radio, I would like to display additional information like name and artist of the current song. Such StreamTitle
meta-data is shown by audio players like mpg123.
Example:
ICY-META: StreamTitle='Der Langmut der SPD mit Sarrazin hat nicht geholfen, Jürgen Zurheide';
Provided, a radio stream actually includes meta-information (Icecast, SHOUTcast):
Is there a way to get hold of radio stream titles using AxWindowsMediaPlayer?
I would not like the idea of a second thread digesting the whole stream just to extract the meta-data.
There seems to be no easy way to extract SHOUTCast/Icecast meta-data from AxWindowsMediaPlayer.
My solution is to replace AxWindowsMediaPlayer by BASS.NET.
BASS is an audio library wrapped by BASS.NET for .Net usage.
It provides a TAG_INFO
class which covers more than enough tags.
Code snippet from a BASS C#
sample NetRadio.cs
if ( BassTags.BASS_TAG_GetFromURL( _Stream, _tagInfo) )
{
this.textBoxAlbum.Text = _tagInfo.album;
this.textBoxArtist.Text = _tagInfo.artist;
this.textBoxTitle.Text = _tagInfo.title;
this.textBoxComment.Text = _tagInfo.comment;
this.textBoxGenre.Text = _tagInfo.genre;
this.textBoxYear.Text = _tagInfo.year;
}
Resulting radio:
One alternative could be to download and evaluate status-json.xsl files provided by some internet radio stream providers. But I haven't tried this path yet.