문제

iPhone 앱에 비디오를 어떻게 추가합니까?iPhone SDK 3.2.5 사용? 나는 실제 비디오를 보지 못했지만 나는 그것을들을 수 있습니다.

여기에 코드가 있습니다.

-(void) viewDidLoad{
    NSBundle *bundle=[NSBundle mainBundle];
    NSString *moviePath = [bundle pathForResource:@"Facebook" ofType:@"mp4"];
    NSURL *movieURL=[[NSURL fileURLWithPath:moviePath] retain];
    MPMoviePlayerController *theMovie = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
    theMovie.scalingMode = MPMovieScalingModeAspectFill;
    [theMovie play];
    [super viewDidLoad];
}
.

도움이 되었습니까?

해결책

You need to set the frame for you MPMoviePlayerController and add it to your view:

theMovie.view.frame = CGRectMake(0.0, 0.0, 320.0, 480.0);
[self.view addSubview:theMovie.view];

다른 팁

First off – find out what video format you are having. I assume it's not the one supported by iPhones.

  1. So when you learn this you can go ahead and look for a third party player that is able to play back your video. I'm sure there are a lot of them there. Recommendation from me – try using VLC.

  2. If you want to use default videos app on your iPhone (which, of course, is way better than any other alternative) you can try out Windows & Mac application WALTR 2: https://softorino.com/waltr/windows-guides/how-transfer-videos-to-iphone-without-itunes. It adapts any video & music for iPhone playback and pushes them to your default app on an iPhone.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top