locked
Reading song / artist from online radio steam (icecast)

    Question

  • Can any one please help me.

    I'm looking for an examples which shows how to split an online radio stream, so that the metadata (song/artist) can be displayed. I use the audio tag.

    If someone has an example in C#, that also will help me.

    Thanks,

    Monday, October 28, 2013 10:28 PM

Answers

  • Hi John,

    Take a look at the similar question on C#: http://social.msdn.microsoft.com/Forums/en-US/fffe6b6c-e412-42ba-a001-d29ee5f3c912/read-the-metadata-of-songsmp3-from-the-internet?forum=winappswithcsharp, you have to get all the music download and read the data from it, because most of the information that you are seeking is near the end of the file. 

    I wrote some code two weeks ago for fetching the ID3 of the mp3 online in C# and it should be more or less same with JavaScript:

    HttpClient httpclick = new HttpClient();
    Uri uri = new Uri(yourMusicAddress, UriKind.Absolute);
    var httpResponse = await httpclick.GetAsync(uri);
    byte[] b = await httpResponse.Content.ReadAsByteArrayAsync();
    //read ID3, first 3 is 'TAG'
    string title = System.Text.UTF8Encoding.UTF8.GetString(b, b.Length - 128+3, 30);
    string MusicAuthor = System.Text.UTF8Encoding.UTF8.GetString(b, b.Length - 128+3 + 30,30); 
    string MusicRador = System.Text.UTF8Encoding.UTF8.GetString(b, b.Length - 128+3 + 30 + 30, 30);
    
    

    Hope it can help you.

    Best Regards,

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Tuesday, October 29, 2013 5:17 AM
    Moderator