Exemplo n.º 1
0
        protected override void OnResume()
        {
            base.OnResume();

            // ARCore requires camera permissions to operate. If we did not yet obtain runtime
            // permission on Android M and above, now is a good time to ask the user for it.
            if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.Camera) == Android.Content.PM.Permission.Granted)
            {
                if (arSession != null)
                {
                    ShowLoadingMessage();
                    // Note that order matters - see the note in onPause(), the reverse applies here.
                    arSession.Resume();
                }

                displayRotationHelper.OnResume();
                glSurfaceView.OnResume();

                if (webRtcClient is null)
                {
                    webRtcClient = new WebRtcClient(this, remoteVideoSurface, null, this, this);
                }

                if (virtualStudioConnection is null || virtualStudioConnection.ConnectionState == HubConnectionState.Disconnected)
                {
                    _ = ConnectToServer();
                }
            }
            else
            {
                ActivityCompat.RequestPermissions(this, new string[] { Android.Manifest.Permission.Camera }, 1);
            }
        }
        protected override void OnResume()
        {
            base.OnResume();

            // ARCore requires camera permissions to operate. If we did not yet obtain runtime
            // permission on Android M and above, now is a good time to ask the user for it.
            if (ContextCompat.CheckSelfPermission(this, Android.Manifest.Permission.Camera) == Android.Content.PM.Permission.Granted)
            {
                if (mSession != null)
                {
                    showLoadingMessage();
                    // Note that order matters - see the note in onPause(), the reverse applies here.
                    mSession.Resume();
                }

                // the app may crash here because of a race condition if you've not YET accepted camera
                // permissions. just accept the permissions, and then when the app crashes, restart it,
                // and it should be fine.
                mSurfaceView.OnResume();
                mDisplayRotationHelper.OnResume();
            }
            else
            {
                ActivityCompat.RequestPermissions(this, new string[] { Android.Manifest.Permission.Camera }, 0);
            }
        }
Exemplo n.º 3
0
 protected override void OnResume()
 {
     base.OnResume();
     // The following call resumes a paused rendering thread.
     // If you de-allocated graphic objects for onPause()
     // this is a good place to re-allocate them.
     mGLView.OnResume();
 }
Exemplo n.º 4
0
        protected override void OnResume()
        {
            base.OnResume();

#if OPENGLES
            glSurfaceView.OnResume();
#endif
        }
Exemplo n.º 5
0
        protected override void OnResume()
        {
            Log.Debug(TAG, "OnResume");
            base.OnResume();
            mDisplayRotationManager.RegisterDisplayListener();
            Exception exception = null;

            message = null;
            if (mArSession == null)
            {
                try
                {
                    if (!ArEngineAbilityCheck())
                    {
                        Finish();
                        return;
                    }
                    mArSession = new ARSession(this);
                    mArConfig  = new ARFaceTrackingConfig(mArSession);

                    mArConfig.SetPowerMode(ARConfigBase.PowerMode.PowerSaving);

                    if (isOpenCameraOutside)
                    {
                        mArConfig.SetImageInputMode(ARConfigBase.ImageInputMode.ExternalInputAll);
                    }
                    mArSession.Configure(mArConfig);
                }
                catch (Exception capturedException)
                {
                    exception = capturedException;
                    SetMessageWhenError(capturedException);
                }
                if (message != null)
                {
                    StopArSession(exception);
                    return;
                }
            }
            try
            {
                mArSession.Resume();
            }
            catch (ARCameraNotAvailableException e)
            {
                Toast.MakeText(this, "Camera open failed, please restart the app", ToastLength.Short).Show();
                mArSession = null;
                return;
            }
            mDisplayRotationManager.RegisterDisplayListener();
            SetCamera();
            mFaceRenderManager.SetArSession(mArSession);
            mFaceRenderManager.SetOpenCameraOutsideFlag(isOpenCameraOutside);
            mFaceRenderManager.SetTextureId(textureId);
            glSurfaceView.OnResume();
        }
Exemplo n.º 6
0
        protected override void OnResume()
        {
            base.OnResume();

            now = SystemTime.Now;
            view.OnResume();

            Music.Instance.Resume();
            Sample.Instance.Resume();
        }
Exemplo n.º 7
0
 protected override void OnResume()
 {
     base.OnResume();
     try{
         _glView.OnResume();
         _wakeLock.Acquire();
     }
     catch {
     }
 }
        protected override void OnResume()
        {
            Log.Debug(TAG, "onResume");
            base.OnResume();
            Exception exception = null;

            message = null;
            if (mArSession == null)
            {
                try
                {
                    if (!ArEngineAbilityCheck())
                    {
                        Finish();
                        return;
                    }
                    mArSession = new ARSession(this);
                    ARBodyTrackingConfig config = new ARBodyTrackingConfig(mArSession);
                    config.EnableItem = ARConfigBase.EnableDepth | ARConfigBase.EnableMask;
                    mArSession.Configure(config);
                    mBodyRenderManager.SetArSession(mArSession);
                }
                catch (Exception capturedException)
                {
                    exception = capturedException;
                    SetMessageWhenError(capturedException);
                }
                if (message != null)
                {
                    Toast.MakeText(this, message, ToastLength.Long).Show();
                    Log.Debug(TAG, "Creating session" + exception.Message);
                    if (mArSession != null)
                    {
                        mArSession.Stop();
                        mArSession = null;
                    }
                    return;
                }
            }
            try
            {
                mArSession.Resume();
            }
            catch (ARCameraNotAvailableException e)
            {
                Toast.MakeText(this, "Camera open failed, please restart the app", ToastLength.Long).Show();
                mArSession = null;
                return;
            }
            mSurfaceView.OnResume();
            mDisplayRotationManager.RegisterDisplayListener();
        }
Exemplo n.º 9
0
        protected override void OnResume()
        {
            Log.Debug(TAG, "OnResume");
            base.OnResume();
            Exception exception = null;

            message = null;
            if (mArSession == null)
            {
                try
                {
                    if (!ArEngineAbilityCheck())
                    {
                        Finish();
                        return;
                    }
                    mArSession = new ARSession(this);
                    ARHandTrackingConfig config = new ARHandTrackingConfig(mArSession);
                    config.CameraLensFacing = ARConfigBase.CameraLensFacing.Front;
                    config.SetPowerMode(ARConfigBase.PowerMode.UltraPowerSaving);

                    long item = ARConfigBase.EnableDepth;
                    config.EnableItem = item;
                    mArSession.Configure(config);
                    mHandRenderManager.SetArSession(mArSession);
                    Log.Debug(TAG, "Item = " + config.EnableItem);
                }
                catch (Exception capturedException)
                {
                    exception = capturedException;
                    SetMessageWhenError(capturedException);
                }
                if (message != null)
                {
                    StopArSession(exception);
                    return;
                }
            }
            try
            {
                mArSession.Resume();
            }
            catch (ARCameraNotAvailableException e)
            {
                Toast.MakeText(this, "Camera open failed, please restart the app", ToastLength.Long).Show();
                mArSession = null;
                return;
            }
            mDisplayRotationManager.RegisterDisplayListener();
            mSurfaceView.OnResume();
        }
Exemplo n.º 10
0
        protected override void OnResume()
        {
            Log.Debug(TAG, "OnResume");
            base.OnResume();
            Exception exception = null;

            message = null;
            if (mArSession == null)
            {
                try
                {
                    if (!ArEngineAbilityCheck())
                    {
                        Finish();
                        return;
                    }
                    mArSession = new ARSession(this);
                    ARWorldTrackingConfig config = new ARWorldTrackingConfig(mArSession);
                    config.SetFocusMode(ARConfigBase.FocusMode.AutoFocus);
                    config.SemanticMode = (ARWorldTrackingConfig.SemanticPlane);
                    mArSession.Configure(config);
                    mWorldRenderManager.SetArSession(mArSession);
                }
                catch (Exception capturedException)
                {
                    exception = capturedException;
                    SetMessageWhenError(capturedException);
                }
                if (message != null)
                {
                    StopArSession(exception);
                    return;
                }
            }
            try
            {
                mArSession.Resume();
            }
            catch (ARCameraNotAvailableException e)
            {
                Toast.MakeText(this, "Camera open failed, please restart the app", ToastLength.Long).Show();
                mArSession = null;
                return;
            }
            mDisplayRotationManager.RegisterDisplayListener();
            mSurfaceView.OnResume();
        }
Exemplo n.º 11
0
 protected override void OnResume()
 {
     base.OnResume();
     // ARCore requires camera permissions to operate. If we did not yet obtain runtime
     // permission on Android M and above, now is a good time to ask the user for it.
     if (CameraPermissionHelper.HasCameraPermission(this))
     {
         ShowLoadingMessage();
         // Note that order matters - see the note in onPause(), the reverse applies here.
         mSession.Resume(mDefaultConfig);
         mSurfaceView.OnResume();
     }
     else
     {
         CameraPermissionHelper.RequestCameraPermission(this);
     }
 }
Exemplo n.º 12
0
        protected override void OnResume()
        {
            base.OnResume();

            // ARCore requires camera permissions to operate. If we did not yet obtain runtime
            // permission on Android M and above, now is a good time to ask the user for it.
            if (ContextCompat.CheckSelfPermission(this, Android.Manifest.Permission.Camera) == Android.Content.PM.Permission.Granted)
            {
                showLoadingMessage();
                // Note that order matters - see the note in onPause(), the reverse applies here.
                mSession.Resume(mDefaultConfig);
                mSurfaceView.OnResume();
            }
            else
            {
                ActivityCompat.RequestPermissions(this, new string[] { Android.Manifest.Permission.Camera }, 0);
            }
        }
Exemplo n.º 13
0
 protected override void OnResume()
 {
     base.OnResume();
     _GLSurfaceView.OnResume();
 }
Exemplo n.º 14
0
 protected override void OnResume()
 {
     base.OnResume();
     glView.OnResume();
 }