You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `CameraView` provides the ability to programmatically start the preview from the camera. This is possible through both the `StartCameraPreview` method or the `StartCameraPreviewCommand`.
@@ -462,6 +496,30 @@ The following example shows how to add a `Button` into the application and setup
462
496
</ContentPage>
463
497
```
464
498
499
+
The following example demonstrates how to use the `StartCameraPreview` method:
500
+
501
+
> [!NOTE]
502
+
> The C# code below uses the Camera field defined above in XAML (`<toolkit:CameraView x:Name="Camera" />`)
The `CameraView` provides the ability to programmatically stop the preview from the camera. This is possible through both the `StopCameraPreview` method or the `StopCameraPreviewCommand`.
@@ -530,6 +588,28 @@ The following example shows how to add a `Button` into the application and setup
530
588
</ContentPage>
531
589
```
532
590
591
+
The following example demonstrates how to use the `StopCameraPreview` method:
592
+
593
+
> [!NOTE]
594
+
> The C# code below uses the Camera field defined above in XAML (`<toolkit:CameraView x:Name="Camera" />`)
// Use the Camera field defined above in XAML (`<toolkit:CameraView x:Name="Camera" />`)
603
+
Camera.StopCameraPreview();
604
+
}
605
+
catch(Exceptione)
606
+
{
607
+
// Handle Exception
608
+
Trace.WriteLine(e);
609
+
}
610
+
}
611
+
```
612
+
533
613
## Examples
534
614
535
615
You can find an example of this feature in action in the [.NET MAUI Community Toolkit Sample Application](https://github.com/CommunityToolkit/Maui/blob/main/samples/CommunityToolkit.Maui.Sample/Pages/Views/CameraView/CameraViewPage.xaml.cs).
0 commit comments