Forum Xamarin Xamarin.iOS

How can I set a timer to automatically take a picture using the MediaPlugin

This is basally what I want to do: The user taps a button, the camera comes on, a 5 second timer starts, they step back, center their face in the camera and the picture is taken automatically.

This is may camera code, this works but the user needs to push the camera button to take the picture. Thanks!

        var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
        {
            DefaultCamera = Plugin.Media.Abstractions.CameraDevice.Front,
            PhotoSize = Plugin.Media.Abstractions.PhotoSize.Small
        });

        if (file == null) return;

        byte[] imageAsBytes = null;
        using (var memoryStream = new MemoryStream())
        {
            file.GetStream().CopyTo(memoryStream);
            file.Dispose();
            imageAsBytes = memoryStream.ToArray();
        }
Tagged:

Answers

  • RalphShillingtonRalphShillington CAMember ✭✭

    I realize this question is rather stale, but I'm wondering if you ever got this to work. I have exactly the same requirement in my app.

  • vikDEVvikDEV INMember

    If you got any answer for that type of question then please let me know because i have same requirement in my app.
    Ralph Shillington and Bob H

  • joben12joben12 Member ✭✭

    any update on this one?, I have a similar requirement where in if the camera detects a text or a document it will take a photo.

Sign In or Register to comment.