ExoPlayer:控制前进和后退按钮的跳过间隔
ExoPlayer: Control skip-interval for forward and rewind buttons
我正在寻找一种方法来为 "forward" 和 "rewind" 按钮设置跳过间隔。默认情况下,按前进会跳过 15 秒的视频,但按倒带只会跳过 5 秒。我想将两者都设置为 5 秒,但我找不到任何 API 可以这样做。
问题:如何在 ExoPlayer 2 中覆盖 "forward" 和 "rewind" 按钮的跳过间隔?
应该是 app:fastforward_increment="5000" 和 app:rewind_increment="5000"
<com.google.android.exoplayer2.ui.SimpleExoPlayerView
android:id="@+id/item_comment_exo_player_view"
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_gravity="center"
android:background="@color/black"
android:fitsSystemWindows="true"
android:paddingBottom="0dp"
android:paddingEnd="0dp"
android:paddingStart="0dp"
android:paddingTop="0dp"
app:controller_layout_id="@layout/custom_playback_control"
app:fastforward_increment="5000"
app:rewind_increment="5000"
app:show_timeout="2000" />
我尝试了指定的 XML 属性,但仍然面临同样的问题,即 按前进会跳过 15 秒的视频,但按后退只会跳过 5 秒。
所以我覆盖了 Java 代码中的属性值 以将两者设置为仅跳过 5 秒。
// This will override the player controller XML attributes.
playerView.setFastForwardIncrementMs(5000);
playerView.setRewindIncrementMs(5000);
更多参考资料check official doc.
我正在寻找一种方法来为 "forward" 和 "rewind" 按钮设置跳过间隔。默认情况下,按前进会跳过 15 秒的视频,但按倒带只会跳过 5 秒。我想将两者都设置为 5 秒,但我找不到任何 API 可以这样做。
问题:如何在 ExoPlayer 2 中覆盖 "forward" 和 "rewind" 按钮的跳过间隔?
应该是 app:fastforward_increment="5000" 和 app:rewind_increment="5000"
<com.google.android.exoplayer2.ui.SimpleExoPlayerView
android:id="@+id/item_comment_exo_player_view"
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_gravity="center"
android:background="@color/black"
android:fitsSystemWindows="true"
android:paddingBottom="0dp"
android:paddingEnd="0dp"
android:paddingStart="0dp"
android:paddingTop="0dp"
app:controller_layout_id="@layout/custom_playback_control"
app:fastforward_increment="5000"
app:rewind_increment="5000"
app:show_timeout="2000" />
我尝试了指定的 XML 属性,但仍然面临同样的问题,即 按前进会跳过 15 秒的视频,但按后退只会跳过 5 秒。
所以我覆盖了 Java 代码中的属性值 以将两者设置为仅跳过 5 秒。
// This will override the player controller XML attributes.
playerView.setFastForwardIncrementMs(5000);
playerView.setRewindIncrementMs(5000);
更多参考资料check official doc.