ivanvorobei / SPIndicator

Floating indicator, mimicrate to indicator which appear when silent mode switched. Can be present from top and bottom. Interactive with gesters.
https://opensource.ivanvorobei.io
MIT License
768 stars 48 forks source link

Problem when the view has a AVPlayerViewController #20

Open PedroCavaleiro opened 1 year ago

PedroCavaleiro commented 1 year ago

Details

I'm trying to create a list of videos, each entry has a video player but using the library AZVideoPlayer for fullscreen and PiP support

There's a issue where the HUD goes under the notch

I was able to find out that the problem probably lies in the AVPlayerViewController, I tried to implement a simpler version of the video player with the AVPlayerViewController and got the same result, no issues when using the native VideoPlayer

https://user-images.githubusercontent.com/1993871/202064081-de4fd802-98e1-4d4b-b459-348af696a40c.mov

It's a bit hard to get a idea with the screen grab but the toast should cover the "Feed" word completely

I added the SPIndicator on the topmost view to see if it would helped but it doesn't

gvizeu commented 1 year ago

Hi I had the same problem, as far I see weh you work with AVPlayer or AVPictureInPicture. Apple creates a UIWindow called PGHostedWindow that does not have safeAreaInsets. and this framework is using UIApplication.shared.windows.first to get the safe area insets instead of UIApplication.shared.connectedScenes .filter { $0.activationState == .foregroundActive } .first(where: { $0 is UIWindowScene }) .flatMap({ $0 as? UIWindowScene })?.windows .first(where: \.isKeyWindow)

what I suggest is create a fork with this change until they fix it :)

ivanvorobei commented 1 year ago

Happy for any community changes. Soon will move this repo to pack with indicators