2012-03-30 5 views
0

다음을 시도하면 두 번 살짝 움직이면 현재 재생중인 비디오가 멈추지 만 새 비디오는 재생되지 않습니다. 방금 검은 색 화면이 나타납니다.MPMoviePlayerController의 내용을 변경하십시오.

UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)]; 
tap.numberOfTapsRequired = 2; 
[self.moviePlayer.view addGestureRecognizer:tap]; 


- (void)handleTap:(UITapGestureRecognizer *)gesture { 

    NSBundle *bundle = [NSBundle mainBundle]; 
    NSString *moviePath = [bundle pathForResource:@"Movie2" ofType:@"mp4"]; 


    [self.moviePlayer setContentURL:[NSURL fileURLWithPath:moviePath]]; 
    NSLog(@"contentURL: %@", self.moviePlayer.contentURL); 
} 

로그 문이 제대로 파일을 보여줍니다 //localhost/Users/me/Library/Application%20Support/iPhone%20Simulator/5.0/Applications/15072262-7BC0-42D5-840C-740CF5B97D55/MyApp.app/ Movie2.mp4

처음으로 MPMoviePlayerController를 만들 때 movie2.mp4가 유효하고 contentURL로 설정하면 재생됩니다. 왜 플레이어의 콘텐츠를 변경할 수 없습니까?

+0

모든 알림을 구독하셨습니까? 어쩌면 무슨 일이 일어나고 있는지 당신에게 말하려고하는 것일 수도 있습니다. – jsd

답변

2

실제로 나는 contentURL을 변경 한 후에 재생해야한다고 말했습니다. [self.moviePlayer play];

관련 문제