- Home /
how can i save a video from project folder (ASSETS) to android internal or external storage?
[1]: /storage/temp/132633-6970fd2e-0c48-4123-87b5-2f752162352dpng.jpg
how can i save this videos using the application to android storage? thanks in advance.
Answer by KISP · Feb 06, 2019 at 10:06 PM
Put the videos in either Assets/Resources or Assets/StreamingAssets. Use the WWW class to grab the data, and then save it to the persistent data path.
This example saves an xml instead of a video, but what you do will probably be similar.
using (WWW retriever = new WWW(Application.streamingAssetsPath + "/Example.xml"))
{
string pathToStorage = Application.persistentDataPath + "/Example.xml";
System.IO.File.WriteAllBytes(path, retriever.bytes);
}
Also, make sure you add the proper permissions in the AndroidManifest.
Thank you for you answer, but i am new in unity and i i dont have knowledge using c#, can you please provide simple code that when i clicked a button the video wil be downloaded in the device. thank you!
Your answer
Follow this Question
Related Questions
Cloud recognition in Vuforia 0 Answers
Is it posible to attach a crosshair to an image in vuforia? 0 Answers
How should I detect horizontal and vertical surfaces for AR? 1 Answer
Have both canvas' buttons and Vuforia video canvas' button working in the same scene? 0 Answers
Camera Deactivates when integrating GVR in Vuforia 0 Answers