如何使Exoplayer控件始终可见?

时间:2017-11-19 18:42:22

标签: android exoplayer

ExoPlayer开始播放几秒钟后,控件停止显示并出现黑色背景。如何确保控件始终可见?

4 个答案:

答案 0 :(得分:6)

show_timeout属性设为0

答案 1 :(得分:1)

您可以使用这些内容以编程方式完成

    PlayerView.setControllerShowTimeoutMs(0);
    PlayerView.setControllerHideOnTouch(false);

答案 2 :(得分:0)

如果您在SimpleExoPlayerView课程中看到以下方法,则需要提供负值,以便控件始终可见。

/**
* Sets the playback controls timeout. The playback controls are automatically hidden after this
* duration of time has elapsed without user input and with playback 
  or buffering in progress.
* @param controllerShowTimeoutMs The timeout in milliseconds. A non-
  positive value will cause the controller to remain visible indefinitely.
*/
public void setControllerShowTimeoutMs(int controllerShowTimeoutMs) {
       Assertions.checkState(controller != null);
       this.controllerShowTimeoutMs = controllerShowTimeoutMs;
}

答案 3 :(得分:0)

只需为某人发布需求,请尝试一次。

请在XML视图中添加以下两行。

 app:show_timeout="0"
 app:hide_on_touch="false"

像完整的示例一样。

<com.google.android.exoplayer2.ui.PlayerView
        android:id="@+id/audio_view"
        android:layout_width="match_parent"
        android:layout_height="300dp"
        android:isScrollContainer="false"
        app:controller_layout_id="@layout/exo_playback_control_view_audio"
        app:fastforward_increment="10000"
        app:show_timeout="0"
        app:hide_on_touch="false"
        app:resize_mode="fill"
        app:rewind_increment="10000"
        app:show_buffering="always" />
相关问题