0
是否有任何其他API提供將「cameraDevice」更改爲後端和前端? 旁邊的「UIImagePickerController」的cameraDevice屬性?將「cameraDevice」更改爲後端和前端(在UIImagePickerController旁邊)
是否有任何其他API提供將「cameraDevice」更改爲後端和前端? 旁邊的「UIImagePickerController」的cameraDevice屬性?將「cameraDevice」更改爲後端和前端(在UIImagePickerController旁邊)
這個功能讓我解決了這個問題。
- (AVCaptureDevice *)frontFacingCamera
{
NSArray *videoDevices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
AVCaptureDevice *captureDevice = nil;
for (AVCaptureDevice *device in videoDevices)
{
if (device.position == AVCaptureDevicePositionFront) {
captureDevice = device;
break;
}
}
return captureDevice;
}
我猜正在對使用'imagePickerController.cameraDevice = UIImagePickerControllerCameraDeviceRear;' –
是啊,我知道imagePickerController.cameraDevice可變的,但我希望能看到,如果其他API有控制中。由於我的具體原因,我不能使用UIImagePickerController API。 – fkkcloud
比你可以使用[AVCaptureVideoPreviewLayer](https://developer.apple.com/library/mac/documentation/AVFoundation/Reference/AVCaptureVideoPreviewLayer_Class/Reference/Reference.html) –