相关疑难解决方法(0)

Cocoa - 当相机开始录制时检测事件

在我的 OSX 应用程序中,我使用下面的代码来显示来自相机的预览。

  [[self session] beginConfiguration];

  NSError *error = nil;
  AVCaptureDeviceInput *newVideoDeviceInput = [AVCaptureDeviceInput deviceInputWithDevice:captureDevice error:&error];

  if (captureDevice != nil) {
    [[self session] removeInput: [self videoDeviceInput]];
    if([[self session] canAddInput: newVideoDeviceInput]) {
      [[self session] addInput:newVideoDeviceInput];
      [self setVideoDeviceInput:newVideoDeviceInput];
    } else {
      DLog(@"WTF?");
    }
  }

  [[self session] commitConfiguration];
Run Code Online (Sandbox Code Playgroud)

但是,我需要检测来自相机的预览可用的确切时间。

换句话说,我试图检测与 OSX 下的 Facetime 相同的时刻,一旦相机提供预览,动画就会开始。

实现这一目标的最佳方法是什么?

cocoa video-capture objective-c

1
推荐指数
1
解决办法
1111
查看次数

标签 统计

cocoa ×1

objective-c ×1

video-capture ×1