iPhone SDK:How do you play video inside a view? Rather than fullscreen.

Posted by Jessica on Stack Overflow See other posts from Stack Overflow or by Jessica
Published on 2009-08-12T14:59:17Z Indexed on 2010/05/29 8:52 UTC
Read the original article Hit count: 282

Filed under:
|
|

Hi, I am trying to play video inside a UIView, so my first step was to add a class for that view and start playing a movie in it using this code:

- (IBAction)movie:(id)sender{
    NSBundle *bundle = [NSBundle mainBundle];
    	NSString *moviePath = [bundle pathForResource:@"Movie" ofType:@"m4v"];
    NSURL *movieURL = [[NSURL fileURLWithPath:moviePath] retain];
    MPMoviePlayerController *theMovie = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
    theMovie.scalingMode = MPMovieScalingModeAspectFill;
    [theMovie play];
}

But this just crashes the app when using this method inside it's own class, but is fine elsewhere. Does anyone know how to play video inside a view? and avoid it being full screen?

© Stack Overflow or respective owner

Related posts about xcode

Related posts about framework