Open 8secz-johndpope opened 3 years ago
If i understand correctly, you want preload some videos, but don't want them to start playing automatically, wait until the cell slides to the position.
I took a look at the startDownload
function of Celestial
repo. This function is just to make regular file download request, and then there may be some managers to manage the download status to these files.
This kind of operation may seem to make the video play smoothly when the cell scrolls, but it may cause some side effects. E.g:
But if you just want to achieve this function, you can use a dedicated library to pre-downloading, like this one? Then set the downloaded file path to the player when needed, or set remote url if it is not downloaded.
The best solution is to provide a preload function in the library, preload part of the content at the beginning, and then use it in conjunction with the existing cache function. This will take a lot of time to implement, maybe I will do this later if i have enough time.
There's some magic in that - if the player requests the video being downloaded - it will merge the existing request into avplayer loading....
EAGER LOADING This repo by @ChrishonWyllie https://github.com/ChrishonWyllie/Celestial
Provides an easy way to kick off a download like this Celestial.shared.startDownload(for: url)
By hooking into uikit method -
We can eagerly kick off the download in background - no ui /and then user scrolls to video / or navigates to the page where it's needed - it will then automatically intercept the request in background and make plays in player.
Can this repo do this?