Hi I'm experiencing a strange problem with a MvvmCross picturechooser plugin for iOS development using Xamarin. I am developing a form where user can choose/take multiple photos and a video.
My app allow users to add multiple photos either from the camera roll or to be captured directly from form.
For capturing video, i use Xamarin.Mobile api.
I'm using the MvvmCross picture choosen to do this. The problem occurs when 1 or 2 images / videos are taken with the camera.
Once 1 or 2 images / videos are captured when the camera screen is re-entered for a third time the image is static and doesn't update the camera view finder. The view is stuck at the last frame of whatever was captured last.
I have the same problem described here but only difference is that I used MvvmCross picture choosen plugin.
in my code i used to bind the command with my button as follow:
// MyView is inherited from MvxViewController (of mvvmcross)
var set = this.CreateBinding<MyView,MyViewModel>();
//Binding button to picture chooser command
set.Bind(this.TakePhotoButton).To(vm=>vm.TakePictureCommand);
and in my view model:
public MvxCommand TakePictureCommand
{
get
{
this.takePictureCommand => this.takePictureCommand ?? new MvxCommand(()=>
this.pictureChooserTask.TakePicture(300,95,this.OnPictureSelected,
()=>{}),,this.CanTakeOrChoosePicture);
}
}
private void OnPictureSelected(Stream stream)
{
using(var memoryStream = new MemoryStream())
{
stream.CopyTo(memoryStream);
// PictureBytes is a property which i am using to bind with image view
this.PictureBytes= memoryStream.ToArray();
}
}
private bool CanTakeOrChoosePicture()
{
return this.PictureBytes= null;
}
can any one guide me what am i doing wrong?