Android thread controlling multiple texture views causes strange flickering

后端 未结 1 698
野的像风
野的像风 2020-12-21 15:41

I am trying to use a single thread to render three separate TextureView\'s off the UI thread using canvas lock/unlock. The problem observed is the consistent flickering of e

相关标签:
1条回答
  • 2020-12-21 16:07

    I was able to find a workaround for this. (i dont observe this on android 5.0 and above).

    Add a psuedo transparent view like below

                <View
                    android:id="@+id/flicker_hack_view"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_alignParentBottom="true"
                    android:layout_centerHorizontal="true"
                    android:alpha="0.01"
                    android:background="@color/black_12" />
    

    which covers the entire activity wherever there is a textureView. the alpha should be set to 0.01 or a smaller value to make it seem invisible.

    This workaround was based on my observation that when the two textureviews rendering videos overlap the flicker is not observed.

    0 讨论(0)
提交回复
热议问题