Forum Discussion
cockcrow0412
4 years agoHonored Guest
Oculus Quest2 - issue on writing files in sdcard/Download location.
I have already got the permission for WRITE_EXTERNAL_STORAGE.
But DownloadHandlerFile of UnityWebRequest cannot create file in sdcard/Download location and always failed.
What is the cause?
Is there someone to resolve such issue?
3 Replies
Replies have been turned off for this discussion
- Anonymous
Hi cockcrow0412
Check my previous answers
https://forums.oculusvr.com/t5/Oculus-Quest-Development/Accessing-local-files/m-p/781254#M1334
Hope this helps. - cockcrow0412Honored Guest
Thanks for your reply Anonymous
I have already referred and tried many similar cases, including the above URL.
However, it still does not work on Quest2.
It seems to work on other Android systems and Quest1 except Quest2.
Have you tried Quest2 yourself?
My app actually has the WRITE_EXTERNAL_STORAGE permission, but it is not creating a file. - PhluxmExplorer
Are you using Unity? If so I got this working on the Quest 2.
I downloaded the video to the persistent storage first, and then set the path (URL) using downloadHandler, finally set the URL to that location.
Put something like this in a Coroutine...
IEnumerator DownloadVideoFromURL() { var webRequest = UnityWebRequest.Get(url); //Get the video file form URL string path = Path.Combine(Application.persistentDataPath, file_name + ".mp4"); //save it to the SDcard webRequest.downloadHandler = new DownloadHandlerFile(path); yield return webRequest.SendWebRequest(); //wait until web stuff finishes if (webRequest.result == UnityWebRequest.Result.Success) { videoPlayer.url = path; //when downloaded, set the URL of the VideoPlayer Debug.Log("File successfully downloaded and saved to " + path); StartCoroutine(PlayVideo()); //start another coroutine to play the video or whatever } }
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 10 months ago
- 11 months ago