1

I'm implementing a Media player in my iPad app, but the video won't play at all. It shows the video's first frame, but as soon as I press play, it pauses instantly after.

Any idea why this is happening? I think it probably has to do with the iPad being version 3.2.

Below is my code. Thanks in advance!

- (void)viewDidLoad {

    NSString *urlStr = [[NSBundle mainBundle] pathForResource:@"Reel.m4v" ofType:nil];
    NSURL *url = [NSURL fileURLWithPath:urlStr];
    videoPlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
    [self.view addSubview:videoPlayer.view];
    videoPlayer.view.frame = CGRectMake(30, 180, 964, 493);  
    [videoPlayer stop];

    [super viewDidLoad];
}
Adam Storr
  • 1,438
  • 2
  • 21
  • 46
  • Have you checked to make sure you the video path is correct and the video itself is correct and that you don't have a [videoPlayer stop] or similar code anyone else in your code? That code ran perfectly fine for me. – Brenton Morse Mar 08 '11 at 19:47
  • The video path is correct... just double checked. I also couldn't find another [videoPlayer stop]; anywhere else. – Adam Storr Mar 08 '11 at 20:14
  • It works great in the simulator... but not on the iPad. – Adam Storr Mar 08 '11 at 20:22

1 Answers1

1

I figured it out through this post: Ipad MPMovieplayerController video loads but automatically pauses when played

I had to set this videoPlayer.useApplicationAudioSession = NO;

Community
  • 1
  • 1
Adam Storr
  • 1,438
  • 2
  • 21
  • 46