首页 > 解决方案 > 以编程方式将 TextureView 与 ExoPlayer 一起使用?

问题描述

PlayerView我以编程方式创建一个:

PlayerView playerView = new PlayerView(context);

而不是使用SurfaceView,我希望它使用TextureView。在文档中,它说要执行以下操作:

<com.google.android.exoplayer2.ui.PlayerView
     android:id="@+id/player_view"
     app:surface_type="texture_view"
     android:layout_width="match_parent"
     android:layout_height="match_parent"/>

但是,就像我说的那样,我正在以编程方式创建它,那么如何设置它以TextureView在我的情况下使用呢?

标签: androidsurfaceviewexoplayerexoplayer2.xtextureview

解决方案


推荐阅读