gran33
gran33

Reputation: 12951

iOS - MPMoviePlayerController - load movie while playing

I want to load video while the MPMoviePlayerController is already playing.

I have movie, and advertisement alternately, and i want to prevent from user the waiting while the player load the next URL. I want to load an advertisement while the video is showing, and after 5 minutes I want the user will watch the advertisement immediately (without any loading delay).

For play the movie, I use the prepareToPlay method.

Does the framework support this? Or should I have to do it by my self (with dispatch_async)?

Upvotes: 1

Views: 281

Answers (1)

Armand DOHM
Armand DOHM

Reputation: 1131

If I had to do it, I'll do it async, using NSURLSession method :

- (NSURLSessionDownloadTask *)downloadTaskWithRequest:(NSURLRequest *)request completionHandler:(void (^)(NSURL *location, NSURLResponse *response, NSError *error))completionHandler

Nevertheless, don't forget you could not be 100% sure that your advertisement will be download in the next 5 minutes (network down, or download speed slow...).

Upvotes: 0

Related Questions