Pick or Capture a Video

The samples below show how to quickly configure ISN_UIImagePickerController for common operations with a video. 

Pick a Video from Photo Library

using SA.iOS.UIKit;
using SA.iOS.AVFoundation;
...

ISN_UIImagePickerController picker = new ISN_UIImagePickerController();
picker.SourceType = ISN_UIImagePickerControllerSourceType.Album;
picker.MediaTypes = new List<string>() {ISN_UIMediaType.MOVIE};


picker.Present((result) => {
    if (result.IsSucceeded) {
        Debug.Log("MOVIE local path: " + result.MediaURL);

        // We only have movie path when movie is picked.
        // So we need to generate a thumbnail manually
        // Let's ise ISN_AVAssetImageGenerator and generate video thumbnail
        // form the video firts frame
        Texture2D image = ISN_AVAssetImageGenerator.CopyCGImageAtTime(result.MediaURL, 0);
        
        //Example how to assing thumbnail to Image m_image
        m_image.sprite = image.ToSprite();
        //Example how to assing thumbnail to GameObject m_go;
        m_go.GetComponent<Renderer>().material.mainTexture = image;
    } else {
        Debug.Log("Madia picker failed with reason: " + result.Error.Message);
    }
});

Capture a Video from Camera

using SA.iOS.UIKit;
using SA.iOS.AVFoundation;
...

ISN_UIImagePickerController picker = new ISN_UIImagePickerController();
picker.SourceType = ISN_UIImagePickerControllerSourceType.Camera;
picker.MediaTypes = new List<string>() {ISN_UIMediaType.MOVIE};


picker.Present((result) => {
    if (result.IsSucceeded) {
        Debug.Log("MOVIE local path: " + result.MediaURL);

        // We only have movie path when movie is picked.
        // So we need to generate a thumbnail manually
        // Let's ise ISN_AVAssetImageGenerator and generate video thumbnail
        // form the video firts frame
        Texture2D image = ISN_AVAssetImageGenerator.CopyCGImageAtTime(result.MediaURL, 0);
        
        //Example how to assing thumbnail to Image m_image
        m_image.sprite = image.ToSprite();
        //Example how to assing thumbnail to GameObject m_go;
        m_go.GetComponent<Renderer>().material.mainTexture = image;
    } else {
        Debug.Log("Madia picker failed with reason: " + result.Error.Message);
    }
});