Search code examples
objective-cosx-snow-leopardaudio-recordingqtkitaudiovideoplayback

QTKit makes my program freeze when attempting to play a video while recording sounds from an other source


I have an application where I use QTKit to acquire realtime information about the sounds surrounding the machine. While this is happening some user events may launch the playback of a video (still using QTKit). When this happens I see the video playing however the input sound stops being acquired and processed.

The movie View is initialized in the avakeFromNib

mCursor = 0;
mFileManager = [NSFileManager defaultManager];
mPath = [[[mFileManager currentDirectoryPath] stringByAppendingString:@"/Vids/"]retain];
mMovieFiles= [[[mFileManager contentsOfDirectoryAtPath:mPath error:nil]filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"self ENDSWITH '.mov'"]]retain];
[mMovie init];
[mMovieView setControllerVisible:NO];
[mMovieView setEditable:NO];

When Play is hit the audio input stream stops

    if (sender==mPlay)
{
    [mGraphView setHidden:YES];
    [mMovieView setHidden:NO];
    mMovie = [[QTMovie movieWithFile:[mPath stringByAppendingString:[mMovieFiles objectAtIndex:mCursor]] error:nil] retain];
    [mMovieView setMovie:mMovie];
    [mMovieView setNeedsDisplay:YES];
    [mMovieView play:self];
}

Any idea on how to make it work ?

Thank's in advance


Solution

  • got the answer

    I stopped the QTCaptureSession with -stopRunning launched the video and restarted with -startRunning