3

I have methods inside my open class controller that instantiates a moviePlayer, which is set to 'autoPlay = NO';

I have added the movieplayer.view as a subview of the controllers view, configured it and created a full screen button on top for starting the video. Since iOS4.3, this has been working fine. The button is transparent and the first frame of the video showed through ( which was a picture of a custom Automoble Auto-Start button).

Since iOS6, I only get a black screen. Clicking the image-button does start the video as it should; calls [moviePlayer play]

Has something changed that I have not taken into consideration? I have provided the two sections of code I think are necessary.

#define INTRO_MOVIE @"Intro.mov"
-(void)viewDidLoad
{
    if(SHOULD_PLAY_INTRO_VIDEO)//Debug switch to ignore the intro video
    {
        // Prepare the movie and player
        [self configureIntroMoviePlayer];        
        [self.view addSubview:moviePlayer.view];      
        [self.view bringSubviewToFront:moviePlayer.view];

        // Add and Show the Start Button to start the App
        [self configureStartButton];
        [self.view addSubview:startButton];
    }
}

-(void)configureIntroMoviePlayer
{
    LOGINFO
    // Prepare the Intro Video    
    NSString *pathToIntroVideo  = [ mainFilePath_ stringByAppendingPathComponent: INTRO_MOVIE];
    NSURL *URLToIntroVideo      = [NSURL fileURLWithPath:pathToIntroVideo];

    moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:URLToIntroVideo];
    [moviePlayer setShouldAutoplay:NO];
    moviePlayer.view.frame = CGRectMake(0, -20, 1024, 768);
    [moviePlayer setControlStyle:MPMovieControlStyleNone];

    //fixing video brightness Difference with iPad2
    if(isIpad2)
    {
        moviePlayer.backgroundView.backgroundColor = [UIColor blackColor];
        moviePlayer.view.alpha = .99;
    }

// Create the sKip button for cancelling the Intro Video
    skipIntro = [UIButton buttonWithType:UIButtonTypeCustom];
    [skipIntro showsTouchWhenHighlighted];
    skipIntro.frame = CGRectMake(900, 20, 111, 57);
    [skipIntro addTarget:self action:@selector(skipIntroWasPressed) forControlEvents:UIControlEventTouchUpInside];

}
jtingato
  • 71
  • 6

2 Answers2

2

I am not sure why I got a -1 rating for this question for lack of research or clarity? Maybe I do not know the proper usage of this forum. I apologize.

I did find that adding [moviePlayer prepareToPlay] solved the problem. Like I said, it was odd that the first frame always showed up prior to iOS 6.

jtingato
  • 71
  • 6
0

Have you tried:

 [moviePlayer.view addSubView:startButton];
Jack Freeman
  • 1,414
  • 11
  • 18
  • No. I do not have a "StartButton" per se. The first several frames of the video is an image of the start button that exists in this particular automobile. When the fullscreen UIButton, which is over top the video is clicked, the video starts... which plays the video starting with the start button shaking and being pressed in. – jtingato Oct 22 '12 at 20:16
  • Like I said, prior to iOS 6, just adding the video used to show the first frame of the paused video. – jtingato Oct 22 '12 at 20:18