views:

180

answers:

2

I'm working on an iPad app, it has a few videos within views using the MPMediaPlayer framework.

Videos are working nice but on viewLoad there is a flashing of the video area when it loads the video. It shows black for a split second then starts playing.

I was thinking of using an NSTimer on viewDidLoad to unhide the hidden video view, which might give it a second to load up. Any other ideas?

A: 

My guess is, that you preferably put all MPMoviePlayer related code in ViewDidLoad. On another note: try giving a chance to MPMoviePlayerViewController which is accessibly in 3.2 and later, it's very handy to use.

I hope I could help.
*sam

samsam
Right, that is actually what I am using. Sorry I did not realize there was a difference.
Hippocrates
did you get it to work in any way by now?
samsam
No still no luck...
Hippocrates
I read your post once again, just to make it clear: you try loading a video and what you wanna do is hide it until it's "ready to play" ist that correct? assuming so, I would recommend you to hook up onto events that indicate the loadstate / playstate. browse for MPMoviePlayerLoadStateDidChangeNotification and MPMoviePlayerPlaybackStateDidChangeNotification.
samsam
A: 

The black flash is caused by the movie player drawing while it's waiting for movie data to load. I've also run into this recently and there aren't many options since the notifications don't really match up to the flashing. Best option I've done is to match the background color of the movie player to your background color. For example if you are displaying on a white context:

MPMoviePlayerController * player;
player.backgroundView.backgroundColor = [UIColor whiteColor];
GrafikRobot