androidgpuopengl-es-2.0surfaceviewtextureview

how to find out TextureView will work on an android device?


I'm implementing an IPTV project, So I have a TextureView that plays video. But in some cases it has no picture and only plays audio, because of some hardware accelerating window issues in set top box device.

So my question is how to find out TextureView will work on an android device?

And my another question is:

How to find out an android device will run TextureView properly?

Thanks in advance


Solution

  • This could be beneficial for novice android developers or anyone who will see this.

    In my case, using this snippet in OnCreate method helped me to find out which device can use SurfaceView

        if (
                GLES20.glGetString(GLES20.GL_RENDERER) == null ||
                        GLES20.glGetString(GLES20.GL_VENDOR) == null ||
                        GLES20.glGetString(GLES20.GL_VERSION) == null ||
                        GLES20.glGetString(GLES20.GL_EXTENSIONS) == null ||
                        GLES10.glGetString(GLES10.GL_RENDERER) == null ||
                        GLES10.glGetString(GLES10.GL_VENDOR) == null ||
                        GLES10.glGetString(GLES10.GL_VERSION) == null ||
                        GLES10.glGetString(GLES10.GL_EXTENSIONS) == null) {
            // this device can not use TextureView
        } else {
            // this device can use TextureView
        }
    

    To find out differences between SurfaceView and TextureView see this link.