private void PickMedia(int thumbnailSize, AN_MediaType type, Action <UM_MediaResult> callback) { var picker = new AN_MediaPicker(type); picker.AllowMultiSelect = false; picker.MaxSize = thumbnailSize; picker.Show(result => { UM_MediaResult pickResult; if (result.IsSucceeded) { UM_MediaType um_type; switch (type) { case AN_MediaType.Video: um_type = UM_MediaType.Video; break; default: um_type = UM_MediaType.Image; break; } var media = new UM_Media(result.Media[0].Thumbnail, result.Media[0].RawBytes, result.Media[0].Path, um_type); pickResult = new UM_MediaResult(media); } else { pickResult = new UM_MediaResult(result.Error); } callback.Invoke(pickResult); }); }
public UM_MediaResult(UM_Media media) { m_media = media; if (m_media == null) { m_error = new SA_Error(100, "No Media"); } }
public void TakeVideo(int maxThumbnailSize, Action <UM_MediaResult> callback) { SA_ScreenUtil.TakeScreenshot(maxThumbnailSize, (image) => { var media = new UM_Media(image, image.EncodeToPNG(), string.Empty, UM_MediaType.Video); var result = new UM_MediaResult(media); callback.Invoke(result); }); }
public void PickVideo(int thumbnailSize, Action <UM_MediaResult> callback) { SA_ScreenUtil.TakeScreenshot(thumbnailSize, (image) => { var media = new UM_Media(image, string.Empty, UM_MediaType.Video); var result = new UM_MediaResult(media); callback.Invoke(result); }); }
public void TakePicture(int maxThumbnailSize, Action <UM_MediaResult> callback) { SA_ScreenUtil.TakeScreenshot(maxThumbnailSize, (image) => { var media = new UM_Media(image, string.Empty, UM_MediaType.Image); var result = new UM_MediaResult(media); callback.Invoke(result); }); }
internal static void CaptureMedia(int thumbnailSize, UM_MediaType type, ISN_UIImagePickerControllerSourceType source, Action <UM_MediaResult> callback) { ISN_UIImagePickerController picker = new ISN_UIImagePickerController(); picker.SourceType = source; switch (type) { case UM_MediaType.Image: picker.MediaTypes = new List <string>() { ISN_UIMediaType.IMAGE }; break; case UM_MediaType.Video: picker.MediaTypes = new List <string>() { ISN_UIMediaType.MOVIE }; break; } picker.MaxImageSize = thumbnailSize; picker.ImageCompressionFormat = ISN_UIImageCompressionFormat.JPEG; picker.ImageCompressionRate = 0.8f; UM_MediaResult pickResult; picker.Present((result) => { if (result.IsSucceeded) { UM_Media media = null; switch (result.MediaType) { case ISN_UIMediaType.IMAGE: media = new UM_Media(result.Image, result.ImageURL, UM_MediaType.Image); break; case ISN_UIMediaType.MOVIE: Texture2D img = ISN_AVAssetImageGenerator.CopyCGImageAtTime(result.OriginalMediaURL, 0); media = new UM_Media(img, result.MediaURL, UM_MediaType.Video); break; } pickResult = new UM_MediaResult(media); } else { pickResult = new UM_MediaResult(result.Error); } callback.Invoke(pickResult); }); }
public void TakeVideo(int thumbnailSize, Action <UM_MediaResult> callback) { AN_Camera.CaptureVideo(thumbnailSize, (result) => { UM_MediaResult pickResult; if (result.IsSucceeded) { var media = new UM_Media(result.Media.Thumbnail, result.Media.Path, UM_MediaType.Image); pickResult = new UM_MediaResult(media); } else { pickResult = new UM_MediaResult(result.Error); } callback.Invoke(pickResult); }); }