【问题标题】:Cordova windows phone app camera orientation is wrongCordova windows phone 应用程序相机方向错误
【发布时间】:2016-02-17 07:14:43
【问题描述】:

我正在使用 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.

【问题讨论】:

    标签: cordova camera windows-phone-8.1 navigator


    【解决方案1】:

    我找到了解决方案。 在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;
                }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多