2009-07-28 2 views
1

작동하는 동영상 파일이 있습니다. 탭 뷰 컨트롤러 내부의 nav 컨트롤러 내부에 tableview 컨트롤러를 추가하고 사용자가 테이블 뷰 셀을 클릭하면 비디오 뷰를로드합니다. 동영상을 시작하고 시뮬레이터에서 회전하지만 비디오는 재생되지 않으며 컨트롤은 세로보기 용입니다. 나는 소리를 듣고 컨트롤에서 시간가는 것을 본다. 분명히 풍경이 아닙니다.iphone 3.1 - MPMediaPlayer가 이상한 풍경이 아닌 초상을 표시합니다.

몇 가지 트릭을 setOrientation에 시도했지만 경고가 있었고 제대로 작동하지 않았습니다.
도움을 주셔서 감사합니다.

#import "StreamViewController.h" 

@implementation StreamViewController 
@synthesize moviePlayer; 
@synthesize streamURL; 

// Override to allow orientations other than the default portrait orientation. 
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    // Return YES for supported orientations 
    return YES; 
} 
- (void)viewDidAppear:(BOOL)animated { 
    NSBundle *bundle = [NSBundle mainBundle]; 
    if (bundle) 
    { 
     NSString *moviePath = [bundle pathForResource:@"splash" ofType:@"m4v"]; 
     self.streamURL  = [NSURL fileURLWithPath:moviePath]; 
    } 

    moviePlayer    = [[MPMoviePlayerController alloc] initWithContentURL:[self streamURL]]; 
    moviePlayer.scalingMode = MPMovieScalingModeAspectFill; 
    [moviePlayer play]; 
    [super viewDidAppear:animated]; 
} 

- (void)dealloc { 
    [super dealloc]; 
} 

@end 

답변

1

나는 첫 번째 것을 놓지 않고 여러 비디오 플레이어를 사용하고 있었다고 생각합니다. 이것을 사용하면 한 MPMoviePlayerController를 항상 활성 상태로 유지할 수 있었지만이 방법으로 전환하면 효과적입니다.

MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:self.splashURL]; 
mp.scalingMode    = MPMovieScalingModeAspectFill; 
if (mp) 
{ 
    // save the movie player object 
    self.streamMoviePlayer = mp; 
    [mp release]; 


    // Play the movie! 
    [self.streamMoviePlayer play]; 
} 
관련 문제