cancel
Showing results for 
Search instead for 
Did you mean: 

I want to read a file inside Movies which is a public folder in an app made with Unity.

eyemcastdev
Honored Guest

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

2 REPLIES 2

bunnyxt
Honored Guest

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!

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`.