Click here to Skip to main content
15,799,398 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I really want to record live audio that is currently streaming in the background audio player of the windows phone to an .mp3 file, simply the aim of the App is to record audio from internet radio stations. what i have done so far is this

private void Button_Click(object sender, RoutedEventArgs e)
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(//streaming audio link);

        req.AllowReadStreamBuffering = false;
        req.AllowWriteStreamBuffering = false;
        req.Method = "GET";

        req.BeginGetResponse(new AsyncCallback(GetShoutAsync),req);


void GetShoutAsync(IAsyncResult res)

        HttpWebRequest req = (HttpWebRequest)res.AsyncState;
        HttpWebResponse response = (HttpWebResponse)req.EndGetResponse(res);
        Stream r = response.GetResponseStream();
        byte[] data = new byte[202752];
        int read;
        using (var store = IsolatedStorageFile.GetUserStoreForApplication())
        string fileName = "sampleaudiorecording.mp3";

        if (store.FileExists(fileName))

        using (var fs = new IsolatedStorageFileStream(fileName, FileMode.Create, store))

            while ((read = r.Read(data, 0, data.Length)) > 0 )

                int rc = r.Read(data, 0, data.Length);

                byte[] bytesInStream = new byte[data.Length];
                bytesInStream = data;
                fs.WriteAsync(bytesInStream, 0, rc);



It actually works for some link, but for some other links such as an .m3u8,pls (I know that windows doesn't provide any native support for these types!) live links it doesn't. A project at codeplex(PhoneSm) appears to be supporting these formats, i was thinking that is there a way to copy streams from the background audio player directly?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900