ios_logger icon indicating copy to clipboard operation
ios_logger copied to clipboard

Switch camera

Open yaqding opened this issue 5 years ago • 1 comments

Hello Varvrar!

Thanks for you great work! I have used this nice app to recorder data for pose estimation. I was wondering how I could choose different back cameras since there are multiple back cameras from iphone 7. For example, I was trying to use the TelephotoCamera or UltraWideCamera, and based on the apple documentation I need to use AVCaptureDeviceDiscoverySession:

AVCaptureDeviceDiscoverySession *session = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:AVCaptureDeviceTypeBuiltInUltraWideCamera mediaType:AVMediaTypeVideo position:AVCaptureDevicePositionUnspecified];

However, it doesn't work. Could you please give some suggestions?

Thanks!

yaqding avatar Mar 09 '20 15:03 yaqding

Hello yaqding!

I can't try to use second back camera now. But I think you should change AVCaptureDevice instead of using AVCaptureDeviceDiscoverySession. https://github.com/Varvrar/ios_logger/blob/a42f5331b977e73a747a102ad84b2cbfd13994f6/ios_logger/ViewController.mm#L93

Check apple documentation: https://developer.apple.com/documentation/avfoundation/avcapturedevice?language=objc

You can try to use different defaultDeviceWithDeviceType. Like AVCaptureDeviceTypeBuiltInTelephotoCamera or AVCaptureDeviceTypeBuiltInWideAngleCamera. Or try to get device types in advance using devicesWithMediaType.

Varvrar avatar Apr 07 '20 12:04 Varvrar