iPhone - 使用 AVCaptureSession 和 AVCaptureDevice 使用前置或后置摄像头
使用 AVCaptureSession 和 AVCaptureDevice 使用前置或后置摄像头的正确方法是什么?
我可以看到 AVCapturedevice 的 position
属性是只读的,并且我没有看到任何其他方法来告诉我们要使用哪个设备,因为它可以通过 UIImagePicker 来完成。 。
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 which device we want to use, as it can be done with the UIImagePicker...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
[AVCaptureDevice devices]
枚举设备并查看position
属性来区分前部和后部(它们存在的位置)。zxing 中有一些示例代码。 (对于 iOS,
ZXCaptureDevice
是ZXCapture
中的AVCaptureDevice
)。You use
[AVCaptureDevice devices]
to enumerate the devices and look at theposition
property to distinguish the front and rear (where they exist).There's some example code in zxing. (For iOS,
ZXCaptureDevice
isAVCaptureDevice
inZXCapture
).