I am working on a program which has a rigid set of 'stages' for video recording... Think of it like a Video-Booth. I am running the program on OSX Lion, coded entirely in Cocoa.
The 'stages' are as follows:
Stages 1, 2, and 4 work perfectly every time. And Stage 3 works perfectly the FIRST time.
On the second, or later, time of going through the process, the video playback (which is done by a QTMovieView
embedded within a NSPanel) is still set to the video from the FIRST run-through.
I have two methods set-up, one which is activated by a button press, the other by other code in the program. BOTH of these methods DO FIRE, I am positive. What I don't know is why [mPlaybackView setMovie: lclMov]
is not setting the new movie...
To clarify (based on the code below):
TEMP_STORE
actually exists (and is the new file, not the old one)[QTMovie movieWithFile:TEMP_STORE error:&err];
with [[QTMovie alloc] initWithFile:TEMP_STORE error:&err]
(as per a recommendation I saw online somewhere)TEMP_STORE
is a '.mov' file recorded by another code segment in my programAny and all help is appreciated!!!
- (IBAction) startPlayback: (id) sender {
NSError *err;
QTMovie *lclMov = [QTMovie movieWithFile:TEMP_STORE error:&err];
[instrPlayback orderOut:nil];
if (err != nil) {
[errorMessage setStringValue:[NSString stringWithFormat:@"%@", [err localizedDescription]]];
[errorDialog makeKeyAndOrderFront:nil];
} else {
[self writeString: CMD_PROCEED];
[mPlaybackView setMovie:lclMov];
[mPlaybackView gotoBeginning:nil];
[playbackDialog makeKeyAndOrderFront:nil];
}
}
- (void) stopPlayback {
QTMovie *lclMov = [mPlaybackView movie];
if ([lclMov canUpdateMovieFile]) {
if (![lclMov updateMovieFile]) {
[errorMessage setStringValue:@"Error Applying Updates to MOV File.\nAsk Lab Attendant for Help."];
[errorDialog makeKeyAndOrderFront:nil];
}
}
[playbackDialog orderOut:nil];
}
To people who come upon this in the future, here was my soltuion:
I guess I was being sort of dumb ... but I knew it had something to do with deallocating the video from memory. My resulting solution was to import the QuickTime framework (which, as I had not a clue, was different than the QTKit framework) and use the DisposeMovie()
method from Movies.h
Such a simple solution, and it gave me so much trouble.
Good luck to all the developers out there who may run into this same problem :)