Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

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

$
0
0

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();
        }

Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>