Xamarin.Forms.XLab Media picker on iOS is behaving differently

sudhir.9350sudhir.9350 INUniversity ✭✭


We are using MediaPicker from Xamarin.Forms.Lab to take photo or video in our app. It works fine in android. But in iOS it behave differently. Whenever we try to take(record) video, it always take Photo. since we are using Xamarin.Forms, so codebase is same for both platforms.

So can you please guide us on why it behave differently in iOS?

Thanks in advance.



  • rajatthakurrajatthakur USMember

    how are you using xamarin.forms.xlabs to define media element in forms page exactly ?

  • sudhir.9350sudhir.9350 INUniversity ✭✭
    edited July 2015

    @rajatthakur well, i used media picker from the library.

    private IMediaPicker _mediaPicker;
            protected virtual IMediaPicker MediaPicker
                    if (this._mediaPicker != null)
                        this._mediaPicker = null;
                    return this._mediaPicker = DependencyService.Get<IMediaPicker>();

    and then when i take video i used like this:

    var myOptions = new VideoMediaStorageOptions
                        DefaultCamera = CameraDevice.Rear,
                        MaxPixelDimension = 100,
                        DesiredLength = new TimeSpan(0, 0, 30),
                        Quality = VideoQuality.Low,
                        Name = "video1.mp4",
                        SaveMediaOnCapture = true
                    if (!this.MediaPicker.IsVideosSupported)
                        await DisplayAlert("Info", "Video is not supported on this device", "Ok");
                    _mediaFile = await this.MediaPicker.TakeVideoAsync(myOptions);

    and this is how i initialized in my app delegate.cs class in iOS

    private void SetIoc()
                var app = new XFormsAppiOS();
                var resolverContainer = new XLabs.Ioc.SimpleContainer();
                resolverContainer.Register<XLabs.Platform.Device.IDevice>(t => AppleDevice.CurrentDevice)
                    .Register<XLabs.Platform.Device.IDisplay>(t => t.Resolve<XLabs.Platform.Device.IDevice>().Display)
                    .Register<XLabs.Platform.Services.INetwork>(t=> t.Resolve<IDevice>().Network)
                    .Register<XLabs.Ioc.IDependencyContainer>(t => resolverContainer);
Sign In or Register to comment.