Forum Libraries, Components, and Plugins
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Open android gallery to select photos and videos

I have to make an application that allows the user to upload photos or videos.

I am using this library: https://www.nuget.org/packages/Xam.Plugin.Media

This library allows you to open the gallery in photo selection mode
await CrossMedia.Current.PickPhotoAsync();

This library allows you to open the gallery in video selection mode
await CrossMedia.Current.PickVideoAsync();
Instead my client would like the gallery to be opened both for the selection of videos and photos as happens for whatsapp.

I would therefore need a more generic method of the type

await CrossMedia.Current.PickVideoAndPhotoAsync();//not exists
Do you think it is possible to do it?

Answers

  • JarvanJarvan Member, Xamarin Team Xamurai

    Instead my client would like the gallery to be opened both for the selection of videos and photos

    It's not available to do that with the nuget. The 'PickPhotoAsync' and 'PickVideoAsync' methods will pick a file from the default gallery, it doesn't support to change the path of picking files.

    /// <summary>
    /// Picks a photo from the default gallery
    /// </summary>
    /// <param name="options">Pick Photo Media Options</param>
    /// <returns>Media file or null if canceled</returns>
    Task<MediaFile> PickPhotoAsync(PickMediaOptions options = null);
    

    Check the link:
    https://github.com/jamesmontemagno/MediaPlugin#photos

Sign In or Register to comment.