question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Proposal] CameraView

See original GitHub issue

CameraView

  • Proposed
  • Prototype: Not Started
  • Implementation: Not Started
    • iOS Support
    • Android Support
    • macOS Support
    • Windows Support
  • Unit Tests: Not Started
  • Sample: Not Started
  • Documentation: Not Started

Summary

The CameraView control enables the user to display a preview of the camera output. In addition, it can take photos or record videos. The CameraView also offers the options you would expect to support taking photos and recording videos such as turning the flash on or off, saving the captured media to a file, and offering different hooks for events

Detailed Design

CameraView.shared.cs

public class CameraView : View
{
  public static readonly BindableProperty IsBusyProperty;
  public static readonly BindableProperty IsAvailableProperty;
  public static readonly BindableProperty CameraOptionsProperty;
  public static readonly BindableProperty CaptureModeProperty;
  public static readonly BindableProperty VideoStabilizationProperty;
  public static readonly BindableProperty FlashModeProperty;
  public static readonly BindableProperty ZoomProperty;
  public static readonly BindableProperty MaxZoomProperty;
  
  public event EventHandler<bool>? OnAvailable;
  public event EventHandler<MediaCapturedEventArgs>? MediaCaptured;
  public event EventHandler<string>? MediaCaptureFailed;
  
  public ICommand? ShutterCommand { get; }
  
  public bool IsBusy { get; set; }
  public bool IsAvailable { get; set; }
  public CameraOptions CameraOptions { get; set; }
  public CameraCaptureMode CaptureMode { get; set; }
  public bool VideoStabilization { get; set; }
  public CameraFlashMode FlashMode { get; set; }
  public double Zoom { get; set; }
  public double MaxZoom { get; set; }
  
  public void Shutter();
}

Usage Syntax

XAML Usage

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
             x:Class="MyLittleApp.MainPage">

     <StackLayout>

        <xct:CameraView
                x:Name="cameraView"
                CaptureMode="Video"
                FlashMode="On"
                MediaCaptured="CameraView_MediaCaptured"
                HorizontalOptions="FillAndExpand"
                VerticalOptions="FillAndExpand" />

    </StackLayout>

</ContentPage>

C# Usage

class MyPage : ContentPage
{
  public MyPage()
  {
    Content = new CameraView
    {
      CaptureMode = CameraCaptureMode.Video,
      FlashMode = CameraFlashMode.Off,
    }.FillAndExpand()
     .Invoke(cameraView => cameraView.MediaCaptured += HandleMediaCaptured);
  }

  void HandleMediaCaptured(object? sender, MediaCapturedEventArgs e)
  {
    //...
  }
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:6
  • Comments:15 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
pictoscommented, Oct 13, 2021

I would say to have a separate project focused in barcode scanning where we will have the zxing package and that package has a dependency on MCT.CameraView. That way we avoid code duplication and add a dependency here. Thoughts?

2reactions
jfversluiscommented, Sep 29, 2021

We might want to check this with @Redth who has https://github.com/Redth/BigIslandBarcoding/tree/refactor-cameraview with a CameraView and additional barcode scanning (latter in a separate package) he wishes to donate

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tips for Capturing Your Proposal on Camera
If you are planning to propose to your girlfriend and want to capture it on camera, here are tips on how to get...
Read more >
Eiffel Tower proposal caught on camera! - YouTube
... up there we saw an Eiffel Tower proposal, which I caught on camera ! ... If you like marriage proposal videos, then...
Read more >
Camera proposal for Houston County school bathrooms
For more News, Weather, and Sports in the Wiregrass visit: https://www.wdhn.com.
Read more >
ENGAGED! Trail camera proposal video - YouTube
Youtube family, Adam and I are engaged! He captured it on his hunting trail camera...genius! Who's ready for wedding planning videos?
Read more >
VIDEO: Eiffel Tower proposal caught on camera!
VIDEO: Eiffel Tower proposal caught on camera! ... If you like marriage proposal videos, then this vlog might just be for you!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found