【发布时间】:2013-02-28 11:54:56
【问题描述】:
我有一个 videoInput 设备列表。 首先,我添加了用于录制的默认输入设备,设置了压缩、输出和所需的一切。之后我试图更改输入设备,但不知何故,视图停止工作,它只显示黑屏。我在不录制时尝试更改,仅在视图中显示输入。 修改代码如下:
-(void) changeVideoInput:(QTCaptureDevice *)videoDevice{
BOOL success = NO;
NSError *error;
[mCaptureSession stopRunning];
[mCaptureSession removeInput:mCaptureVideoDeviceInput]; //current input
[[mCaptureVideoDeviceInput device] close];
success = [videoDevice open:&error];
mCaptureVideoDeviceInput2 = [[QTCaptureDeviceInput alloc] initWithDevice:videoDevice]; //new input
success = [mCaptureSession addInput:mCaptureVideoDeviceInput2 error:&error];
[mCaptureSession startRunning];
}
【问题讨论】:
标签: objective-c video-capture qtkit