I am creating an app on windows phone 8 which needs to download large video files (>1GB or 2 GB) from dropbox, skydrive etc, and save them into windows phone music and video folder.
So my problems are:
- How to download large files into chunks so that i can avoid outofmemoryExcepetion.
- Right now I am able to save smaller video files into camera roll folder. How can i save video file into windows music-video folder?
Assuming that the server supports it, you can use the HTTP
Range
header to specify which bytes of a file the server should return in response to a request.You then make multiple requests to get the file in pieces and then put it all back together on the device.
The SDK does not currently support a way for saving video into the device library. The nearest thing you can do is save the file within the IsolatedStorage of your app and then add the item to the new list in the library (via
WriteAcquiredItem
).Never needed to do it so please excuse the accuracy of my answer
I would suggest that you try getting hand to the underlying stream. if its a web request, try plugging into response stream. Next up, Open stream (to file in isostore) and append to it.
I have only used LiveConnect to upload.. never to download, however check live connect / rest api to see whether you can easily make a web request.
have a look at this SO post How to split a large file into chunks in c#?