问题描述
我知道可以在ExoPlayer中使用TextureView.但是我找不到任何有关如何以适当方式实现此功能的示例.您能帮我解决这个问题吗?
I know it is possible to use TextureView in ExoPlayer. But I cannot find any sample on how to implement this functionality in a proper way. Could you please help me on this issue?
推荐答案
PlayerView
具有xml属性surface_type
,可让您选择要使用SurfaceView
还是TextureView
.
The PlayerView
has an xml attribute surface_type
which let's you choose whether you want to use a SurfaceView
or a TextureView
.
(注意:SimpleExoPlayerView
在最近的版本中已重命名为PlayerView
,因为它仅取决于Player
接口,而不再取决于SimpelExoPlayerView.)
(Note: SimpleExoPlayerView
has been renamed to PlayerView
in recent versions since it only depends on the Player
interface and not on SimpelExoPlayerView anymore.)
您可以选择texture_view,surface_view(默认)或不选择.请参见 PlayerView JavaDoc的主要部分以获得详细信息.
You can choose texture_view, surface_view (default) or none. See the main section of the JavaDoc of PlayerView for details.
<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"/>
这篇关于如何在ExoPlayer的PlayerView中使用TextureView而不是SurfaceView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!