I want to play a shoutcast audio in my windows phone app. I have the following code which I got from some website.
namespace WPBackgroundAudioDemo
{
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
SaveToIsoStore();
}
private void buttonStart_Click(object sender, RoutedEventArgs e)
{
if (BackgroundAudioPlayer.Instance.PlayerState != PlayState.Playing )
BackgroundAudioPlayer.Instance.Play();
}
private void buttonStop_Click(object sender, RoutedEventArgs e)
{
if (BackgroundAudioPlayer.Instance.PlayerState != PlayState.Stopped)
BackgroundAudioPlayer.Instance.Stop();
}
private void SaveToIsoStore()
{
IsolatedStorageFile isolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication();
if (!isolatedStorageFile.FileExists("Lullabies.mp3"))
{
StreamResourceInfo resource = Application.GetResourceStream(new Uri("Lullabies.mp3", UriKind.Relative));
using (IsolatedStorageFileStream isolatedStorageFileStream = isolatedStorageFile.CreateFile("Lullabies.mp3"))
{
int chunkSize = 1024;
byte[] bytes = new byte[chunkSize];
int byteCount;
while ((byteCount = resource.Stream.Read(bytes, 0, chunkSize)) > 0)
{
isolatedStorageFileStream.Write(bytes, 0, byteCount);
}
}
}
}
}
}
Now, the thing is that this examples plays an internal file. And since I am newbie to windows, I cannot understand what shall be followed to give this player a shoutcast url. Please help to play audio in BackgroundAudioPlayer via URL. Any kind of help appreciated as I am in urgent need of this. Thanx to all in advance..