当尝试播放视频同时录制其他来源的声音时,QTKit 使我的程序冻结

发布于 2024-10-24 07:04:33 字数 968 浏览 1 评论 0原文

我有一个应用程序,我使用 QTKit 来获取有关机器周围声音的实时信息。当这种情况发生时,一些用户事件可能会启动视频的播放(仍然使用 QTKit)。发生这种情况时,我看到视频正在播放,但是输入声音停止被获取和处理。

电影视图在 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];

当播放被点击时,音频输入流停止

    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];
}

关于如何使它工作的想法?

提前致谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

看轻我的陪伴 2024-10-31 07:04:33

得到答案

我用 -stopRunning 停止了 QTCaptureSession 启动了视频并用 -startRunning 重新启动

got the answer

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文