views:

933

answers:

3

After launching a video using MPMoviePlayerController's initWithContentURL:, is it possible to cache the downloaded video so that the next time the video is played it can be loaded via a local file:// URI? I understand that it's possible to do my own downloading and then launch the movie player, however I would like to take advantage of the player's ability to start prior to completion of preload.

A: 

one trick, is to start the download to disk - (using atomic : YES), wait 10 seconds, and point the movie player to the local disk path. it will "download" while playing the incomplete file.

next time, just check if the file exists first.

I got this working pretty well on WIFI connections, but on 3G there were all kinds of crashyness.

worse, there were issues with incomplete local files. let me know if it is worth it.

gene tsai
Mmm...I tried this but found it much too error prone. Have you ever tried overriding `[NSURLCache sharedURLCache]` with a custom disk-only cache implementation, as per my latest answer?
Nathan de Vries
A: 

I haven't tested this, but it may be possible to override [NSURLCache sharedURLCache] with a custom disk-only cache implementation. If MPMoviePlayerController uses NSURLRequest, it could work.

Nathan de Vries
And did anyone ever test this?
Johan Carlsson
+1  A: 

I haven't tested this, but it may be possible to override [NSURLCache sharedURLCache] with a custom disk-only cache implementation. If MPMoviePlayerController uses NSURLRequest, it could work.

This won't work. I checked this out. I think that MPMoviePlayerController isn't using caching at all.

tt.Kilew