0

I have an application where I am playing movie on a button click. My movie is transparent. When I click on the button my movie plays properly but the problem is its background color remain white in color. I want the background color of the movie to be transparent. This is my code for playing movie.

-(IBAction)ClickFunny:(id)sender
{
    NSString *url = [[NSBundle mainBundle]
                     pathForResource:@"Moviename"
                     ofType:@"mov"];
    MPMoviePlayerController *playerController =
    [[MPMoviePlayerController alloc]
     initWithContentURL:[NSURL fileURLWithPath:url]];
    playerController.controlStyle =MPMovieControlStyleNone;
    playerController.scalingMode = MPMovieScalingModeAspectFill;
    playerController.fullscreen = YES;


        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:playerController];
    playerController.view.frame = CGRectMake(84, 250, 150, 10);
    [self.view addSubview:playerController.view];

    [playerController play];



}
- (void) movieFinishedCallback:(NSNotification*) aNotification {
    MPMoviePlayerController *player = [aNotification object];
    [[NSNotificationCenter defaultCenter]
     removeObserver:self
     name:MPMoviePlayerPlaybackDidFinishNotification
     object:player];
    [player stop];
    [player.view removeFromSuperview];
    [player autorelease];
}
halfer
  • 19,824
  • 17
  • 99
  • 186
Rani
  • 3,333
  • 13
  • 48
  • 89

2 Answers2

0

Have you tried setting the background color for the PlayerController ?

playerController.view.backgroundColor = [UIColor clearColor];
adig
  • 4,009
  • 1
  • 23
  • 23
0

You will not be able to get this working with built-in iOS logic because iOS movie playback supports only 24BPP pixels. See playing-movies-with-an-alpha-channel-on-the-ipad for a real solution that makes use of videos with an alpha channel.

MoDJ
  • 4,309
  • 2
  • 30
  • 65