Get Image or Video

When you need to get an Image or a video from the device gallery, create and configure the AN_MediaPicker object. Based on what type of content you would like to pick, you may sue following constructors.

Allow only image files:

AN_MediaPicker picker = new AN_MediaPicker(AN_MediaType.Image);

Allow only video files:

AN_MediaPicker picker = new AN_MediaPicker(AN_MediaType.Video);

Allow image and video content:

AN_MediaPicker picker = new AN_MediaPicker(AN_MediaType.Image, AN_MediaType.Video);

The code snippet below will demonstrate option for a media picker configuration.

using SA.Android.Camera;

AN_MediaPicker picker = new AN_MediaPicker(AN_MediaType.Image);

/// Defines if multiple images picker is allowed.
/// The default falue is < c > false </ c >
picker.AllowMultiSelect = true;

/// Max thumbnail size that will be trsnafered to the Unity side.
/// The thumbnail will be resized before it sent.
/// The default falue is 512.
picker.MaxSize = 512;

/// Starts pick mdeia from a gallery flow.
picker.Show((result) => {

private void PrintPickerResult(AN_GalleryPickResult result) {
    if (result.IsFailed) {
        AN_Logger.Log("Picker Filed:  " + result.Error.Message);

    AN_Logger.Log("Picked medai count: " + result.Media.Count);
    foreach (var an_media in result.Media) {
        AN_Logger.Log("an_media.Type: " + an_media.Type);
        AN_Logger.Log("an_media.Path: " + an_media.Path);
        AN_Logger.Log("an_media.Thumbnail: " + an_media.Thumbnail);


private void ApplyImageToGUI(Texture2D image) {

    //m_image is a UnityEngine.UI.RawImage
    m_image.texture = image;

    //m_sprite is a UnityEngine.UI.Image
    m_sprite.sprite = image.ToSprite();