Can I save the video downloaded via the MPMoviePlayerViewController or it's MPMoviePlayerController?
I'm displaying remote video files using the MPMoviePlayerViewController, and I'd like to be able to save the downloaded video to the documents directory, once it has finished downloading. Is there any way to do this, or get access to the movie data? I know I can download it with NSURLConnection, but then it basically has to download twice instead of just once.
Update:
What I ended up doing is kicking off a delayed background download of t开发者_JAVA百科he same file that's currently being played by the movie player, but only IF the connection is WIFI so I don't suck all their bandwidth, and choke the currently playing movie.
The consensus is that it isn't possible directly -- the MPMoviePlayerController is not using an [NSURLCache sharedURLCache]
, so you don't have access to it that way.
Another option is to start downloading the movie asynchronously and play it locally when the file is sufficiently buffered -- this is viable, but it can be a fragile solution if you don't adequately handle the buffer underruns that are bound to happen on slow networks.
Here is the related SO question: Caching videos to disk after successful preload by MPMoviePlayerController
What I ended up doing is kicking off a delayed background download of the same file that's currently being played by the movie player, but only IF the connection is WIFI so I don't suck all their bandwidth, and choke the currently playing movie.
精彩评论