Reputation: 153
I am using EasyMovieTexture plugin and I want to get access to android folder where all the videos are saved. First I tried to access the streaming asset folder but it is not accessible in the app (Copying files into asset folder in android) so I have created folder in which all the videos are and I want to access that particular folder to play the videos individually. Here is a sample code which loads the video from url but I want it to access it from storage -
void OnGUI() {
if( GUI.Button(new Rect(50,50,100,100),"Load"))
{
scrMedia.Load("Url of video");
m_bFinish = false;
}
how to access the videos in interval storage to play them. Thanks in advance.
Upvotes: 5
Views: 21136
Reputation: 11452
Any files in a StreamingAssets
folder will be included in your build, accessible at the path specified by Application.streamingAssetsPath
.
However, the manual mentions an important caveat for Android:
On Android, the files are contained within a compressed .jar file (which is essentially the same format as standard zip-compressed files). This means that if you do not use Unity’s WWW class to retrieve the file, you need to use additional software to see inside the .jar archive and obtain the file.
If your video plugin can access the file within an APK, then you'll just need to specify the correct path.
If your video plugin expects a conventional file, then you will need to create one. Unity's WWW
class can read the compressed file into memory, which you could then write to some other location (such as Application.temporaryCachePath
) with System.File.WriteAllBytes
.
Upvotes: 0
Reputation: 1138
You can use Application.persistentDataPath to access internal storage.
https://docs.unity3d.com/ScriptReference/Application-persistentDataPath.html
You can see which directory it is using
Debug.log(Application.persistentDataPath)
Upvotes: 6