maui
maui copied to clipboard
Surface Texture Never Becomes Available in a Custom Renderer of a Content View (Android)
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.
- Here it is working on Forms: https://github.com/KRA2008/ContentViewRendererForms
- Here it is broken on MAUI: https://github.com/KRA2008/ContentViewRendererMaui
As far as I can tell I have done everything the same except it's Forms vs MAUI.
Steps to Reproduce
- Make CustomRenderer for a ContentView and use it on a ContentPage
- Instantiate a TextureView in the CustomRenderer and set the CustomRenderer as the callback handler
- 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