开发者

Can I save the video downloaded via the MPMoviePlayerViewController or it's MPMoviePlayerController?

开发者 https://www.devze.com 2023-02-04 14:45 出处:网络
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 an

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消