微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android – 如何使用TextureView代替SurfaceView与ExoPlayer的PlayerView?

我知道可以在ExoPlayer中使用TextureView.但我找不到任何关于如何以适当的方式实现此功能的示例.你能帮我解决这个问题吗?

解决方法:

PlayerView有一个xml属性surface_type,您可以选择是否要使用SurfaceView或TextureView.

(注意:SimpleExoPlayerView在最近的版本中已经重命名为PlayerView,因为它只依赖于Player接口,而不再依赖于SimpelExoPlayerView.)

您可以选择texture_view,surface_view(认)或none.有关详情,请参见the main section of the JavaDoc of PlayerView.

<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"/>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐