Phonegap / Cordova - Android中默认为前置摄像头

时间:2013-06-10 10:20:10

标签: android cordova

我在Android Front Facing Camera by default尝试了解决方案,但仍使用后置摄像头。有人可以提供完整的代码来获得前置摄像头吗?

2 个答案:

答案 0 :(得分:1)

cameraDirection属性用于设置摄像机方向(前/后)。你必须在这样的选项中添加它:

navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50, cameraDirection:1, destinationType:        destinationType.DATA_URL}); } 

“1”用于前置摄像头,“2”用于后置摄像头。

答案 1 :(得分:0)

此代码将在旧设备和ios设备上翻转相机,但不会更改较新Android版本的默认设置。

H:\Superstar\vision-front-end-dev-master>npm install
npm WARN addRemoteGit Error: Command failed: git -c core.longpaths=true 
   config --get remote.origin.url
npm WARN addRemoteGit
npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:211:12)
npm WARN addRemoteGit     at emitTwo (events.js:106:13)
npm WARN addRemoteGit     at ChildProcess.emit (events.js:191:7)
npm WARN addRemoteGit     at maybeClose (internal/child_process.js:885:16)
npm WARN addRemoteGit     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
npm WARN addRemoteGit  erikflowers/weather-icons resetting remote C:\Users\Arslan\AppData\Roaming\npm-cache\_git-remotes\git-github-com-erikflowers-weather-icons-git-0c0a2917 because of error: { Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit
npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:211:12)
npm WARN addRemoteGit     at emitTwo (events.js:106:13)
npm WARN addRemoteGit     at ChildProcess.emit (events.js:191:7)
npm WARN addRemoteGit     at maybeClose (internal/child_process.js:885:16)
npm WARN addRemoteGit     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
npm WARN addRemoteGit   killed: false,
npm WARN addRemoteGit   code: 1,
npm WARN addRemoteGit   signal: null,
npm WARN addRemoteGit   cmd: 'git -c core.longpaths=true config --get remote.origin.url' }