xcode - iPhone SDK: Stopping a Video -
how can stop video once navigate away view , make video play again when original view again?
here code play video in original view:
- (void)viewdidload { nsbundle *bundle=[nsbundle mainbundle]; nsstring *moviepath = [bundle pathforresource:@"video" oftype:@"mp4"]; nsurl *movieurl=[[nsurl fileurlwithpath:moviepath] retain]; mpmovieplayercontroller *themovie = [[mpmovieplayercontroller alloc] initwithcontenturl:movieurl]; themovie.scalingmode = mpmoviescalingmodeaspectfill; themovie.view.frame = cgrectmake(104.0, 134.0, 200.0, 250.0); [self.view addsubview:themovie.view]; [themovie play]; [super viewdidload]; self.view.backgroundcolor = [uicolor viewflipsidebackgroundcolor]; }
- make
themovie
instance var - stop playing in
-(void) viewwilldisappear:(bool)animated
and should start playing when navigate view. or move code -(void) viewdidappear:(bool)animated
Comments
Post a Comment