Our app is video/audio based app, and we have uploaded all the media on Windows Azure.
However it is required to facilitate user to download audio/video file on demand, so that they can play it locally.
So i need to download audio/video file programmatically and save it in IsolatedStorage.
We have Windows Azure Media File Access URLs for each audio/video. But I am stuck in 1st step of downloading media file.
I googled and came across this article, but for WebClient there is no function DownloadFileAsync that I can use.
However I tried its other function DownloadStringAsyn, and download media file is in string format but don't know how to convert it to audio(wma)/video(mp4) format. Please suggest me, how can I proceed? Is there other way to download media file?
Here is sample code that I used
private void ApplicationBarMenuItem_Click_1(object sender, EventArgs e)
{
WebClient mediaWC = new WebClient();
mediaWC.DownloadProgressChanged += new DownloadProgressChangedEventHandler(mediaWC_DownloadProgressChanged);
mediaWC.DownloadStringAsync(new Uri(link));
mediaWC.DownloadStringCompleted += new DownloadStringCompletedEventHandler(mediaWC_DownloadCompleted);
}
private void mediaWC_DownloadCompleted(object sender, DownloadStringCompletedEventArgs e)
{
if (e.Cancelled)
MessageBox.Show("Downloading is cancelled");
else
{
MessageBox.Show("Downloaded");
}
}
private void mediaWC_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
statusbar.Text = status= e.ProgressPercentage.ToString();
}