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];
似乎是刪除玩家的框架,而不是實際的背景。謝謝你的幫助。