Hi, I’m wanting to use a video clip as the background in my menu scene for one of my games.
Setting the video player’s URL to the URL I want to play works, however, each time the game is launched, it re-downloads the video. This causes unnecessary data usage, especially on mobile.
Instead, I tried downloading the video using a UnityWebRequest and saving it to a file. This works, and the video only has to be downloaded once, however, the video then needs to be fully downloaded before playback can commence, meaning there is a delay before the video starts playing.
So, my question is: is there any way to stream a video from a URL directly using the video player, but also cache the download in the persistent data path, so the video is only downloaded once?
The only other way I can think of achieving this is by playing the video via the URL of the video player, while also downloading the file using a web request. This is better than downloading it every time the game is launched, however, it still downloads the video twice which is not ideal.
The VideoPlayer doesn’t offer a way to cache while playing back.
This feature request has been on our radar for a while, but we haven’t gotten to it yet. So the compromise you are describing - fully download and play from url at the same time - is the best option currently available.
Hey, any updates on this? Seems like a fairly important feature of the video player. I was actually going to implement addressables mainly to deal with this but then I realized I probably would need to fully download the video first which is not ideal…
Any update or prospect of any update on this? I would also very much like to not have to double download every video in order to (1) get immediate playback from URL streaming and (2) be able to cache it to persistentDataPath after so I can read it from there on subsequent plays…
We now have a roadmap for all features request. You can see @mikemohan what we are doing and planning to do, and you can propose your own. We are pretty dependent on the platform SDK, which usually doesn’t provide this option. So we would need a big refactor, which we are planning to do but has not yet been done. Audio and video workflow roadmap | Unity