Hello,
I am developing an iPad app where I am playing the videos stored within the app itself. I am representing the list of videos in a table view. When I select a row, the video corresponding to that row plays. But while performing this, sometimes screen goes black , no video is visible but only audio is playing.
I am aware that making the video play in fullscreen mode or using the MPMoviePlayerViewController eliminates this problem. But my requirement is that I don't want to play the movie in fullscreen initially. Please guide me on how this can be achieved.
-(void)playMovie { MPMoviePlayerController *movieController = [[MPMoviePlayerController alloc] initWithContentURL:movieUrl]; self.moviePalyer = movieController; [movieController release];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePalyerDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object: self.moviePalyer];
self.moviePalyer.view.frame = CGRectMake(240, 0, 561, 313); self.moviePalyer.view.backgroundColor = [UIColor clearColor]; [self.moviePalyer prepareToPlay]; [self.view addSubview: self.moviePalyer.view]; [self.moviePalyer play];
} -(void)moviePalyerDidFinish:(NSNotification*)notification { [moviePalyer.view removeFromSuperview]; [moviePalyer stop]; moviePalyer.initialPlaybackTime = -1.0;
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:moviePalyer]; [moviePalyer release]; moviePalyer = nil; }
Thnaks.
NOTE: This is on ipad simulator