Esempio n. 1
0
    // -------------------------------------------------------------------------------------------------------------
    // -------------------------------------------------------------------------------------------------------------


    public void CheckeParameters()
    {
#if (UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBGL)
        if (useNativeCapture)
        {
            Debug.Log("xmgVideoCaptureParameters (useNativeCapture) - Video Capture cannot be set to native for PC/MAC platforms => forcing to FALSE");
        }
        if (UseFrontal)
        {
            Debug.Log("xmgVideoCaptureParameters (UseFrontal) - Frontal mode option is not available for PC/MAC platforms - Use camera index edit box instead => forcing to FALSE");
        }
        useNativeCapture = false;
        UseFrontal       = false;
#endif

#if (!UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS))
        captureDeviceOrientation = xmgOrientationMode.LandscapeLeft;
        if (UseFrontal && !MirrorVideo)
        {
            MirrorVideo = true;
            Debug.Log("xmgVideoCaptureParameters (MirrorVideo) - Mirror mode is forced on mobiles when using frontal camera => forcing to TRUE");
        }
        if (!UseFrontal && MirrorVideo)
        {
            MirrorVideo = false;
            Debug.Log("xmgVideoCaptureParameters (MirrorVideo) - Mirror mode is deactivate on mobiles when using back camera => forcing to FALSE");
        }
#endif
    }
Esempio n. 2
0
    protected void CheckParameters()
    {
#if (!UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS))
        if (m_videoParameters.useNativeCapture)
        {
            m_captureDeviceOrientation = xmgOrientationMode.LandscapeLeft;
        }
#endif
    }
    // -------------------------------------------------------------------------------------------------------------------

    static public xmgOrientationMode GetDeviceCurrentOrientation(int captureDeviceOrientation, bool isFrontalCamera = false)
    {
        xmgOrientationMode orientation = xmgOrientationMode.LandscapeLeft;// Default portrait

#if (UNITY_STANDALONE || UNITY_EDITOR || UNITY_WEBGL)
        orientation = (xmgOrientationMode)captureDeviceOrientation;
#elif (UNITY_ANDROID)
        orientation = xmgOrientationMode.Portrait; // Default
        DeviceOrientation deviceOrientation = Input.deviceOrientation;
        if (deviceOrientation == DeviceOrientation.LandscapeRight)
        {
            orientation = xmgOrientationMode.LandscapeRight;
        }
        if (deviceOrientation == DeviceOrientation.LandscapeLeft)
        {
            orientation = xmgOrientationMode.LandscapeLeft;
        }
        if (deviceOrientation == DeviceOrientation.PortraitUpsideDown)
        {
            orientation = xmgOrientationMode.PortraitUpsideDown;
        }
        if (!isFrontalCamera && deviceOrientation == DeviceOrientation.Portrait)
        {
            orientation = xmgOrientationMode.PortraitUpsideDown;
        }
        if (!isFrontalCamera && deviceOrientation == DeviceOrientation.PortraitUpsideDown)
        {
            orientation = xmgOrientationMode.Portrait;
        }
#elif (UNITY_IOS)
        orientation = xmgOrientationMode.PortraitUpsideDown;         // Default
        DeviceOrientation deviceOrientation = Input.deviceOrientation;
        if (deviceOrientation == DeviceOrientation.LandscapeRight)
        {
            orientation = xmgOrientationMode.LandscapeLeft;
        }
        if (deviceOrientation == DeviceOrientation.LandscapeLeft)
        {
            orientation = xmgOrientationMode.LandscapeRight;
        }
        if (deviceOrientation == DeviceOrientation.PortraitUpsideDown)
        {
            orientation = xmgOrientationMode.Portrait;
        }
        if (!isFrontalCamera && deviceOrientation == DeviceOrientation.LandscapeRight)
        {
            orientation = xmgOrientationMode.LandscapeRight;
        }
        if (!isFrontalCamera && deviceOrientation == DeviceOrientation.LandscapeLeft)
        {
            orientation = xmgOrientationMode.LandscapeLeft;
        }
#endif
        return(orientation);
    }