-
-
Notifications
You must be signed in to change notification settings - Fork 532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Video #448
Comments
Hey, video is on the roadmap – it's way better than GIF for animations. I have a primitive demo that downloads and caches video using Nuke. The problem is, I don't have too much experience with video yet. |
@kean - I found this code by @ChrishonWyllie it seems good mergeExistingDownloadTask @ChrishonWyllie important to point out - uicollectionview has some smarts out of the box for prefetching. There's a final bit of sugar to squeeze performance that I've seen from another repo @GeekTree0101 GeekTree0101 cancels the downloading after 3 seconds - thus leaving enough video to start showing / but not over doing it. |
fyi - @bkg866 |
this seems to get performance like tiktok to eagerly download videos (5-6 videos queued up on first (and subsequent) presentations of the fullscreen cell) |
I'm planning to add improved support for downloading videos ahead of time in Nuke 10 – the same way it currently works for animated GIFs. There will be an option to enable synchronous disk writes, and you'll receive a file URL in the response that you can immediately start playing from disk. Progressive download is going to be more complicated, but doable. I haven't put much thought into it yet, but if someone would come up with a proposal that ideally doesn't over-complicate the existing APIs, I'm all for it. |
some design considerations I've had to overcome to achieve this If internet connection is really bad - need to be able back off eager fetching - and just get the video / and don't even bother caching it - just play it. assumption of only ever playing a video directly from cache - is eroneous. Having the downloader infrastructure is half the battle - cell recycling / reuse with uikit is the other part. if you use too many avplayers (will work fine on simulator / but depending on the physical device/ hardeware) - you can reach a condition where the avplayer konks out due to too many avplayers. it won't play / fetch / buffer. It also spills over to native photo apps I've found too on 14.5 The cells in a collection view / and their associated playable state / and the eager fetching happening in background from - needs careful orchestration. Other time wasters - loading state / show a progress loader / hide the loader. (dont hide it / better to remove it) KVO Observsations and their removal of avplayer state /avplayeritem - also add to complexity here. |
I built basic video playback support in NukeUI. Unlike the old prototype from the demo project, the new version now uses Ideally, it should also have progressive playback support, but it's a start. The current model is simple: fetch the whole thing (assuming videos are small and are used as a more efficient replacement for GIFs) and play it. No sound. So pretty much what you would expect when you are replicating GIF behavior.
Interesting, I'll need to look into it.
A "proper" video player like in TikTok would require something completely different. I don't think Nuke is a good place to implement it. |
I made a bunch of improvements to video support in NukeUI in 0.2.0. I described how it works here. I think it's a great replacement for GIFs and it's not meant to be a complete video player. I'm going to close this issue. If you'd like to see more improvements or features related to "video as GIF replacement", please feel free to open an issue or start a discussion in NukeUI. |
fyi - found this just today - it actually is quite helpful for my use case. |
I've been faffing around with different swift caching video frameworks - without really coming to a solution.
It's a space where maybe caching of videos is not a thing.
Some design condiserations -
Being able to be able to cancel video loads
Cause it's so intertwined with avrequest - maybe this will never be solved.
I'm ok for this issue to be closed - but if there's so many eyeballs on this repo - any more combined efforts to solve this caching problem would be a blessing.
wxxsw/GSPlayer#39
https://github.com/mazz/Digger/
https://github.com/JasonGoodney/wikio-ki/blob/eda8f3bff79b87ecd178a3a7937f658a8e30c058/picture/CachingPlayerItem.swift
The text was updated successfully, but these errors were encountered: