Cjames
Cjames

Reputation: 1872

Amazon S3 (AWS ) NSMutableData

I have a project related on Amazon S3 DOWNLOADING big file sizes above 50MB. It stops without error and I chunk the file into smaller memory due to it's large data file size and download it simultaneously. When I append the chunk data into single [NSMutableData] in correct order the video won't play. Any Idea about this related subject?..

Please Help me I'm sitting my ass for the whole week of this project T_T..

Upvotes: 0

Views: 74

Answers (2)

David Hoerl
David Hoerl

Reputation: 41642

What you need to do is create a file of the appropriate size first. Each down loader object must know the offset in the file to put the data, which it should write as it appears and not store in a mutable data object. So this will greatly lower the memory footprint of this operation.

There is a second component: you must set the F_NOCACHE flag of the open file so iOS does not keep the file writes in its cache.

With both of these it should work fine. Also use a lot of asserts during development so you know ASAP if something fails - so ou can correct whatever the problem is.

Upvotes: 1

Alejandro Benito-Santos
Alejandro Benito-Santos

Reputation: 2069

You shouldn't manage this amount of data using RAM memory only.

You'd rather use secondary memory (namely NSFileManager) as explained here When you're done downloading the file, play it normally. If you're sure the user won't really need it anymore, just delete it right after playback.

[edit]

Or,you might as well just use MPMoviePlayerController pointing to that URL directly.

Upvotes: 1

Related Questions