OpenThread
OpenThread

Reputation: 2094

MPMoviePlayerController black screen when app enter foreground from background

I'm using an MPMoviePlayerController for playing video in my iPhone app.

When MPMoviePlayerController is playing, press home button on iPhone, make the app enter background.

Then tap the app's icon to make the app enter foreground, the MPMoviePlayerController's view will be black screen for a short time, about 1 to 15 seconds.

How to make the MPMoviePlayerController's video shows immediately when app came to foreground?

Special thx! :D

Upvotes: 0

Views: 430

Answers (1)

Maul
Maul

Reputation: 1179

NSURL *movieURL = [NSURL URLWithString:@"http://......"];

// Initialize a movie player object with the specified URL

self.moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];

self.moviePlayer.controlStyle = MPMovieControlStyleFullscreen;

[self.moviePlayer.view setFrame:self.view.bounds];

[self.view addSubview:self.moviePlayer.view];

[self.moviePlayer play];

I Hope this will help You.

Upvotes: -2

Related Questions