locked
Downloading Video using HTTPClient RRS feed

  • Question

  • Hi  All,

    I am trying to download a video from a URL using a HTTPClient.

     

    HttpClient client = new HttpClient();
                HttpResponseMessage response = await client.GetAsync(videoURL);
                byte[] img = response.Content.ReadAsByteArray();
                StorageFile file = await appData.LocalFolder.CreateFileAsync(contentName + ".MP4");
                Windows.Storage.Streams.IRandomAccessStream stream = await file.OpenAsync(FileAccessMode.ReadWrite);
                IOutputStream output = stream.GetOutputStreamAt(0);
                DataWriter writer = new DataWriter(output);
                writer.WriteBytes(img);
                await writer.StoreAsync();
                output.FlushAsync().Start();  
    

     


    When i use this code for a jpg file download it works seamlessly but when i try to access the MP4 file it's not happening.
    Anything i have to do in the mobile to get this going?

    Thanks in advance.


    Regards Biju S Melayil
    • Edited by Biju S Melayil Thursday, November 10, 2011 11:53 AM Change in heading
    Thursday, November 10, 2011 11:53 AM

Answers

All replies