Hi guys,
So i'm trying to build a super simple little app (my first,) i'm working my way through a thick book on cocoa and trying to do follow tutorials I find online. Basically i'm trying to build a super simple little app that plays a video. I've been looking at the tuts on the apple site and this... I've built a simple video player using QTKit framework, and added some code from a tutorial into mydocument.m.
I want the video player to load a single video that I have as an mp4, and have added it to the resources folder (through the project window)
I'm basically trying to learn by smashing things together and this is where i'm at with the code:
I'm not sure if i'm adding the pathforresource in correctly...
any help would be greatly appreciated.
So i'm trying to build a super simple little app (my first,) i'm working my way through a thick book on cocoa and trying to do follow tutorials I find online. Basically i'm trying to build a super simple little app that plays a video. I've been looking at the tuts on the apple site and this... I've built a simple video player using QTKit framework, and added some code from a tutorial into mydocument.m.
I want the video player to load a single video that I have as an mp4, and have added it to the resources folder (through the project window)
I'm basically trying to learn by smashing things together and this is where i'm at with the code:
Code:
#import "MyDocument.h"
@implementation MyDocument
- (id)init
{
self = [super init];
if (self) {
}
return self;
}
- (NSString *)windowNibName
{
return @"MyDocument";
}
- (void)windowControllerDidLoadNib:(NSWindowController *) aController
{
[super windowControllerDidLoadNib:aController];
}
- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError
{
if ( outError != NULL ) {
*outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL];
}
return nil;
}
- (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError
{
NSString* movieFile = [[NSBundle mainBundle] pathForResource:@"/testmovie" ofType:@"mp4"];
QTMovie* newMovie = [QTMovie movieWithFile:movieFile error:nil];
if (newMovie) {
[self setMovie:newMovie];
}
return (newMovie != nil);
}
@synthesize movie;
@end
I'm not sure if i'm adding the pathforresource in correctly...
any help would be greatly appreciated.