0

是否有任何其他 API 可以将“cameraDevice”更改为前后? 在 "UIImagePickerController" 的 cameraDevice 属性旁边?

4

1 回答 1

0

这个功能让我解决了这个问题。

- (AVCaptureDevice *)frontFacingCamera
{
    NSArray *videoDevices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
    AVCaptureDevice *captureDevice = nil;
    for (AVCaptureDevice *device in videoDevices)
    {
        if (device.position == AVCaptureDevicePositionFront) {
            captureDevice = device;
            break;
        }
    }
    return captureDevice;
}
于 2014-05-02T00:51:18.873 回答