- Home /
Android - Access Video from StreamingAssets
Hello,
I know this has been asked around, but I still can't get it to work for me.
I have a video file within my StreamingAssets folder, which is then loaded into a Manager Script via FileInfo. (I say 'loaded', I mean, accessed, and read in terms of the File Info):
void GetVideosFromStreamingAssets(){
string _dir = GetPath();
if(Directory.Exists(_dir) == false){
Debug.LogWarning("Directory doesn't exist : " + _dir);
return;
}
DirectoryInfo _info = new DirectoryInfo(_dir);
FileInfo[] _files = _info.GetFiles();
foreach(FileInfo _file in _files){
if(SupportedExtension(_file)){
CreateVideoObject(_file);
}
}
}
string _directory = "MyVideos";
string GetPath(){
#if UNITY_EDITOR
string _path = Path.Combine(Application.streamingAssetsPath, _directory);
#else
string _path = "jar:file://" + Application.dataPath + "!/assets/" + _directory;
#endif
return _path;
}
However, something isn't right here. All I'm trying to do is load the file name within my UI scene, and it can't even do that. So I guess my path directory is not correct for Android.
I've tried all different Application data paths, with no luck?! What am I missing here? Thanks. .
Your answer
Follow this Question
Related Questions
GetDirectories() does not work on Android 1 Answer
StreamingAssets GIF images on android 0 Answers
How to write files to the streaming asset folder in Android at runtime 1 Answer
How can I get a list of files in StreamingAssets on Android? 0 Answers
How to find list of files in "StreamingAssets" folder in Android 1 Answer