我正在开发一个使用exoplayer的m3u8传输的应用程序,有时我的传输是离线的,所以需要显示它的背景图像,而我现在找不到解决这个问题的方法。我唯一能找到的就是定义背景播放器颜色的shutter_background_color属性,但这并不能解决我的问题。我需要显示一个位图图像。
请帮帮我!
<com.google.android.exoplayer2.ui.PlayerView
android:id="@+id/pl_aovivo"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:resize_mode="fit"
app:use_artwork="true"
app:shutter_background_color="@color/colorPrimary" />发布于 2019-09-13 02:02:45
不要在这方面使用艺术作品。你能做的最好的事情就是在你的PlayerView所在的布局中添加一个不可见的ImageView,并在onPlayerError发生时将其变为可见。
发布于 2020-05-14 18:59:54
如果你必须在exo播放器上设置占位符图像,那么使用下面的代码:
<com.google.android.exoplayer2.ui.PlayerView
android:id="@+id/video_player"
android:layout_width="match_parent"
android:layout_height="@dimen/_150sdp"
android:layout_centerInParent="true"
android:visibility="visible"
app:default_artwork="@drawable/default_media_artwork"
app:use_artwork="true"
app:resize_mode="fixed_width"
app:show_buffering="when_playing" />https://stackoverflow.com/questions/57910974
复制相似问题