NukeUI icon indicating copy to clipboard operation
NukeUI copied to clipboard

NukeUI + Introspect issue

Open andrewsexcellent opened this issue 2 years ago • 5 comments

Hello,

First off - thanks for the effort on the library - really appreciate it!

In my project I'm using NukeUI and Introspect I have a view that uses about 10 LazyImages to download and show an mp4 and another piece of that view that responds to a sheet modifier that utilizes detents on iOS 15 via Introspect, as they're not yet in SwiftUI.

The issue that I'm seeing is that if I show that view via a NavigationView more than 3 times, the mp4s no longer load and play.

Additionally, inspecting the memory graph, shows that even if I navigate away from that view, there are about 60 LazyImage and VideoPlayerView sticking around in memory, which I assume is the crux of the issue.

Commenting out the Introspect portion fixes the issue and everything works as expected, but I need it in my app for other things as well.

Now, this might very well be an Introspect issue and I'm raising an issue in that repo as well, but just wanted to see whether the maintainer here might have any insights into why this is happening.

Code that reproduces the issue

Tested on iOS 15.4.1 on iPhone 12 Pro Max, compiled with Xcode 13.3.1 (interestingly the simulator doesn't show the issue)

NukeUI version: 0.8.1 Introspect version: 0.1.4

Video of the issue:

https://user-images.githubusercontent.com/82413230/168490919-ee292d87-d8ed-4939-b278-138c6648d7e3.mov

Memory graph:

Screen Shot 2022-05-15 at 19 18 40

Thanks!

andrewsexcellent avatar May 15 '22 19:05 andrewsexcellent

hi @kean - we'd love to hear your thoughts on this issue if you have a moment! it is a blocker for us, and ultimately will determine if we can use Nuke/NukeUI. Thanks so much for a great library!

pgorrindo avatar May 19 '22 14:05 pgorrindo

The issue that I'm seeing is that if I show that view via a NavigationView more than 3 times, the mp4s no longer load and play.

Unfortunately, it's a known limitation. The number of players you can have at once on-screen is limited. The limit is not documented and depends on the platform. In general, expect to have about four players playing at once. So the app needs to be designed to work around that.

I don't think there are any known leaks in NukeUI. If you find them, I would appreciate if you could report them.

kean avatar May 19 '22 14:05 kean

Hey kean, thanks for the reply!

We're going back and forth in a navigation stack, that should theoretically kill off the VideoPlayer views, but it doesn't seem like it is.

Surely it doesn't mean that you can only ever have 4 players play your mp4s and that's it?

andrewsexcellent avatar May 19 '22 15:05 andrewsexcellent

You can have around four playing at the same time.

kean avatar May 19 '22 16:05 kean

You can have around four playing at the same time.

Great, thanks for reiterating this point! Our concern is more that it seems the VideoPlayer views aren't being killed off when navigating in the stack. We aren't asking at all about the number playing at the same time -- but rather about player views persisting when they shouldn't be.

pgorrindo avatar May 19 '22 16:05 pgorrindo