Get image from SurfaceTexture

vanKraster 181 Reputation points
2022-08-11T12:53:49.23+00:00

Hi to all,

Does anyone know how to get image from SurfaceTexture ?

I have followed this example
https://github.com/xamarin/xamarin-forms-samples/tree/main/CustomRenderers/View

and inside
void TextureView.ISurfaceTextureListener.OnSurfaceTextureUpdated(SurfaceTexture surface)

I want to get the image from SurfaceTexture , is there possible ?

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,325 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 38,756 Reputation points Microsoft Vendor
    2022-08-16T08:56:07.227+00:00

    Hello,

    No, there is no possible to get images from SurfaceTexture.

    Referring to this official documentation SurfaceTexture, we could find the following description about SurfaceTexture:

    Captures frames from an image stream as an OpenGL ES texture.

    Therefore, you could not get the image from SurfaceTexture, due to it stores OpenGL ES texture.

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.