我有一个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];
}发布于 2013-03-04 19:04:42
最后我发现,代码是有效的。该问题导致打开默认的视频设备(它的名称是:"Blackmagic")。请勿打开该设备。它是一个通用的设备。
https://stackoverflow.com/questions/15134891
复制相似问题