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