views:

747

answers:

0

Hello all,

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

RootViewController.m

-(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

myoverlayview.m

-(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 ?