Our application is a video / audio based application, and we have loaded all media in Windows Azure.
However, it is required that the user can download the audio / video file on demand, so that they can play it locally.
Therefore, I need to download the audio / video file programmatically and save it to IsolStorage.
We have Windows Azure file access URLs for each audio / video. But I got stuck at the first stage of downloading the media file.
I googled and came across in this article , but for WebClient there is no DownloadFileAsync function that I can use.
However, I tried another DownloadStringAsyn function, and download the media file in a lowercase format, but I don’t know how to convert it to audio (wma) / video (mp4) format. Please suggest me how can I continue? Is there any other way to download a media file?
Here is an example of the code 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();
}
Dk358 source
share