ExoPlayer - changing thumb in DefaultTimeBar

Nimdokai picture Nimdokai · Oct 10, 2017 · Viewed 7.9k times · Source

As I understand from releas note of version 2.4.0 ExoplayerSeekBar was replaced by DefaultTimeBar. https://github.com/google/ExoPlayer/blob/dev-v2/RELEASENOTES.md

As I can seen, as on 19Feb2017: https://github.com/bigexxx/ExoPlayer/blob/c5db6f39a6e07b4f98364ff40476e4e213172488/library/src/main/java/com/google/android/exoplayer2/ui/PlaybackControlView.java exo_progress was SeekBar type:

(line 285): progressBar = (SeekBar) findViewById(R.id.exo_progress);

And right now: github.com/google/ExoPlayer/blob/release-v2/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlaybackControlView.java

it is:

(line: 384):timeBar = (TimeBar) findViewById(R.id.exo_progress);

DefaultTimeBar does not have method like .setThumb() and it seems to me that thumb is created as Canvas in drawPlayhead(Canvas canvas).

Question: is is possible to set own thumb icon in DefaultTimeBar?

Answer

Alexey picture Alexey · Oct 10, 2017

I didn't found an option to set a thumb icon in DefaultTimeBar.

You can copy DefaultTimeBar and customize the thumb by changing drawPlayhead(Canvas canvas) method.

Also uou can change it color by adding exo_playback_control_view.xml. (scrubber == thumb)

        <com.google.android.exoplayer2.ui.DefaultTimeBar
            android:id="@id/exo_progress"
            android:layout_width="0dp"
            android:layout_weight="1"
            app:scrubber_color="@color/scrubberColor"
            app:played_color="@color/playedColor"
            app:unplayed_color="@color/unplayedColor"
            app:buffered_color="@color/bufferedColor"
            android:layout_height="26dp"/>

More information about customizing ExoPlayer’s UI components: https://medium.com/google-exoplayer/customizing-exoplayers-ui-components-728cf55ee07a

'

========== UPDATE ================

Following properties could be used in order to change the scrubber drawable:

    app:scrubber_drawable="@drawable/ic_scrubber"
    app:scrubber_enabled_size="24dp"