Is there an easy way to change a device in QTCaptureSession
Is there an easy way to change an audio/video device in QTCaptureSession other than enumarating over an array of devices from...
[captureSession inputs];
Checking to see whether the device is QTMediaTypeSound or QTMediaTypeVideo and d开发者_开发问答eleting them?
That depends on what you mean by "easy".
From the top of my head, there are the following options:
- Have an instance variable for the inputs you want to remove later, in the first place.
- Query the array returned from
-[QTCaptureSession inputs]
by sendingfilteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"device.mediaType == \"%@\"", type]
to it. - If you are targeting ≥ 10.6 you have the added option of using
indexesOfObjectsPassingTest:
to determine the inputs you want to remove.
But there is no way (at least none, that I know of) of saying removeInputsWithMediaType:
.
HTH
Daniel
精彩评论