Can't get path to StreamingAssets in Android

Hello,

I’m trying to use Facebook SDK 360 for ambisonic sound. At Mac it works fine, but when I try to play at Android devices doesn’t works. Now I know that the problem is the path for load the audio. Facebook 360 SDK use StreamingAssets to save there a .tbe archive, and Unity has little problems to load StreamingAssets as PC/Mac.
The default code is this

private string resolvePath(string path, PathType type)
        {
            if (type == PathType.STREAMING_ASSETS)
            {
                string streamingAssetsPath = Path.Combine(Application.streamingAssetsPath, path);
                if (streamingAssetsPath.Contains("apk!") && Application.platform == RuntimePlatform.Android)
                {
                    return "asset:///" + Path.GetFileName(streamingAssetsPath);
                }
                return streamingAssetsPath;
            }
            
            return path;
        }

I try to use WWW as Unity say and I made this another code:

 private string resolvePath(string path, PathType type)
            {
                Debug.Log("WWWWWQW!");
                    string streamingAssetsPath = Path.Combine(Application.streamingAssetsPath, path);
    
                   if(!Application.isEditor)
                   {
                       
                       string dbPath;
    
    
    
                      WWW reader = new WWW(streamingAssetsPath);
                       while (!reader.isDone) 
                       {
                           
                       }
    
                       string realPath = Application.persistentDataPath + path;
                       System.IO.File.WriteAllBytes(realPath,reader.bytes);
    
                       dbPath = realPath;
                       streamingAssetsPath = dbPath;
                   }
    
                    return streamingAssetsPath;
    
            }

It worked once, but now the app doesn’t load nothing T.T

Does anyone have any suggestion to make it work?

Thanks in advance :slight_smile:

This is my code now and still not working
private void resolvePath(string path)
{

            if (!Application.isEditor)
            {
                StartCoroutine(CargarAudio(path));
            }
            else
            {
                pathStreamingAssets = Path.Combine(Application.streamingAssetsPath, path);
                //text = GameObject.Find("welcome").GetComponent<Text>();
                //text.text = pathStreamingAssets;
            }
        
                
        }
        IEnumerator CargarAudio(string path)
        {
            string streamingAssetsPath = Path.Combine(Application.streamingAssetsPath, path);
            if(!Application.isEditor)
               {
                  string dbPath;
                  WWW reader = new WWW(streamingAssetsPath);
                   while (!reader.isDone) 
                   {
                     yield return null;
                   }

                   string realPath = Application.persistentDataPath + path;
                   System.IO.File.WriteAllBytes(realPath,reader.bytes);

                   dbPath = realPath;
                   streamingAssetsPath = dbPath;
                   pathStreamingAssets= streamingAssetsPath;
                   text = GameObject.Find("welcome").GetComponent<Text>();
                text.text = pathStreamingAssets;
                //The 
                ///storage/emulated/0/Android/data/com.Iralta.SecuritasVideo80/filesVoiceDirections.tbe
               }
        }

The device display this (/storage/emulated/0/Android/data/com.Iralta.SecuritasVideo80/filesVoiceDirections.tbe) url to get the audio (VoiceDirections.tbe is the name of the audio), but still not working.
It’s seems like its something wrong when get files and the name of audio without / or the name of the folder