-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
🐛 Camera Screen goes black when using Skia Frame Processors (doesn't happen with normal frame processors) #3365
Comments
Guten Tag, Hans here! Thank you for providing a detailed description of your issue along with relevant logs and code. It seems like you're experiencing a valid concern with using the Skia Frame Processor in your application. In order to better assist mrousavy in investigating this issue, it would be helpful to try reproducing the problem in the VisionCamera Example app. If you haven’t already, please give that a shot! Additionally, it might be beneficial to ensure you have the latest version of all related packages, as updates can sometimes resolve these kinds of conflicts. If the issue persists after that, feel free to provide any further details about your testing environment. 🍻
|
Having same issue, I think a lot of people are. I think react-native-vision-camera should update its skia dependency from current 1.4.2 to at least 1.7.4 where this issue was addressed, ideally > 1.7.7 |
This comment has been minimized.
This comment has been minimized.
This is a critical issue, useSkiaFrameProcessor is currently not usable. |
@maxximee have u tried on 1.7.7 yet as @wcandillon advised? |
I've forked the project and updated skia dependency, but having hard time compiling it
|
i just tried with 1.7.7, doesnt change anything. Same problem. |
@mrousavy should we have a look? On our side things are pretty stable and we have new capabilities related to texture sharing with third-party, maybe we can do a refresh |
Hmm, maybe it's an orientation thing? Maybe it tries to render in a wrong orientation? In that case, it'd be the fault of the CameraX implementation on this specific android device reporting a wrong orientation. You can play around with this switch in the VisionCamera useSkiaFrameProcessor code: react-native-vision-camera/package/src/skia/useSkiaFrameProcessor.ts Lines 91 to 113 in 54df86a
If none of those options render properly, it migth actually be a texture issue. |
But will the orientation issue result in the camera screen turning to black? |
I've found this patch in another post, tried it but doesn't resolve the black screen. |
No. VisionCamera has a peerDependency on Skia which is set to |
It could be, because if the wrong orientation is rendered, the canvas is translated and rotated by the wrong amount, resulting the Frame being drawn outside the visible bounds. Thats why I'm asking you to test this. |
Didn't help with the black screen. Note on samsung galaxy s22 / s24 it causes thousands of null pointer crashes: Detailed logs are exactly the same as in Shopify/react-native-skia#2800 |
the crashes on samsung galaxy s22 / s24 has been fixed right? |
In skia > 1.7.4 yes. But vision-camera uses skia 1.4.2 so it's still there. I can use skia in my app, but "useSkiaFrameProcessor" in the vision-camera crashes |
|
Good point, 1.4.2 is actually the devDependency. So am not sure why I get all those crashes in my current build with now skia 1.10.1 |
I just told you - you can use whatever Skia version you want with VisionCamera. It doesn't use 1.4.2. |
So my device was reporting orientation as 'landscape-right' and I played around with that switch statement as you said. As in put other orientations' cases' in landscape-right's switch but all it did was either rotate my stick figure or not display it at all. The Camera screen is still black tho. Another interesting observation, your Skia Vision Camera Demo github repo is showing my device orientation to be 'landscape-left', instead of' landscape-right', like in my own project. Does this have to do with the older version of vision camera + skia in your repo? Also, there is a discrepancy between what vision camera tells my orientation is and what SkiaFrameProcessor tell my frame orientation is. VisCam says 'portrait', but SkiaFP says my frame is at 'landscape-right' at the same time. Why so? |
@mrousavy @wcandillon any updates on this issue? |
We discovered same issue after upgrading react-native, vision-camera, skia, worklet-core to the latest versions. This setup is showing white screen on preview:
This one (from your example) works perfectly:
I can do any action if you need, like logs, device info, screenshots, reproducible demo etc. |
In my case SkiaFrameProcessor is reporting 'landscape-left' when my phone is in 'portrait' orientation. I noticed that the black screen dissapeared when I rotates the phone, and modifying the canvas translation parameters for 'landscape-left' switch case did the trick:
|
on what basis did you do the changes? What were the calculations involved? |
I've seen this patch on a few other github issues, tried it but didn't fix black screen for me. |
same, reversing the translation and rotation didnt remove the black screen for me |
@mrousavy @wcandillon could we please get any updates on this issue? Is that something which is worked on for the next package version or it won't be? I'm running this on a production app, it's affecting us quite a lot. |
@DragonDare if you're running this in a production app and your business depends on this, maybe you should consider supporting me or William through GitHub sponsors or finding an enterprise support plan that works for you. I am not working on a fix for this in the next few days, I suggested what I thought could be the issue (rotation switch/case, try playing with that!), but I don't have time to work on this as my priority is focused towards Nitro right now. |
Also - we don't know yet if it is a RN Skia or a VisionCamera bug. We'd need to figure out if the texture (SkImage) is being created successfully - if not, it's a Skia bug, if yes it's a VisionCamera bug (because apparently we don't render it correctly later on) |
I see. I'll surely look into if my company can hop on one of the enterprise plans. I understand why it won't be your priority right now. Also, I did play with the orientation switch cases, it didn't help except just rotate my stick figure to the correct position, which is portrait. Earlier it was showing in landscape-right even if I was holding phone in portrait. Still getting the black screen nonetheless. |
My productive app is free and not bringing me anything, so I don't have any money to put in the plugin sadly. I did add a very ugly workaround for android, basically disabling the skia frame processor by default, that means users won't see negative films in the correct colors but it's better than a black screen. |
Oh I didn't see this - well that's definitely coming from react-native-skia, see |
What's happening?
I'm trying to implement pose detection by drawing stick-figure of the pose on my app. But with Skia Frame processor, the camera screen goes black with only the stick figure being visible. However, if i use a normal frame processor, the camera is visible and not black.
Packages:
Reproduceable Code
Relevant log output
Camera Device
Device
Motorola Edge 40
VisionCamera Version
^4.6.3
Can you reproduce this issue in the VisionCamera Example app?
I didn't try (⚠️ your issue might get ignored & closed if you don't try this)
Additional information
The text was updated successfully, but these errors were encountered: