如图片和视频所示,我在使用样式化播放器视图时遇到问题。
我已将 controllerShowTimeoutMs 设置为 2 秒,但我得到的结果如下图所示...
或如本视频中... YouTube 链接
当控制器在 2 秒内没有任何输入时,播放器的默认时间栏的可见性会改变。
然后在 2 秒后再次更改所有控件的可见性。
我想让所有控件在两秒内同时消失
我尝试检查很多东西,但找不到问题的原因......
下面是 Exoplayer 的 XML 代码
<com.google.android.exoplayer2.ui.StyledPlayerView
android:id="@+id/home_exoplayer_view"
android:layout_width="match_parent"
android:layout_height="0dp"
app:controller_layout_id="@layout/exo_control_layout_main"
app:layout_constraintDimensionRatio="16:9"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shutter_background_color="?colorTextBackgroundBlack"
app:use_controller="true"
app:show_buffering="always"
app:player_layout_id="@layout/exo_player_layout_main"
/>
在我的片段中
//Autohide controller in below Mili seconds unless the user taps
exoPlayerView.controllerShowTimeoutMs = 2000
//Don't show controller when playback starts
exoPlayerView.controllerAutoShow = false
简单的解决方法是禁用动画。像这样
<com.google.android.exoplayer2.ui.StyledPlayerView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:animation_enabled="false" />
StyledPlayerControlViewLayoutManager.hide() 中的更多细节