Esempio n. 1
0
    public void StartRec(string outputName, Callback OnRecordingComplete)
    {
                #if UNITY_IOS && !UNITY_EDITOR
        if (MergeIOSBridge.CheckPhoto() != 1)
        {
            return;
        }
                #endif
                #if UNITY_ANDROID && !UNITY_EDITOR
        if (!MergeAndroidBridge.HasPermission(AndroidPermission.WRITE_EXTERNAL_STORAGE))
        {
            return;
        }
        if (!MergeAndroidBridge.HasPermission(AndroidPermission.RECORD_AUDIO))
        {
            return;
        }
                #endif
        if (!isInitialized)
        {
            return;
        }

        if (!isRecording)
        {
            StartCoroutine(StartRecAction(outputName, OnRecordingComplete));
        }
    }
Esempio n. 2
0
 void Update()
 {
     if (Temp_CheckCamera)
     {
                         #if UNITY_IOS && !UNITY_EDITOR
         proceed = MergeIOSBridge.CheckCamera();
                         #endif
                         #if UNITY_ANDROID && !UNITY_EDITOR
         proceed = MergeAndroidBridge.HasPermission(AndroidPermission.CAMERA);
                         #endif
     }
 }
Esempio n. 3
0
        public void InitVuforia()
        {
            bool shouldStart = true;

                        #if UNITY_IOS && !UNITY_EDITOR
            shouldStart = MergeIOSBridge.CheckCamera();
                        #endif
                        #if UNITY_ANDROID && !UNITY_EDITOR
            shouldStart = MergeAndroidBridge.HasPermission(AndroidPermission.CAMERA);
                        #endif
            if (shouldStart && !vuforiaInited)
            {
                vuforiaInited = true;
                VuforiaRuntime.Instance.InitVuforia();
                StartCoroutine(InitVuforiaCamera());
            }
        }
Esempio n. 4
0
    public void ToggleRecording()
    {
                #if SHOULD_USE_RECORDING_PLUGIN
        if (!isRecording)
        {
                        #if UNITY_IOS && !UNITY_EDITOR
            if (MergeIOSBridge.CheckPhoto() == 2)
            {
                MergeIOSBridge.RequestPhoto();
                return;
            }
            else if (MergeIOSBridge.CheckPhoto() != 1)
            {
                MergeIOSBridge.OpenPhotoSettings();
                return;
            }
                        #endif
                        #if UNITY_ANDROID && !UNITY_EDITOR
            if (!MergeAndroidBridge.HasPermission(AndroidPermission.WRITE_EXTERNAL_STORAGE))
            {
                MergeAndroidBridge.CheckPermissionAndReDirectToSettingsScreen(AndroidPermission.READ_EXTERNAL_STORAGE);
                return;
            }
            if (!MergeAndroidBridge.HasPermission(AndroidPermission.RECORD_AUDIO))
            {
                MergeAndroidBridge.CheckPermissionAndReDirectToSettingsScreen(AndroidPermission.RECORD_AUDIO);
                return;
            }
                        #endif

            StartRec(System.DateTime.Now.Day.ToString() + "_" + System.DateTime.Now.Month.ToString() + "_" +
                     System.DateTime.Now.Year.ToString() + "_" + System.DateTime.Now.Hour.ToString() + "_" + System.DateTime.Now.Minute.ToString(), HandleRecSaveComplete);
        }
        else
        {
//			Debug.LogWarning("Should Stop Recording.");

            StopRec();

//			Debug.LogWarning("Should Set Recording to False.");
        }
                #endif
    }
Esempio n. 5
0
    public void ToggleRecording()
    {
                #if SHOULD_USE_RECORDING_PLUGIN
        if (isBusy)
        {
            return;
        }

        CancelInvoke("ResetBusyStatus");
        CancelInvoke("ToggleRecording");

        if (!isRecording)
        {
                        #if UNITY_IOS && !UNITY_EDITOR
            if (MergeIOSBridge.CheckPhoto() == 2)
            {
                MergeIOSBridge.RequestPhoto();
                return;
            }
            else if (MergeIOSBridge.CheckPhoto() != 1)
            {
                MergeIOSBridge.OpenPhotoSettings();
                return;
            }
                        #endif
                        #if UNITY_ANDROID && !UNITY_EDITOR
            if (!MergeAndroidBridge.HasPermission(AndroidPermission.WRITE_EXTERNAL_STORAGE))
            {
                MergeAndroidBridge.CheckPermissionAndReDirectToSettingsScreen(AndroidPermission.READ_EXTERNAL_STORAGE);
                return;
            }
            if (!MergeAndroidBridge.HasPermission(AndroidPermission.RECORD_AUDIO))
            {
                MergeAndroidBridge.CheckPermissionAndReDirectToSettingsScreen(AndroidPermission.RECORD_AUDIO);
                return;
            }
                        #endif

            StartRec(System.DateTime.Now.Day.ToString() + "_" + System.DateTime.Now.Month.ToString() + "_" +
                     System.DateTime.Now.Year.ToString() + "_" + System.DateTime.Now.Hour.ToString() + "_" + System.DateTime.Now.Minute.ToString(), null);

//			RecordingButton.gameObject.SetActive( false );
            timer.StartTimer();
            isBusy = true;

            Invoke("ResetBusyStatus", 3f);

            //Stop recording after 30 seconds if still running.
            Invoke("ToggleRecording", 30f);
        }
        else
        {
//			Debug.LogWarning("Should Stop Recording.");

//			RecordingButton.gameObject.SetActive( true );
            timer.StopTimer();
            isBusy = true;
            StopRec();

//			Debug.LogWarning("Should Set Recording to False.");
        }
                #endif
    }
Esempio n. 6
0
        IEnumerator Processing()
        {
//			MergeUserAccount.instance.PermissionPause (true);

            proceed = false;
//			#if UNITY_IOS || UNITY_ANDROID
            if (cameraAccessPop)
            {
                bool isCameraPermit = false;
                                #if UNITY_IOS && !UNITY_EDITOR
                isCameraPermit = MergeIOSBridge.CheckCamera();
                                #endif
                                #if UNITY_ANDROID && !UNITY_EDITOR
                isCameraPermit = MergeAndroidBridge.HasPermission(AndroidPermission.CAMERA);
                                #endif
                if (!isCameraPermit)
                {
//					Debug.LogWarning( "Should Do First Cam" );
                    Page_CameraAccess.gameObject.SetActive(true);
                    Page_CameraAccess.doneButton += Btn_DoneAction;
                    yield return(new WaitUntil(() => proceed));

                    Page_CameraAccess.doneButton -= Btn_DoneAction;
                    proceed = false;
                                        #if UNITY_IOS && !UNITY_EDITOR
                    MergeIOSBridge.RequestCamera();
                    yield return(new WaitUntil(() => isPopPause));
                                        #endif
                                        #if UNITY_ANDROID && !UNITY_EDITOR
                    MergeAndroidBridge.RequestPremission(AndroidPermission.CAMERA);
                    yield return(new WaitForSeconds(.1f));
                                        #endif
                                        #if !UNITY_EDITOR
                    yield return(new WaitUntil(() => !isPopPause));

                    yield return(new WaitForSeconds(.2f));
                                        #else
                    yield return(new WaitForSeconds(.5f));
                                        #endif
                    PlayerPrefs.SetString("MCSDK_cameraAccessPop", "done");
                    Page_CameraAccess.gameObject.SetActive(false);
                }
            }
                        #if UNITY_IOS && !UNITY_EDITOR
            cameraDisabledPop = !MergeIOSBridge.CheckCamera();
                        #endif
                        #if UNITY_ANDROID && !UNITY_EDITOR
            cameraDisabledPop = !MergeAndroidBridge.HasPermission(AndroidPermission.CAMERA);
                        #endif
                        #if  !UNITY_EDITOR
            if (cameraDisabledPop)
            {
                Debug.LogWarning("Should Do Cam Disabled");
                Page_CameraDisabled.gameObject.SetActive(true);
                Page_CameraDisabled.doneButton += OpenPhoneSetting;
                Temp_CheckCamera = true;
                yield return(new WaitUntil(() => proceed));

                Temp_CheckCamera = false;
                Page_CameraDisabled.doneButton -= OpenPhoneSetting;
                proceed = false;
                yield return(null);

                Page_CameraDisabled.gameObject.SetActive(false);
            }
                        #endif

                        #if UNITY_IOS && !UNITY_EDITOR
            int photoState = MergeIOSBridge.CheckPhoto();
            if (photoState == 2)
            {
                photoAccessPop = true;
            }
            else
            {
                photoAccessPop = false;
            }
                        #endif
                        #if UNITY_ANDROID && !UNITY_EDITOR
            if (MergeAndroidBridge.WasDeniedOnce(AndroidPermission.READ_EXTERNAL_STORAGE))
            {
                photoAccessPop = false;
            }
            else
            {
                photoAccessPop = !MergeAndroidBridge.HasPermission(AndroidPermission.READ_EXTERNAL_STORAGE);
            }
                        #endif
            if (photoAccessPop)
            {
                skip    = false;
                proceed = false;
//				Debug.LogWarning( "Should Do Photo" );
                //pop Cam
                Page_PhotoAccess.gameObject.SetActive(true);
                Page_PhotoAccess.doneButton   += Btn_DoneAction;
                Page_PhotoAccess.actionButton += SkipAction;
                Invoke("EnablePhotoSkip", 3f);
                yield return(new WaitUntil(() => (proceed || skip)));

                CancelInvoke("EnablePhotoSkip");
                proceed = false;
                if (!skip)
                {
                                        #if UNITY_IOS && !UNITY_EDITOR
                    MergeIOSBridge.RequestPhoto();
                    yield return(new WaitUntil(() => isPopPause));
                                        #endif
                                        #if UNITY_ANDROID && !UNITY_EDITOR
                    MergeAndroidBridge.RequestPremission(AndroidPermission.READ_EXTERNAL_STORAGE);
                    yield return(new WaitForSeconds(.1f));
                                        #endif

                                        #if !UNITY_EDITOR
                    yield return(new WaitUntil(() => !isPopPause));

                    yield return(new WaitForSeconds(.2f));
                                        #else
                    yield return(new WaitForSeconds(.5f));
                                        #endif
                }
                if (!skip)
                {
                                        #if UNITY_IOS && !UNITY_EDITOR
                    //currently Do nothing since not recording Mic.
                                        #endif
                                        #if UNITY_ANDROID && !UNITY_EDITOR
                    MergeAndroidBridge.RequestPremission(AndroidPermission.RECORD_AUDIO);
                    yield return(new WaitForSeconds(.1f));
                                        #endif

                                        #if !UNITY_EDITOR
                    yield return(new WaitUntil(() => !isPopPause));

                    yield return(new WaitForSeconds(.2f));
                                        #endif
                }
                Page_PhotoAccess.doneButton   -= Btn_DoneAction;
                Page_PhotoAccess.actionButton -= SkipAction;
                PlayerPrefs.SetString("MCSDK_photoAccessPop", "done");
                Page_PhotoAccess.gameObject.SetActive(false);
            }
//			if ( MergeUserAccount.instance.conf.userSignInActive && ( Application.internetReachability != NetworkReachability.NotReachable ) )
//			{
//				if ( MergeUserAccount.instance.ShouldOpenSignInPage )
//				{
//					skip = false;
//					proceed = false;
//					if ( PlayerPrefs.GetString( "UserAccountActionBtn" ) != "" )
//					{
//						userAccountSkipBtn.SetActive( true );
//					}
//					Debug.LogWarning( "Should Do User Account" );
//					Page_UserAccount.gameObject.SetActive( true );
//					Page_UserAccount.doneButton += Btn_DoneAction;
//					Page_UserAccount.actionButton += SkipAction;
//					yield return new WaitUntil( () => ( proceed || skip ) );
//					proceed = false;
//					if ( !skip )
//					{
//						MergeUserAccount.instance.signInClose += Btn_DoneAction;
//						MergeUserAccount.instance.PopSignIn();
//						yield return new WaitUntil( () => proceed );
//						MergeUserAccount.instance.signInClose -= Btn_DoneAction;
//						yield return new WaitForSeconds( .25f );
//					}
//					Page_UserAccount.doneButton -= Btn_DoneAction;
//					Page_UserAccount.actionButton -= SkipAction;
//					Page_UserAccount.gameObject.SetActive( false );
//					PlayerPrefs.SetString( "UserAccountActionBtn", "done" );
//				}
//			}
//			#endif
//			Debug.LogWarning( "All If Done" );
//			MergeUserAccount.instance.PermissionPause( false );
            DoneProcess();
            PlayerPrefs.Save();
            MergeCubeSDK.instance.InitVuforia();

            yield return(null);
        }
        IEnumerator Processing()
        {
            proceed = false;
            if (cameraAccessPop)
            {
                bool isCameraPermit = false;
                                #if UNITY_IOS && !UNITY_EDITOR
                isCameraPermit = MergeIOSBridge.CheckCamera();
                                #endif
                                #if UNITY_ANDROID && !UNITY_EDITOR
                isCameraPermit = MergeAndroidBridge.HasPermission(AndroidPermission.CAMERA);
                                #endif
                if (!isCameraPermit)
                {
//					Debug.LogWarning ("Should Do First Cam");
                    Page_CameraAccess.gameObject.SetActive(true);
                    Page_CameraAccess.doneButton += Btn_DoneAction;
                    yield return(new WaitUntil(() => proceed));

                    Page_CameraAccess.doneButton -= Btn_DoneAction;
                    proceed = false;
                                        #if UNITY_IOS && !UNITY_EDITOR
                    MergeIOSBridge.RequestCamera();
                    yield return(new WaitUntil(() => isPopPause));
                                        #endif
                                        #if UNITY_ANDROID && !UNITY_EDITOR
                    MergeAndroidBridge.RequestPremission(AndroidPermission.CAMERA);
                    yield return(new WaitForSeconds(.1f));
                                        #endif
                                        #if !UNITY_EDITOR
                    yield return(new WaitUntil(() => !isPopPause));

                    yield return(new WaitForSeconds(.2f));
                                        #else
                    yield return(new WaitForSeconds(.5f));
                                        #endif

                    PlayerPrefs.SetString("MCSDK_cameraAccessPop", "done");
                    Page_CameraAccess.gameObject.SetActive(false);
                }
            }
                        #if UNITY_IOS && !UNITY_EDITOR
            cameraDisabledPop = !MergeIOSBridge.CheckCamera();
                        #endif
                        #if UNITY_ANDROID && !UNITY_EDITOR
            cameraDisabledPop = !MergeAndroidBridge.HasPermission(AndroidPermission.CAMERA);
                        #endif
                        #if  !UNITY_EDITOR
            if (cameraDisabledPop)
            {
//				Debug.LogWarning ("Should Do Cam Disabled");
                Page_CameraDisabled.gameObject.SetActive(true);
                Page_CameraDisabled.doneButton += OpenPhoneSetting;
                Temp_CheckCamera = true;
                yield return(new WaitUntil(() => proceed));

                Temp_CheckCamera = false;
                Page_CameraDisabled.doneButton -= OpenPhoneSetting;
                proceed = false;
                yield return(null);

                Page_CameraDisabled.gameObject.SetActive(false);
            }
                        #endif

                        #if UNITY_IOS && !UNITY_EDITOR
            int photoState = MergeIOSBridge.CheckPhoto();
            if (photoState == 2)
            {
                photoAccessPop = true;
            }
            else
            {
                photoAccessPop = false;
            }
                        #endif
                        #if UNITY_ANDROID && !UNITY_EDITOR
            if (MergeAndroidBridge.WasDeniedOnce(AndroidPermission.READ_EXTERNAL_STORAGE))
            {
                photoAccessPop = false;
            }
            else
            {
                photoAccessPop = !MergeAndroidBridge.HasPermission(AndroidPermission.READ_EXTERNAL_STORAGE);
            }
                        #endif
            if (photoAccessPop)
            {
                skip    = false;
                proceed = false;
//				Debug.LogWarning ("Should Do Photo");
                //pop Cam
                Page_PhotoAccess.gameObject.SetActive(true);
                Page_PhotoAccess.doneButton   += Btn_DoneAction;
                Page_PhotoAccess.actionButton += SkipAction;
                yield return(new WaitUntil(() => (proceed || skip)));

                proceed = false;
                if (!skip)
                {
                                        #if UNITY_IOS && !UNITY_EDITOR
                    MergeIOSBridge.RequestPhoto();
                    yield return(new WaitUntil(() => isPopPause));
                                        #endif
                                        #if UNITY_ANDROID && !UNITY_EDITOR
                    MergeAndroidBridge.RequestPremission(AndroidPermission.READ_EXTERNAL_STORAGE);
                    yield return(new WaitForSeconds(.1f));
                                        #endif

                                        #if !UNITY_EDITOR
                    yield return(new WaitUntil(() => !isPopPause));

                    yield return(new WaitForSeconds(.2f));
                                        #else
                    yield return(new WaitForSeconds(.5f));
                                        #endif
                }
                if (!skip)
                {
                                        #if UNITY_IOS && !UNITY_EDITOR
                    //currently Do nothing since not recording Mic.
                                        #endif
                                        #if UNITY_ANDROID && !UNITY_EDITOR
                    MergeAndroidBridge.RequestPremission(AndroidPermission.RECORD_AUDIO);
                    yield return(new WaitForSeconds(.1f));
                                        #endif

                                        #if !UNITY_EDITOR
                    yield return(new WaitUntil(() => !isPopPause));

                    yield return(new WaitForSeconds(.2f));
                                        #endif
                }
                Page_PhotoAccess.doneButton   -= Btn_DoneAction;
                Page_PhotoAccess.actionButton -= SkipAction;
                PlayerPrefs.SetString("MCSDK_photoAccessPop", "done");
                Page_PhotoAccess.gameObject.SetActive(false);
            }
//			Debug.LogWarning ("All If Done");

            DoneProcess();
            PlayerPrefs.Save();
            MergeCubeSDK.instance.InitVuforia();
            yield return(null);
        }