代码之家  ›  专栏  ›  技术社区  ›  Sasha Shpota A-Bag

ExoPlayer:控制快进和快退按钮的跳过间隔

  •  1
  • Sasha Shpota A-Bag  · 技术社区  · 6 年前

    我正在寻找一种方法来设置“前进”和“后退”按钮的跳过间隔。默认情况下,按“前进”跳过15秒的视频,但按“后退”仅跳过5秒。我想将两者都设置为5秒,但我找不到任何API来这样做。

    如何覆盖ExoPlayer 2中“前进”和“后退”按钮的跳过间隔?

    1 回复  |  直到 6 年前
        1
  •  7
  •   Phong Nguyen    6 年前

    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" />
    
        2
  •  0
  •   Harpreet    5 年前

    我尝试了指定的XML属性,但仍然面临相同的问题,即。 按“前进”键跳过15秒的视频,但按“后退”键只跳过5秒

    所以我重写了Java代码中属性的值 .

    // This will override the player controller XML attributes.
        playerView.setFastForwardIncrementMs(5000);
        playerView.setRewindIncrementMs(5000);
    

    check official doc .

    推荐文章