3

I would like to create a custom timebar in exoplayer using PlayerView that:

  1. cannot be dragged by user but only shows the progress in the video

UPDATE: Ok, so I was able to disable dragging by setting the touch_target_height to 0dp!

  1. allows the underlying PlayerView to be clickable (I am losing clickability of PlayerView due to the controller on top)
  2. is always shown on the PlayerView surface (the custom controller appears only on clicking PlayerView once)

I tried using DefaultTimeBar in a custom controller layout but couldn't disable dragging of time bar. Also, the controller is only shown when tapped I have tried the following so far:

On PlayerView component of layout XML, have added the following to disable hiding of controller, but it still requires clicking PlayerView the first time for controller to show up.

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

I need to capture onClick event on PlayerView which I was able to until I introduced the custom controller layout. I have PlayerView both focusable and clickable

android:focusable="true"
android:clickable="true"

Also, in an attempt to disable dragging of time bar in DefaultTimeBar, I did the following but it only removes the thumb (or scrubber) from the time bar, doesn't disable dragging:

app:scrubber_enabled_size="0dp"
app:scrubber_disabled_size="0dp"
app:scrubber_dragged_size="0dp"

Any ideas on how to do these 3 things?

Thanks,

AB

Abhishek Sharma
  • 609
  • 1
  • 11
  • 22

1 Answers1

3

Regarding the third thing you can try to do it programmatically.

You can ovveride this methods in your DefaultTimeBar:

  • onScrubStart(...)
  • onScrubMove(...)
  • onScrubStop(...)

and implement your logic for each of them (maybe a simple return is enough).

Please check this link for more details: OnScrubListener

Emanuele Tido
  • 213
  • 1
  • 4
  • Sorry, had edited my question with an update right after I posted this. This is how I am taking care of 3.: touch_target_height = "0dp" – Abhishek Sharma Nov 07 '19 at 14:12
  • we are having similar problem, where we just want to disable dragging on the scrubber whilst a certain piece of content (MP3) is playing. setting touch_target_height = "0dp" works, however is there a way to set this value programmatically ? – ajonno Feb 27 '20 at 01:56