Posted By

rottendevice on 05/05/11


Tagged

video


Versions (?)

Video playback


 / Published in: iPhone
 

  1. - (void)viewWillAppear:(BOOL)animated {
  2.  
  3. self.tabBarController.tabBar.hidden = NO;
  4.  
  5. //video stuff
  6. CGRect myVideoRect = CGRectMake(0.0f, 145.0f, 320.0f, 160.0f);
  7. movieUrl = [[NSBundle mainBundle] URLForResource:@"Chair_to_Stand" withExtension:@"m4v"];
  8. moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:movieUrl];
  9. [[moviePlayerController view] setFrame:myVideoRect];
  10. moviePlayerController.controlStyle = MPMovieControlStyleNone;
  11. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playbackFinished:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayerController];
  12.  
  13. [self.view addSubview:moviePlayerController.view];
  14. [moviePlayerController play];
  15.  
  16. }
  17. - (void)viewWillDisappear:(BOOL)animated {
  18. if (moviePlayerController != nil) {
  19. [moviePlayerController release];
  20. moviePlayerController = nil;
  21. }
  22. }
  23.  
  24. - (void)playbackFinished:(NSNotification*)notification {
  25. if (moviePlayerController != nil) {
  26. thriveVC = [[ThriveViewController alloc] init];
  27. thriveVC.hidesBottomBarWhenPushed = NO;
  28.  
  29. [[self navigationController] pushViewController:thriveVC animated:YES];
  30. }
  31.  
  32. }
  33.  
  34. - (void)backPressed:(UIButton*)button {
  35. [self.navigationController popViewControllerAnimated:YES];
  36.  
  37. }
  38. - (void)skipPressed:(UIButton*)button {
  39.  
  40. thriveVC = [[ThriveViewController alloc] init];
  41. thriveVC.hidesBottomBarWhenPushed = NO;
  42.  
  43. [[self navigationController] pushViewController:thriveVC animated:YES];
  44.  
  45. }

Report this snippet  

You need to login to post a comment.