views:

316

answers:

1

When I play a video doing this:

    NSString *videoFilepath = [[NSBundle mainBundle] pathForResource:@"bacon" ofType:@"mov"];
    NSURL *videoURL = [NSURL fileURLWithPath:videoFilepath];
    MPMoviePlayerController *movie;
    movie = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
    [movie play];

on 3.2, it works pefeectly. But if I switch the base SDK to 4.0 i only hear the sound of the movie.

Any ideas?

+1  A: 

I believe that adding this with your play command should improve matters for you:

[movie play] [movie setFullscreen:YES]; [self.view addSubview:movie.view];

Try testing this property as it sounds like the movie is playing but has not been set to fullscreen:

http://developer.apple.com/iphone/library/documentation/mediaplayer/reference/MPMoviePlayerController_Class/MPMoviePlayerController/MPMoviePlayerController.html#//apple_ref/occ/instp/MPMoviePlayerController/fullscreen

This line of code is also of importance: [self presentMoviePlayerViewControllerAnimated:movie];

Lance
yep, that worked