Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ulquiorra

macrumors member
Original poster
Jun 17, 2009
38
0
Hello all,

i have an MPMOvieplayercontroller in my rootviewcontroller and have attached an action to it. it looks a bit like this.

Code:
[B][COLOR="black"]RootViewController.m[/COLOR][/B]

-(void)playMovie1 { NSURL *movie = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"movie4" ofType:@"m4v"]];

MPMoviePlayerController * theMovie = [[MPMoviePlayerController alloc]initWithContentURL:movie];

[theMovie setOrientation:UIDeviceOrientationPortrait animated:NO]; // theMovie.movieControlMode = MPMovieControlModeHidden;

[theMovie setScalingMode:MPMovieScalingModeAspectFit];

theMovie.backgroundColor = [ UIColor whiteColor];

[[NSNotificationCenter defaultCenter] addObserver:self

selector:@selector(myMovieFinishedCallback:)

name:MPMoviePlayerPlaybackDidFinishNotification

object:theMovie];

[theMovie play];

MyOverlayView *web = [[MyOverlayView alloc] initWithNibName:@"OverLay" bundle:nil];

[[[UIApplication sharedApplication]keyWindow]addSubview:web.view];

}


-(void)stopMovie { [theMovie stop]; }

I figured in my overlayView( which comes over my video )

I could make and call the following function

Code:
[B][COLOR="black"]myoverlayview.m[/COLOR][/B]

-(IBAction)stopvideo:(id)sender 
{ RootViewController *stopvid = [[RootViewController alloc] init]; 
[stopvid stopMovie];

}

So when my movie player I've attacted the stopVideo to a button in my overlayview nib file. My other buttons in the nibfile work so I figured everything is good in that area. Does anyone know what I'm doing wrong ?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.