I am trying to implement video player feature in my Unity3D-Android app. Would like to know that how to access all video files present on device storage. So far I could get list of MP4 files on Application.persistentDataPath
using this :
private List<string> DirSearch(string sDir)
{
List<string> files = new List<string>();
try
{
foreach (string f in Directory.GetFiles(sDir,"*.mp4"))
{
files.Add(f);
}
foreach (string d in Directory.GetDirectories(sDir))
{
files.AddRange(DirSearch(d));
}
}
catch (Exception ex)
{
Debug.LogError(ex.Message);
}
return files;
}
To use the same piece of code for entire device storage and SD card, Where should I start my search from?
EDIT :
Please note that I am working in Unity3D with C# and above code works fine. So a java code would not be helpful. Instead I need absolute path on android device storage for which I can call above method like this: DirSearch(needThisPathAddressForAndroidRootFolder)
Thanks