04-18-2022 08:07 PM
We are making an app to view VR videos with Unity (2020.3.21f1).
I want to play a video in the "Movies" folder, which is a public folder on my Oculus Quest device, but when I browse to a file in that folder, an "access to the path '~' is denied" error occurs.
Obviously the file exists, but it cannot be read.
Permissions are "ExternalStorageWrite", "ExternalStorageRead" both permissions are given.
The accessed folder location is "/storage/emulated/0/Movies".
"Exists" returns "True" when checking a folder using DirectoryInfo.
But even if there is a file in it, I can't read it.
How can I put a movie in the "Movies" folder and watch it in my app?
Android Version : Android10 API29
07-18-2022 04:18 PM
Hi eyemcastdev,
I'm now making a similar app for Oculus using Unity and faced the same problem. In my design, the user could select a local folder and then all media in the selected folder could be loaded to my app and then processed.
With "ExternalStorageWrite" and "ExternalStorageRead" permissions granted, the app can only access to "/storage/emulated/0/Android/data/com.example.app/files" folder. However, in most cases, the user maybe wanna select another folder.
Have you already solved this problem? Could you please provide some ideas about how to solve this problem?
Thanks!
07-19-2022 02:56 PM
Solved.
Finally, I figure out that the 'root' of accessible storage is `/sdcard` or `/storage/emulated/0`.
With permission
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
(`android.permission.READ_EXTERNAL_STORAGE` is not required), I can access all the files under `/sdcard`.
06-27-2024 02:57 AM
06-28-2024 03:28 PM
This is a perfectly timed answer! I am currently developing and running into these problems! Thank you for posting this! however;
I haven't fully tested this solution yet but would you be able to pass me your contact details so I could contact you directly about this should I run into any problems in the future as I understand these forums are not always checked?
Thanks again for this answer and I hope to speak with you soon!
07-01-2024 12:39 AM
Yes! I made an error there: there should be only 1 'System' 🙂
#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
path = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyVideos));
#else