外线玩家背景:如何为外线玩家设置背景



我正在使用 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" />

不要为此使用艺术品。你能做的最好的事情就是在托管玩家视图的布局中添加一个不可见的 ImageView,并在发生 onPlayerError 时将其变为可见。

如果您必须将占位符图像设置为 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" />

最新更新