textureview onSurfaceTextureAvailable never called inside relativelayout inside fragment

后端 未结 7 1415
走了就别回头了
走了就别回头了 2020-12-10 10:52

onSurfaceTextureAvailable in VideoView is never called...
I have this view that is holding the textureview.

public class MyMediaPlayer extends RelativeLa         


        
7条回答
  •  囚心锁ツ
    2020-12-10 11:30

    i had the same problem , strangely resolved it with the following code

    videoPreview = (TextureView) linearLayout.findViewById(R.id.videoView);
    FrameLayout.LayoutParams params = (FrameLayout.LayoutParams)videoPreview.getLayoutParams();
    params.height = 130;
    params.width = 508;
    videoPreview.setLayoutParams(params);
    videoPreview.setSurfaceTextureListener(this);
    

    More strangely if i set only the width or the height that dosent work either.

提交回复
热议问题