0
MPMoviePlayerViewController视频,我想我的应用程序里面播放的具有透明背景的视频。它有一个人在透明背景上移动。唯一的问题是,MPMovieePlayer似乎有一个黑色的背景。我怎样才能让它透明?与透明背景
这是我尝试的代码:
-(void)playMovie
{
NSString *resourcePath = [[NSBundle mainBundle] pathForResource:@"syncink movie" ofType:@"m4v"];
NSLog(@"%@",resourcePath);
NSURL *url = [NSURL fileURLWithPath:resourcePath];
NSLog(@"%@",url);
MPMoviePlayerViewController *moviePlayer;
moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
moviePlayer.moviePlayer.shouldAutoplay=YES;
moviePlayer.moviePlayer.controlStyle = MPMovieControlStyleNone;
[moviePlayer.moviePlayer setFullscreen:NO animated:YES];
[self.view addSubview:moviePlayer.view];
moviePlayer.view.frame = CGRectMake(200, 600, 400, 300);
[moviePlayer.moviePlayer play];
moviePlayer.view.backgroundColor = [UIColor clearColor];
for(UIView *aSubView in moviePlayer.view.subviews)
{
aSubView.backgroundColor = [UIColor clearColor];
}
}
但
aSubView.backgroundColor = [的UIColor clearColor];
似乎是删除玩家的框架,而不是实际的背景。谢谢你的帮助。