Open KRA2008 opened 9 months ago
In the MAUI repo linked, when I use SetNativeControl(TextureView) instead of AddView(TextureView) then the SurfaceTexture becomes available as expected. This makes me wonder if this is in fact a documentation issue? The importance of the new SetNativeControl method is not mentioned on the page about reusing/shimming custom renderers.
I'm experiencing the same issue in a slightly different way. I was trying to port the code at https://github.com/yushulx/Capture-Vision-Maui/blob/main/Capture.Vision.Maui/Platforms/Android/NativeCameraView.cs to net8. When I upgrade the targetframework, the textureView.SurfaceTexture never becomes available. When targeting net7 it works.
Can repro this issue at Android platform on the latest 17.10 Preview 5(8.0.0-rc.2.9530&8.0.21).
SurfaceTextureListener.OnSurfaceTextureAvailable is never getting call in MAUI with .NET8.
Description
After migrating a CustomRenderer for a ContentView from Forms to MAUI, I'm finding that the TextureView I'm using has a problem - its SurfaceTexture never becomes available. On Forms this works great. I followed the documentation for shimming the renderer, and all the other aspects of the CustomRenderer work fine - the OnElementChanged and OnElementPropertyChanged etc all work fine.
My understanding of how this works on Android is that this means the TextureView is never being attached to the Window. I don't know why it no longer does that. I could very easily be missing something I'm supposed to do here, but if I'm missing something I don't think it's documented.
As far as I can tell I have done everything the same except it's Forms vs MAUI.
Steps to Reproduce
1) Make CustomRenderer for a ContentView and use it on a ContentPage 2) Instantiate a TextureView in the CustomRenderer and set the CustomRenderer as the callback handler 3) Run app (on Android)
Expected result: OnSurfaceTextureAvailable callback should be called.
Actual result: OnSurfaceTextureAvailable callback is never called.
Link to public reproduction project repository
https://github.com/KRA2008/ContentViewRendererMaui
Version with bug
8.0.3
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
I'm testing on Android 12 but I see no reason it would be specific to this version.
Did you find any workaround?
No response
Relevant log output
No response