나는 내 자신의 프로젝트를 생성하고 자신의 예에서와 같이 정확히 같은 코드를 작성 (하지만 내 프로젝트에 나는 스토리 보드를 사용)MPMoviePlayerController 블랙 loginview
https://github.com/arturfelipet/AnimatedLogin 라이브러리를 사용하기 위해 노력하고있어에서 화면하지만 비디오 만 검은 색 화면을 보여줍니다. 여기가 MPMoviePlayerController 만드는 방법 :
#import <AVFoundation/AVFoundation.h>
#import <MediaPlayer/MediaPlayer.h>
#import <QuartzCore/QuartzCore.h>
@interface ViewController() {
MPMoviePlayerController *player;
}
@property (nonatomic, strong) MPMoviePlayerController *player;
@end
@implementation ViewController
@synthesize player;
- (void)viewDidLoad
{
[super viewDidLoad];
CGRect screen = [[UIScreen mainScreen] bounds];
NSURL *movieUrl = [[NSBundle mainBundle] URLForResource:@"background" withExtension:@"mp4"];
self.player = [[MPMoviePlayerController alloc] initWithContentURL:movieUrl];
player.view.frame = screen;
player.scalingMode = MPMovieScalingModeFill;
[self.player setControlStyle:MPMovieControlStyleNone];
[self.view addSubview:player.view];
[player prepareToPlay];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playVideo)
name:MPMoviePlayerReadyForDisplayDidChangeNotification
object:player];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayerDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:self.player];
[player play];
}
- (void)moviePlayerDidFinish:(NSNotification *)note
{
if (note.object == self.player) {
NSInteger reason = [[note.userInfo objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey] integerValue];
if (reason == MPMovieFinishReasonPlaybackEnded)
{
[self.player play];
}
}
}
-(void)playVideo{
[player play];
}
@end
는 그러나 응용 프로그램이 나타 경우에만 검은 화면입니다.
if (![PFUser currentUser])
self.window.rootViewController = [UIStoryboard instansiateVCWithClass:[TPLoginViewController class]];
는 어쩌면 그와 함께 뭔가를 가지고 :이 같은 앱 위임에서 제시 내 LoginViewController이 코드를 사용하고 있습니다? 나는 많은 것을 시도했고 정말로 대답을 감사 할 것입니다.
감사합니다.
그래서 함수에 넣으려고했습니다. - (void) moviePlay, 그리고 viewDidLoad에서 시도했습니다 : [self performSelector : @selector (moviePlay) withObject : self afterDelay : 2]; 하지만 2 초 동안 흰색 화면을 보여준 다음 검은 색 화면 만 보여줍니다. @ rptwsthi – tracifycray
아이디어가 있으십니까? @rptwsthi – tracifycray
귀하의 코드를 확인하고 있습니다. 문제를 파악할 수 있습니다 .. – rptwsthi