- Home /
Question by
benjaminoutram · Jan 11, 2020 at 06:54 PM ·
animationandroidfile-ioquestfilesystem
How do I access music files on the Oculus Quest and play them?
I'd like to access the Music folder on the Oculus Quest sd card, and load them into a list so I can play them. So far, I've added the following to the AndroidManifest.xml:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
And my code is the following (C#)
if (Application.platform == RuntimePlatform.Android)
{
//string path = Application.persistentDataPath.Substring(0, Application.persistentDataPath.IndexOf("Android", StringComparison.Ordinal)) + "Music";
string path = Application.persistentDataPath;// "sdcard/Music";
var info = new DirectoryInfo(path);
FileInfo[] fileInfo = info.GetFiles("*.*");
string fileNames = "";
foreach (FileInfo file in fileInfo)
{
fileNames += " " + file.ToString();
string fullPath = file.FullName;
if (!System.IO.File.Exists(fullPath))
{
WWW www = new WWW("file:///" + fullPath);
while (!www.isDone)
{
}
songsAndroid.Add(www.GetAudioClip(false, false));
}
}
}
I think I am referencing the wrong folder, although I've tried several attempts (some are shown commented out above). Please help.
Comment