-
-
Save liscio/613357 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// videoTestMemoryViewController.h | |
// videoTestMemory | |
// | |
// Created by david on 06/10/10. | |
// Copyright 2010 E-ducation.it. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
#import <MediaPlayer/MediaPlayer.h> | |
@interface videoTestMemoryViewController : UIViewController { | |
MPMoviePlayerViewController *theMovieController; | |
} | |
- (IBAction)video; | |
- (void)launchVideo; | |
- (void)myMovieFinishedCallback:(NSNotification *) aNotification; | |
- (void)myMovieExitFullscreenCallback:(NSNotification *) aNotification; | |
- (void)myMovieLoadStateChangedCallback:(NSNotification *) aNotification; | |
@end | |
// | |
// videoTestMemoryViewController.m | |
// videoTestMemory | |
// | |
// Created by david on 06/10/10. | |
// Copyright 2010 E-ducation.it. All rights reserved. | |
// | |
#import "videoTestMemoryViewController.h" | |
@implementation videoTestMemoryViewController | |
- (IBAction)video{ | |
[self launchVideo]; | |
} | |
- (void)launchVideo{ | |
NSString *path = [ [NSBundle mainBundle] pathForResource:@"010101" ofType:@"mp4" ]; | |
theMovieController = [ [MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:path] ]; | |
theMovieController.moviePlayer.controlStyle = MPMovieControlStyleFullscreen; | |
[theMovieController.moviePlayer prepareToPlay]; | |
[theMovieController.moviePlayer.view setBackgroundColor:[ UIColor whiteColor ]]; | |
[self presentModalViewController:theMovieController animated:YES]; | |
} | |
- (void)viewWillAppear:(BOOL)animated{ | |
[super viewWillAppear:YES]; | |
NSLog(@"viewWillAppear"); | |
if (theMovieController != nil) { | |
NSLog(@"retainCount %d", [theMovieController retainCount]); | |
[theMovieController release]; | |
NSLog(@"retainCount %d", [theMovieController retainCount]); | |
theMovieController = nil; | |
} | |
} | |
/* | |
// The designated initializer. Override to perform setup that is required before the view is loaded. | |
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { | |
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { | |
// Custom initialization | |
} | |
return self; | |
} | |
*/ | |
/* | |
// Implement loadView to create a view hierarchy programmatically, without using a nib. | |
- (void)loadView { | |
} | |
*/ | |
/* | |
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. | |
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
} | |
*/ | |
// Override to allow orientations other than the default portrait orientation. | |
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { | |
return YES; | |
} | |
- (void)didReceiveMemoryWarning { | |
// Releases the view if it doesn't have a superview. | |
[super didReceiveMemoryWarning]; | |
// Release any cached data, images, etc that aren't in use. | |
} | |
- (void)viewDidUnload { | |
// Release any retained subviews of the main view. | |
// e.g. self.myOutlet = nil; | |
} | |
- (void)dealloc { | |
NSLog(@"dealloc"); | |
[super dealloc]; | |
} | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// videoTestMemoryViewController.h | |
// videoTestMemory | |
// | |
// Created by david on 06/10/10. | |
// Copyright 2010 E-ducation.it. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
#import <MediaPlayer/MediaPlayer.h> | |
@interface videoTestMemoryViewController : UIViewController { | |
} | |
- (IBAction)video; | |
- (IBAction)dismissVideo; | |
- (void)launchVideo; | |
- (void)myMovieFinishedCallback:(NSNotification *) aNotification; | |
- (void)myMovieExitFullscreenCallback:(NSNotification *) aNotification; | |
- (void)myMovieLoadStateChangedCallback:(NSNotification *) aNotification; | |
@end | |
// | |
// videoTestMemoryViewController.m | |
// videoTestMemory | |
// | |
// Created by david on 06/10/10. | |
// Copyright 2010 E-ducation.it. All rights reserved. | |
// | |
#import "videoTestMemoryViewController.h" | |
@implementation videoTestMemoryViewController | |
- (IBAction)video{ | |
[self launchVideo]; | |
} | |
- (IBAction)dismissVideo { | |
[self dismissModalViewControllerAnimated:YES]; | |
} | |
- (void)launchVideo{ | |
NSString *path = [ [NSBundle mainBundle] pathForResource:@"010101" ofType:@"mp4" ]; | |
MPMoviePlayerViewController *mc = [ [MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:path] ]; | |
mc.moviePlayer.controlStyle = MPMovieControlStyleFullscreen; | |
mc.moviePlayer.view.backgroundColor = [UIColor whiteColor]; | |
[mc.moviePlayer prepareToPlay]; | |
[self presentModalViewController:theMovieController animated:YES]; | |
[mc release]; | |
} | |
- (void)viewWillAppear:(BOOL)animated{ | |
[super viewWillAppear:YES]; | |
} | |
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { | |
return YES; | |
} | |
- (void)didReceiveMemoryWarning { | |
[super didReceiveMemoryWarning]; | |
} | |
- (void)viewDidUnload { | |
[super viewDidUnload]; | |
} | |
- (void)dealloc { | |
[super dealloc]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment