Varvrar/ios_logger

Switch camera

yaqding opened this issue · 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!

Hello yaqding!

I can't try to use second back camera now. But I think you should change AVCaptureDevice instead of using AVCaptureDeviceDiscoverySession.

device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];

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.