سؤال

Which is the right way to use the front or the rear camera using AVCaptureSession and AVCaptureDevice ?

I can see that the position attribute of the AVCapturedevice is read-only, and I don't see any other way to tell wich device we want to use, as it can be done with the UIImagePicker...

هل كانت مفيدة؟

المحلول

You use [AVCaptureDevice devices] to enumerate the devices and look at the position property to distinguish the front and rear (where they exist).

There's some example code in zxing. (For iOS, ZXCaptureDevice is AVCaptureDevice in ZXCapture).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top