tags:

views:

542

answers:

2

I have a movie file that does work. I added a tableview controller inside a nav controller, inside a tab view controller, and when a user clicks on the table view cell I load the video view. It launches the movie (and rotates in the simulator), but the video doesn't play and the controls are for portrait view. I do hear sound and see time going by in the controls. So it's clearly just not landscape.

I tried some tricks to setOrientation, but they had warnings and didn't work properly.
Thanks for any help you can give.

#import "StreamViewController.h"

@implementation StreamViewController
@synthesize moviePlayer;
@synthesize streamURL;

// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return YES;
}
- (void)viewDidAppear:(BOOL)animated {
    NSBundle *bundle = [NSBundle mainBundle];
    if (bundle) 
    {
        NSString *moviePath = [bundle pathForResource:@"splash" ofType:@"m4v"];
        self.streamURL      = [NSURL fileURLWithPath:moviePath];
    }

    moviePlayer             = [[MPMoviePlayerController alloc] initWithContentURL:[self streamURL]];
    moviePlayer.scalingMode = MPMovieScalingModeAspectFill;
    [moviePlayer play]; 
    [super viewDidAppear:animated];
}

- (void)dealloc {
    [super dealloc];
}

@end
+1  A: 

I guess I was using multiple video players without releasing the first one. Using this helped to keep one MPMoviePlayerController active at all times, but switching it with this approach worked.

MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:self.splashURL];
mp.scalingMode    = MPMovieScalingModeAspectFill;
if (mp)
{
 // save the movie player object
 self.streamMoviePlayer = mp;
 [mp release];


 // Play the movie!
 [self.streamMoviePlayer play];
}
Angelfilm Entertainment
A: 

are you able to show movie in portrait form?

Hussain