捕捉前置摄像头 - PhoneGap?
如何使用 PhoneGap 从前置摄像头捕获视频?
我在 Phonegaps API 在线文档中找到了这个 navigator.device.capture.captureVideo(captureSuccess, captureError, {limit:2});
,但我没有看到任何有关使用前置摄像头而不是后置摄像头的信息。是否可以?
How to capture video from front-facing camera, using PhoneGap?
I found this navigator.device.capture.captureVideo(captureSuccess, captureError, {limit:2});
in Phonegaps API docs online, but I don't see anything about using the front camera instead of rear. Is it possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我想相机打开后,你可以选择前置摄像头。目前我不认为有默认打开前置摄像头的选项
I think after the camera opens up, u can choose the front camera. Currently i dont think so there is an option to open the front camera by default
如果您的智能手机有前后摄像头,当您使用
拍摄时,相机将自动通过开关按钮打开。
If your smartphone have front and back camera, when you use
capture camera will be opened with switch button automatically.
自从我有了一个应用程序的想法以来,我今天就在玩 PhoneGap。对于这个想法,我还需要选择前置摄像头作为默认值。在尝试了不同的方法后,我找到了一种解决方法,默认选择前置摄像头[注意:这是一个肮脏的修复,我不知道在没有前置摄像头的设备上会发生什么!]
在 Xcode(或您使用的任何编辑器)中打开
[ProjectName]/plugins/CDVCapture.m
并找到 captureImage 和 captureVideo。这两个函数/命令都有一行表示pickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
在下面添加此行:
pickerController.cameraDevice = UIImagePickerControllerCameraDeviceFront;
视频和图像捕获都会选择正面打开相机应用程序时默认为相机。然而,用户仍然可以切换相机。
这是一个包含完整 CVDCapture.m 文件的 Pastebin: http://pastebin.com/kkkyiPdn
I was playing around with PhoneGap today since I had an idea for an app. For this idea I needed the front facing camera aswell to be selected as default. After trying different things I found a work around which selected the front facing camera by default [NOTE: this is a dirty fix, I've got no clue what happens on devices without a front facing camera!]
In Xcode (or whatever editor you use) open
[ProjectName]/plugins/CDVCapture.m
and locate both captureImage and captureVideo. Both functions/commands have a line sayingpickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
Add this line below:
pickerController.cameraDevice = UIImagePickerControllerCameraDeviceFront;
And both Video and Image capturing will select the front facing camera by default when opening up the camera app. However, the user still has the possibility to switch cameras.
Here's a pastebin with my full CVDCapture.m file: http://pastebin.com/kkkyiPdn