我正在使用 Cordova 在 Visual Studio 2015 中为 Windows Phone 创建混合应用程序。 我在面对前置摄像头时遇到摄像头方向问题。
这是我的代码
if (!navigator.camera) {
alert("Camera API not supported", "Error");
deffered.reject('Unable to open camera');
return deffered.promise;
};
if( direction === undefined ) {
direction = 0;
}
var options = {
quality: 50,
destinationType: Camera.DestinationType.FILE_URI,
sourceType: 1, // 0:Photo Library, 1=Camera, 2=Saved Album
encodingType: 0, // 0=JPG 1=PNG
cameraDirection: direction // 0 for back, 1 for front
};
navigator.camera.getPicture(
function( imgData ) {
deffered.resolve(imgData);
},
function (message) {
console.log(message);
deffered.reject('Unable to open camera');
},
options);
return deffered.promise;
}
当相机打开时,方向将相反。
它拍摄相反的图像 我尝试过
cameraOrientation : 0 or 1 but it makes camera green screen only.
最佳答案
我找到了这个问题的解决方案。 在 CameraProxy.js 中,对orientationToRotation 函数第 569 行进行更改。
case Windows.Devices.Sensors.SimpleOrientation.notRotated:
if (cameraDirection == 0) {
return Windows.Media.Capture.VideoRotation.clockwise90Degrees;
}
else {
return Windows.Media.Capture.VideoRotation.clockwise270Degrees;
}
关于Cordova Windows Phone 应用程序相机方向错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33731152/