Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MPMoviePlayerController background color won't stick

Tags:

ios

iphone

ipad

I'm trying to change the background color of my MPMoviePlayerController, and I can't get it to stick.

I'm using:

moviePlayer.view.backgroundColor = [UIColor redColor];

I can see the background flash red while the video is loading. As soon as it is loaded, the background goes black again. I've tried setting the color after playback has started, but that has no effect.

I'm using iOS 5.

Edit: I'm actually attempting to set the background to [UIColor clearColor], not red. I should have asked my question properly in the first place.

like image 210
Eric Reid Avatar asked Nov 01 '11 23:11

Eric Reid


1 Answers

backgroundColor on MPMoviePlayerController is deprecated and view is documented as read-only. See: Deprecated MPMoviePlayerController Methods

backgroundColor
The color of the background area behind the movie. (Available in iOS 2.0 through iOS 3.1. Get the view from the backgroundView property and set its color directly.)

@property (nonatomic, retain) UIColor *backgroundColor

So I would try using:

moviePlayer.backgroundView.backgroundColor = [UIColor redColor];
like image 127
Andrew Avatar answered Oct 06 '22 14:10

Andrew