Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.
This repository was archived by the owner on May 1, 2024. It is now read-only.

[F100] Camera View #1730

Closed
Closed
@rmarinho

Description

@rmarinho

Rationale

Forms does not currently contain a cross platform view which allows to use and preview the camera of the device it's running on. There are some issues to be answer still, should we support control or just a preview of the image.

Implementation.

Users should be able to choose front or rear camera and visualize the image.
Users should be able to show default controls or not.
User should be able to capture a image and use it on Xamarin.Forms
This will probably require a VideoSource class similar to the ImageSource class, with the appropriate subclasses (FileVideoSource, StreamVideoSource, UriVideoSource and their respective type converters), as talked on #1692 to Support video.

public class CameraView : View
{
	public event EventHandler<MediaCapturedEventArgs> MediaCaptured;
	public event EventHandler<EventArgs> MediaCaptureFailed;

	public static readonly BindableProperty ShutterButtonCommandProperty = BindableProperty.Create(nameof(ShutterButtonCommand), typeof(ICommand), typeof(CameraView), null);
	public ICommand ShutterButtonCommand
	{
		get { return (ICommand)GetValue(ShutterButtonCommandProperty); }
		set { SetValue(ShutterButtonCommandProperty, value); }
	}

	public static readonly BindableProperty CameraOptionsProperty = BindableProperty.Create(nameof(CameraOptions), typeof(CameraOptions), typeof(CameraView), CameraOptions.Default);

	public CameraOptions CameraOptions
	{
		get { return (CameraOptions)GetValue(CameraOptionsProperty); }
		set { SetValue(CameraOptionsProperty, value); }
	}

	public static readonly BindableProperty ControlsOptionsProperty = BindableProperty.Create(nameof(ControlsOptions), typeof(CameraControlsOptions), typeof(CameraView), CameraControlsOptions.Default);

	public CameraControlsOptions ControlsOptions
	{
		get { return (CameraControlsOptions)GetValue(ControlsOptionsProperty); }
		set { SetValue(ControlsOptionsProperty, value); }
	}

	public static readonly BindableProperty CaptureOptionsProperty = BindableProperty.Create(nameof(CaptureOptions), typeof(CameraCaptureOptions), typeof(CameraView), CameraCaptureOptions.Default);

	public CameraCaptureOptions CaptureOptions
	{
		get { return (CameraCaptureOptions)GetValue(CaptureOptionsProperty); }
		set { SetValue(CaptureOptionsProperty, value); }
	}

}

public class MediaCapturedEventArgs : EventArgs
{
	public object Data { get; set; }
	public ImageSource Image { get; set; }
       	public VideoSource Image { get; set; }
}

public enum CameraOptions
{
	Default,
	Rear,
	Front
}

public enum CameraControlsOptions
{
	Default,
	Visible,
	Hidden
}

public enum CameraCaptureOptions
{
	Default,
	Photo,
	Video,
	PhotoAndVideo
}

Expected Result

Android

iOS

UWP

Implications for CSS

None

Backward Compatibility

None

Difficulty: Hard

Metadata

Metadata

Assignees

No one assigned

    Labels

    F100community-sprinthelp wantedWe welcome community contributions to any issue, but these might be a good place to start!in-progressThis issue has an associated pull request that may resolve it!m/high impact ⬛proposal-acceptedroadmapt/enhancement ➕up-for-grabsWe welcome community contributions to any issue, but these might be a good place to start!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions