Search Unity

Downloading files to Oculus Go doesn't work?

Discussion in 'AR/VR (XR) Discussion' started by pixelcasegroup, Dec 12, 2018.

  1. pixelcasegroup

    pixelcasegroup

    Joined:
    Apr 5, 2018
    Posts:
    2
    I'm using these two scripts to handle downloading a file to PersistentDataPath. All works fine in Unity play mode and on the Rift.

    Code (CSharp):
    1.     public IEnumerator DownloadVideo()
    2.     {
    3.         downloadError = false;
    4.         downloadAborted = false;
    5.         uwr = new UnityWebRequest(videoURL, UnityWebRequest.kHttpVerbGET);
    6.         filePath = Application.persistentDataPath + "/Videos/" + videoTitle + ".mp4";
    7.         print("Downloading: " + filePath);
    8.         uwr.downloadHandler = new DownloadHandlerFile(filePath);
    9.         StartCoroutine(ShowDownloadProgress(uwr));
    10.         stopButton.SetActive(true);
    11.         yield return uwr.SendWebRequest();
    12.  
    13.         if (uwr.isNetworkError || uwr.isHttpError) {
    14.         Debug.LogError(uwr.error);
    15.         downloadError = true; }
    16.         else
    17.             Debug.Log("File successfully downloaded and saved to " + filePath);}
    and to display the download progress:

    Code (CSharp):
    1.     IEnumerator ShowDownloadProgress(UnityWebRequest uwr)
    2.     {
    3.         while (!uwr.isDone)
    4.         {  
    5.             progressBar.SetActive(true);
    6.             Debug.Log(string.Format("Downloaded {0:P1}", uwr.downloadProgress));
    7.             videoDownloadProgressText.text = string.Format("Downloading... {0:P1}", uwr.downloadProgress);
    8.             videoDownloadProgressSlider.value = uwr.downloadProgress;
    9.             yield return new WaitForSeconds(.1f);
    10.         }
    11.         if (uwr.isDone && downloadAborted && downloadError == false) {
    12.         print("Download progress = "+ uwr.downloadProgress+". Setting isDownloaded to true");
    13.             videoDownloadProgressText.text = "Download complete.";
    14.             Debug.Log("Done");
    15.         }
    16.         else { print("Download was aborted.");
    17.             videoDownloadProgressText.text = "Download cancelled.";
    18.         }
    19.     }
    However on the Oculus Go, it just prints a constant 0% downloaded, and downloads no bytes. I can confirm that the download folder exists and everything, and all works on PC.

    I also get no error messages in adb logcat.

    Not sure what the issue is...
     
  2. pixelcasegroup

    pixelcasegroup

    Joined:
    Apr 5, 2018
    Posts:
    2
    I should add, my android manifest has these permissions:

    Code (CSharp):
    1.   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    2.   <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    3.   <uses-permission android:name="android.permission.INTERNET" />
    4. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    5. <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    6. <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    7. <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
    8. <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
     
  3. mobilecoe

    mobilecoe

    Joined:
    Nov 9, 2018
    Posts:
    1
    I'm having the same issue. Please solve this one asap.
     
  4. F-R-O-S-T-Y

    F-R-O-S-T-Y

    Joined:
    Mar 22, 2013
    Posts:
    191
    Hey,

    Did you manage to solve it? I am having almost the same issue. When testing on PC and running the game in Play mode in editor, everything works fine. The videos are downloaded to AppData and the UnityWebRequest progress updates correctly.

    However with Oculus Go, the files are downloaded but the progress remains always at 0. Also when I use the file browser in Windows and navigate to the path where the files should be downloaded for Oculus Go, the videos are not visible. If, however I check the existence of the files via script, they are found.