Video not playing in iOS4

Discussion in 'iOS Programming' started by jackdvdripper, Jul 16, 2010.

  1. jackdvdripper macrumors newbie

    Jul 16, 2010
    I have the following code to play a video when a button is pushed in my app
    - (IBAction)play {
    	NSBundle *bundle = [NSBundle mainBundle];
    	NSString *moviePath = [bundle pathForResource:@"mom" ofType:@"mp4"];
    	NSURL  *movieURL = [[NSURL fileURLWithPath:moviePath] retain];
    	MPMoviePlayerController *theMovie = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
    	theMovie.scalingMode = MPMovieScalingModeAspectFill;
    	[theMovie play];
    It played just fine until I upgraded my iPhone to iOS4. Now the audio will play, but not the video. Is there a reason for this?
  2. CeiJay macrumors newbie


    Jul 17, 2010
    Since 3.2 and really iOS4 there have been a few changes when is comes to playing movie. MPMoviePlayerController is sort of out now. MoviePlayerViewController is in (notice the View) have a look at the like below, download the source code and you will have it working in no time. Make sure you test on run for leaks on your device as you will see a few things wrong with the Sim. All the best...

    Click Me for the Solution

Share This Page