As i tested (by the network tab in debugger), if <Video/> takes source={uri}, it will not download whole file at begining, but will simply download a part of it, so basically using HTTP content-range header realted stuff.
Its very cool, to have that, but i would like to create something like TikTok/Instagram clone, and for that i would like to control how big part of video will be downloaded first. So basically:
- Download first ~5 seconds of video
- If user won't stop watching it (by scrolling to another video) download the rest of the video This way I will save bandwith and mobile data transfer of user.
So how to control how big part of video is going to be downloaded by Expo-AV <Video/> component?
I tried to use Expo-FileSystem to asynchronously download part of video file, but i dont really know where to go from there. Should i convert it to blob? And if so, what to do next?
Update I did not managed to fetch it neither purely with Expo-AV headers option, neither by downloadAsync, neither as an Asset or as an AVPlaybackSource. I just couldn't do it. The last attempt i did (all code from this attempt is here, on pastebin) was close one, but for some reason, after calling a function that would fetch another range of data, it just stops the player for some reason...
Can someone help me, please? Its very strange that after so many years of react-native/expo development there is no tool to download video by parts, or to tell how big part of video should be downloaded...