Skip to content
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

[FREQ]Mask preview flicker when app moves from .background to .active state #77

Open
jactmp opened this issue Dec 21, 2024 · 0 comments

Comments

@jactmp
Copy link

jactmp commented Dec 21, 2024

Context

Seems like (very) minor issue (but quite annoying for me at least) so FREQ rejection won't impact package quality.

When AVCaptureVideoPreviewLayer moves from .background to .inactive state (and a few milliseconds in .active state?), old preview (captured when layer moved to background) is presented, followed by black flash and finally by real-time preview. Apple's Camera app doesn't have this visual issue (so it's not only me who pays attention to such minor problems?).

It can be easy masked by e.g.: setting, for the view presenting AVCaptureVideoPreviewLayer:
1/ opacity to 0.0, when scenePhase transits from .inactive to .background (to make system "remember" last app camera preview as black),
2/ unmask preview when it reaches visually stable .active phase: set opacity to 1.0 with 0.1 second delay (and some quick .easeInOut animation).

It could be implemented by hardcoding a workaround or adding new MCamera view modifier.

I tested in on AVCam Apple's example app (much simpler architecture than your sophisticated package - easy to play with) and it looks nice.

Alternatives

Can exist (I'm not an expert in AVKit area). Solution can't be implemented on app level - no access to View showing AVCaptureVideoPreviewLayer layer which only should be masked.

If the feature request is approved, would you be willing to submit a PR?

Not skilled enough?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant