0

我有一个应用程序,我通过单击按钮播放电影。我的电影是透明的。当我单击按钮时,我的电影可以正常播放,但问题是它的背景颜色仍然是白色。我希望电影的背景颜色是透明的。这是我播放电影的代码。

-(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];
}
4

2 回答 2

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.

于 2013-06-25T20:41:27.320 回答
0

您是否尝试过设置 PlayerController 的背景颜色?

playerController.view.backgroundColor = [UIColor clearColor];
于 2012-05-28T11:46:54.137 回答