首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Exoplayer背景:如何为exoplayer设置背景

Exoplayer背景:如何为exoplayer设置背景
EN

Stack Overflow用户
提问于 2019-09-13 00:25:54
回答 2查看 4.5K关注 0票数 0

我正在开发一个使用exoplayer的m3u8传输的应用程序,有时我的传输是离线的,所以需要显示它的背景图像,而我现在找不到解决这个问题的方法。我唯一能找到的就是定义背景播放器颜色的shutter_background_color属性,但这并不能解决我的问题。我需要显示一个位图图像。

请帮帮我!

代码语言:javascript
复制
    <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" />
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-09-13 02:02:45

不要在这方面使用艺术作品。你能做的最好的事情就是在你的PlayerView所在的布局中添加一个不可见的ImageView,并在onPlayerError发生时将其变为可见。

票数 2
EN

Stack Overflow用户

发布于 2020-05-14 18:59:54

如果你必须在exo播放器上设置占位符图像,那么使用下面的代码:

代码语言:javascript
复制
<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" />
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57910974

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档