2012-06-15 1 views
0

아시다시피 수십 개의 유사한 질문이 있습니다. 나는 그들 모두를 읽고 여전히 답을 찾을 수 없었다. 나는 영상을 가진 전망을 presentModalViewController 방법을 통해 보여준다. 사용자가 스 와이프를하면 다음 동영상을 동일한 플레이어에서 시작하고 싶습니다. 그러나 비디오 플레이어의 contentURL을 변경하려고하면 dismissModalViewControllerAnimated 메서드가 호출 된 것처럼보기가 사라집니다 (그러나 그렇지 않았습니다).플레이어 contentURL이 변경되면 MPMoviePlayerViewController가 사라집니다.

@implementation ViewController 

-(void)viewDidAppear:(BOOL)animated 
{ 
    [super viewDidAppear:animated]; 

    if(!moviePlayerViewController) 
    { 
     NSURL *url = [NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8"]; 

     moviePlayerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:url];  

     UISwipeGestureRecognizer *leftSwipeRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(leftSwipe:)]; 
     leftSwipeRecognizer.direction = UISwipeGestureRecognizerDirectionLeft; 
     [moviePlayerViewController.view addGestureRecognizer:leftSwipeRecognizer]; 

     [self presentModalViewController:moviePlayerViewController animated:YES]; 
    } 
} 

-(void)leftSwipe:(id)sender 
{ 
    moviePlayerViewController.moviePlayer.contentURL = 
     moviePlayerViewController.moviePlayer.contentURL; // no matter what exactly URL here. 
    [moviePlayerViewController.moviePlayer play]; // view disappears even before this line is reached 
} 

@end 

답변