MvvmCross picturechoosen plugin and camera problem

Hi, I had a strange problem with the picturewoser MvvmCross plugin for iOS development using Xamarin. I am developing a form where the user can select / take several photos and videos.

My application allows users to add multiple photos either from a camera roll or for recording directly from a form.

To capture the video, I use the Xamarin.Mobile api .

I am using the MvvmCross image selected for this. The problem occurs when 1 or 2 images / videos are taken with the camera.

As soon as 1 or 2 images / videos are captured, when the camera screen is entered a third time, the image will be static and will not refresh the camera finder. The view was stuck in the last frame of what was last recorded.

I have the same problem here , but the only difference is that I used the selected image MvvmCross plugin .

in my code that I used to bind the command using my button:

// 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 opinion, the 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 someone visit me what I'm doing wrong?

0
source share
1 answer
+2

All Articles