2012-09-24 3 views
2

전체 화면으로 동영상을 재생할 MPMoviePlayerViewController가 있습니다. 나는 Quicktime을 통해 그들이 잘하는 영화들을 점검했다. 문제는 MPMoviePlayerViewController (시뮬레이터 및 장치)를 사용하면 영화가 재생되지 않는다는 것입니다 (iPad btw에 로컬로 저장된 비디오).MPMoviePlayerController loadState가 MPMovieLoadStatePlayable로 전환되지 않습니다.

NSString *path = [[NSBundle mainBundle]pathForResource:resource ofType:@"mov"]; 
self.mpviewController = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:path]]; 
[self.mpviewController.moviePlayer prepareToPlay]; 
self.mpviewController.moviePlayer.movieSourceType = MPMovieSourceTypeFile; 
self.mpviewController.moviePlayer.controlStyle = [self presentModalViewController:self.mpviewController animated:YES]; 

NSLog(@"%d",self.mpviewController.moviePlayer.loadState); 

[self.mpviewController.moviePlayer play]; 

어떤 아이디어가 빠졌습니까?

TIA

+1

을'self.mpviewController.moviePlayer.controlStyle = [자기 presentModalViewController가 : self.mpviewController 애니메이션 : YES];' –

+0

물론 그것은 완전히 무의미한 것입니다. 내가 확인해야 해. 나는 이것이 복사 붙여 넣기 오류 일뿐입니다. 주의 해 주셔서 감사합니다. 그렇지 않다면 - 그것을 설명 할 수있다 :) – HeikoG

답변

0

아니라, 나는 그것이 무엇인지 잘 모릅니다. 이 코드로 새로운 뷰 컨트롤러 쓰기 끝났다 - 일 : 이것의 목적은 무엇

NSURL *url = [NSURL fileURLWithPath:self.urlPath]; 

self.playerController = [[MPMoviePlayerController alloc] initWithContentURL: url]; 
CGRect bounds = CGRectMake(0, 0, 1024, 748); 
self.playerController.scalingMode = MPMovieScalingModeNone; 

[self.playerController.view setFrame:bounds]; 

[self.view addSubview:self.playerController.view]; 

[[NSNotificationCenter defaultCenter] addObserver:self 
             selector:@selector(moviePlayerDidExitFullscreenCallback:) 
              name:MPMoviePlayerPlaybackDidFinishNotification 
              object:self.playerController]; 

self.playerController.controlStyle = MPMovieControlStyleFullscreen; 
[self.playerController setFullscreen:YES animated:YES]; 
[self.playerController play]; 
관련 문제