Stop camera preview at ExercisingView
authorMarcin Romaniuk/Tizen Services M.romaniuk IoT (PLT) /SRPOL/Senior Designer/Samsung Electronics <m.romaniuk@samsung.com>
Wed, 28 Apr 2021 20:12:01 +0000 (22:12 +0200)
committerPiotr Czaja <p.czaja@samsung.com>
Tue, 14 Sep 2021 11:01:34 +0000 (13:01 +0200)
When page ExercisingView is popped from NavigationStack, camera preview is stopped when OnDisappearing method is called.

Fitness/Views/ExercisingView.xaml.cs

index 328d633731b61f5a91c3b5c9c9d3c1f58320fe03..06332aefbdb6cd4544e00f0a96c0fcf0a0fa4e81 100644 (file)
@@ -39,6 +39,17 @@ namespace Fitness.Views
             PlayingView.PreviewStub.Relayout += OnPlayingViewRelayout;
         }
 
+        /// <summary>
+        /// OnDisappearing.
+        /// </summary>
+        protected override void OnDisappearing()
+        {
+            if (cameraView.PreviewState == Tizen.Multimedia.CameraState.Preview)
+            {
+                cameraView.StopPreview();
+            }
+        }
+
         private static void OnIsPlayingChanged(BindableObject bindable, object oldValue, object newValue)
         {
             if (newValue is bool isPlaying && bindable is ExercisingView view)