iphoneobjective-cios4moviemovieplayer

Video only play sound when I moved from OS 3.x to 4


Well.. basically that's what happens, when I play a movie from a game I have, only the sound plays, the video doesn't, showing a black screen, even the touch is disabled.

This is the relevant part of the code:

myMovie = [[MPMoviePlayerViewController alloc] initWithContentURL:[self movieURL]];

myMovie.moviePlayer.scalingMode = MPMovieScalingModeFill; myMovie.moviePlayer.controlStyle = MPMovieControlModeHidden;

[myMovie.moviePlayer play];

Thx.

Edit.: Ok, I got it working now, I needed to add this line of code:

[self presentMoviePlayerViewControllerAnimated:myMovie];

The problem now is, that I dont want to see the mediaplayer controls (pause, stop, etc), I just want to watch the video fullscreen, that's all, any ideas?


Solution

  • For me, it was adding these two lines from the MPMoviePlayerController documentation that are not in the MoviePlayer sample code app. So I was getting just audio when playing a stream in the sample app in both 4.1 and 4.2.

    [[theMovie view] setFrame: [self.view bounds]];  // frame must match parent view
    [self.view addSubview: [theMovie view]];