Skip to content

Instantly share code, notes, and snippets.

Created October 6, 2010 13:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/613325 to your computer and use it in GitHub Desktop.
Save anonymous/613325 to your computer and use it in GitHub Desktop.
//
// 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment