private void SetFileName(string path) { receivedMimeType = selectedMimeType; shareFile = path; data.imageSetter = x => share = x; switch (selectedMimeType) { case 1: //video //load a preview picker.GetVideoPreview(data, shareFile); break; case 0: //image StartCoroutine(ImagePicker.LoadImage(shareFile, data.imageSetter)); break; default: Debug.LogWarning("Implement your mimetype handling here"); break; } }
/// <summary> /// Customized callback so we get more control /// </summary> /// <param name="value">the filename (or names) of the selected file</param> public virtual void ReceiveFilename(string result) { if (string.IsNullOrEmpty(result)) { //use logcat to get more information Debug.Log("Result was empty, check logcat"); if (data.callbackError != null) { data.callbackError.Invoke(); } return; } if (data.imageSetter == null) { SetFileName(result); } else { StartCoroutine(ImagePicker.LoadImage(result, data.imageSetter)); } }