Example #1
0
    // callback MUST dispose the stream when done!
    public static void ImportAudioStream(System.Action <Stream> callback)
    {
// TODO: get this to work with Android eventually
// right now it can't open files unless they are in a .nomedia folder (doesn't have read permission)
// and the files it can open have names obscured.
//#if UNITY_ANDROID && !UNITY_EDITOR
#if false
        CheckPermission(NativeGallery.GetAudioFromGallery((path) => {
            if (path == null)
            {
                callback(null);
                return;
            }
            try
            {
                callback(File.Open(path, FileMode.Open));
            }
            catch (System.Exception e)
            {
                DialogGUI.ShowMessageDialog(GUIManager.guiGameObject, "Error importing audio file");
                Debug.LogError(e);
            }
        }));
#else
        ShareMap.OpenFileManager();
#endif
    }