With the code below, I started the camera app and took a picture, but once I took a picture, the app closed. What should I do when taking multiple shots?
private async void OnImageClicked() { try { await Plugin.Media.CrossMedia.Current.Initialize(); if (!Plugin.Media.CrossMedia.Current.IsCameraAvailable || !Plugin.Media.CrossMedia.Current.IsTakePhotoSupported) { return; } DateTime dt = DateTime.Now; string result = dt.ToString("yyyyMMddHHmmss"); result += ".jpg"; var file = await Plugin.Media.CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions { Name = result }); if (file == null) return; var bytes = new Queue<byte>(); using (var s = file.GetStream()) { var length = s.Length; int b; while ((b = s.ReadByte()) != -1) bytes.Enqueue((byte)b); } File.Copy(file.Path, "/Pic"); PicPoint.Add(result); file.Dispose(); } catch (Exception) { } }
Answers
Xam.Plugin.Media do not have take multiple shots function, you can open an feature request in following url.
https://github.com/jamesmontemagno/MediaPlugin/issues
You can execute the TakePhotoAsync multiple times like following code like this thread.
https://forums.xamarin.com/discussion/104140/how-to-take-multiple-pictures-using-camera-in-xamarin-ios
@Techno_Develop Are there any update for this issue, please reply is helpful, please click the
Yes
tab under the helpful answer.Xamarin forums are migrating to a new home on Microsoft Q&A!
We invite you to post new questions in the Xamarin forums’ new home on Microsoft Q&A!
For more information, please refer to this sticky post.