我想播放具有透明背景的视频。唯一的问题是,我在网上找到的所有信息都是“如何使视频背景透明”,但我的视频背景已经是透明的,现在我需要让播放器的背景透明。我怎么做?我试过这个:
NSString *resourcePath = [[NSBundle mainBundle] pathForResource:@"New Project 5" ofType:@"m4v"];
NSLog(@"%@",resourcePath);
NSURL *url = [NSURL fileURLWithPath:resourcePath];
NSLog(@"%@",url);
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
moviePlayer.shouldAutoplay=YES;
moviePlayer.controlStyle = MPMovieControlStyleNone;
[moviePlayer setFullscreen:NO animated:YES];
[self.view addSubview:moviePlayer.view];
moviePlayer.view.frame = CGRectMake(200, 600, 400, 300);
[moviePlayer play];
moviePlayer.view.backgroundColor = [UIColor clearColor];
for(UIView *aSubView in moviePlayer.view.subviews) {
aSubView.backgroundColor = [UIColor clearColor];
}
但它不起作用。它显示黑色背景。