Quest 2 VideoPlayer from URL is White

I’m trying to load a video from a URL at runtime in VR on the Quest 2 and display it on a texture.

I’ve put the file location in the URL of the videoplayer and it works fine in the Unity Editor, but when I build for the Quest the video does not load into the texture and play.

I think what I need to find out is where Unity is storing the video file on the Quest. I can’t find it any where! I’ve used adb’s find command to search the external storage, and looked in the Application.persistentDataPath but I can’t find it.

Any advice on what I’m doing wrong?

Ok, so I finally found a way to make this work… I downloaded the video to the persistent storage first, and then set the path (URL) using downloadHandler, finally set the URL to that location.

Something like this…

var webRequest = UnityWebRequest.Get(url);
string path = Path.Combine(Application.persistentDataPath, file_name + ".mp4");
webRequest.downloadHandler = new DownloadHandlerFile(path);
yield return webRequest.SendWebRequest();
if (webRequest.result == UnityWebRequest.Result.Success)
{
        videoPlayer.url = path;

        Debug.Log("File successfully downloaded and saved to " + path);

        StartCoroutine(PlayVideo());
}
1 Like

It is unfortunate the video file must be downloaded and stored on the Quest 2 before playing. As you know, the video streams fine in the Unity editor. That is, when the player’s source is set to VideoSource.URL and the URL is set to a valid MP4 URL. Having to download the file rather than streaming is not viable for me since I deal with many large videos. Do you prefer streaming? If so, have you found any alternatives to allow for streaming?

1 Like

I had the same issue, the video player did not play the video when fetched from a URL. In my case the URL was a (http) and not (https). So adding the following in the AndroidManifest fixed it for me.

android:usesCleartextTraffic="true"

Did you find a way to stream it without the need to download the all video first?

No, I never tried streaming it. The downloading process above works though.

Totally understand why you would want to stream it though as storing video files on the Quest in persistent storage is not a great idea - it doesn’t remove them when you uninstall, you need to remove them yourself.

1 Like