Preload videos to do a Story like player

I’m building a VideoPlayer component to play multiple videos. You pass a list of url through a “sources” prop and then it plays all the source one after the other. And you also can navigate through by tapping on left or right.
So it’s quite simple and I did a first component that is working fine.

I use only one Video component and loadAsync the new source at the end of the previous one …

So now my problem is more about optimization, I would like te preload videos. Because when you don’t have good internet, you can wait quite a while between each video. And I would like to do that smoothly:
I already tried a FileSystem.downloadAsync on the video but you have to wait the end to have the path so It’s not really better. And if the previous video is ending before the new one is downloaded you have to wait the entire download.
The other option that I was thinking of is to add multiple Video component (at least 3) and to switch between them when the video is changing and play and pause accordingly. It can work but it sounds a bit too hacky.

So I was wandering if someone knows a better way to do that ?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.