1

I’m developing a Unity app for an Oculus GO Headset. It’s written in C#. I have a Micro USB stick for the headset and I am able to see its contents and play them in Moon Player VR from

OculusTV > Settings.apk (Downloaded from here)(It’s essentially the Android settings menu) > Storage.

I am also able to open it with JS USB OTG apk I sideloaded.

Now, as for the app: I got it to READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE. But the amount of videos I am able to store solely on the headset is only 32GB.

I’d like to display from my app, the same permissions dialogue JS USB OTG does for reading USB storage.

And to be able to play videos from the USB from the code with my logic on top.

A Video Player I used to play a video from the USB Stick displaying the path of the video as content://com.android.externalstorage.documents/document/4E43-F552%3Alake.mp4.

The way I am running Videos from storage outside the app now:

        VideoPlayer videoPlayer = sphere.AddComponent<VideoPlayer>();
        videoPlayer.url = "/sdcard/Movies/lake.mp4";
        videoPlayer.Play();

The current permissions in the Android Manifest:

  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

Any help would be greatly appreciated!

  • You are talking about two usb sticks? – blackapps Dec 13 '19 at 10:06
  • The headset is connected to your phone? How? – blackapps Dec 13 '19 at 10:07
  • I have one USB Stick put in the headset. This is it: https://www.amazon.co.uk/Kingston-Technology-DTDUO3-64GB-micro-USB/dp/B00LIXJ0OU/ref=sr_1_13?keywords=usb%2Bmicro%2Busb%2Bstick&qid=1576232348&sr=8-13&th=1 It is not connected to my phone. The app I am building is only supposed to run on Oculus. – Ivona Mircheva Dec 13 '19 at 10:19
  • You better had posted a picture of the Oculus... So it comes with 32GB internal memory? And that memory is reachable under /sdcard ? And now you put the usb stick in and you wanna know its path? Well if it is /storage/4E43-F552 in your phone then it will be the same on the Oculus. – blackapps Dec 13 '19 at 10:45
  • So it comes with 32GB internal memory? Yep And that memory is reachable under /sdcard? Yep And now you put the USB stick in and you wanna know its path? Yep Well if it is /storage/4E43-F552 in your phone then it will be the same on the Oculus. Nope :( I actually found the path of the video in the USB Stick And besides the path, I want to actually gain the permission to read the USB from my app. – Ivona Mircheva Dec 13 '19 at 11:00
  • Have you tried getExternalFilesDirs() the second item? And ACTION_OPEN_DOCUMENT_TREE? – blackapps Dec 13 '19 at 11:03
  • I cannot get the getExternalFiles() to run as Application.Context.getExternalFiles is returning Application does not contain a definition for context. I found this and I already checked that directory https://gist.github.com/granoeste/5574148 What do you mean by the second item? Is ACTION_OPEN_DOCUMENT_TREE a permission. – Ivona Mircheva Dec 13 '19 at 11:33
  • getExternalFiles() does not exist. There are getExternalFilesDir() and getExternalFilesDirs(). I talked about the latter. Your link is incomplete so you could not check what i said. – blackapps Dec 13 '19 at 11:36
  • getExternalFilesDirs() is what I meant sorry. I just cannot include the proper Android.Content in my Project – Ivona Mircheva Dec 13 '19 at 11:53
  • Then from where are you calling the function? – blackapps Dec 13 '19 at 12:01
  • I'm trying to call it from the Awake() function of an OnStartVideo script attached to a scene. It's the same place I'm usually adding the video to my sphere. – Ivona Mircheva Dec 13 '19 at 12:10
  • `content://com.android.externalstorage.documents/document/4E43-F552%3Alake.mp4` . You can let the user pick that content scheme using ACTION_OPEN_DOCUMENT. – blackapps Dec 13 '19 at 12:32
  • You see thats the same 4E43-F552! Uid of the stick. – blackapps Dec 13 '19 at 12:34
  • Would you mind putting an example piece of code? Yes, I noticed the UID as well – Ivona Mircheva Dec 13 '19 at 12:47
  • Sorry, i do not program in Unity. – blackapps Dec 13 '19 at 12:56
  • It's okay I've been struggling with that for a week... – Ivona Mircheva Dec 13 '19 at 13:04

0 Answers0