ASLLOP
ASLLOP

Reputation: 161

ExoPlayer Seek Start and Seek End events

I implemented the AnalyticsListener interface and I'm listening "onSeekStarted" and "onSeekProcessed" events.

In ExoPlayer when I start seeking I don't get any event. When I release the slider I get the "onSeekStarted", then the video recalculates the position and when the video starts playing again from the new position, I get the "onSeekProcessed". This is not what I need.

What I need is an event when the user starts seeking the slider (Seek Start) and one more event when the user releases the slider (Seek End). Is there any way to achieve it with ExoPlayer ?

I'm using ExoPlayer 2.9

Upvotes: 0

Views: 5009

Answers (1)

Harneev
Harneev

Reputation: 554

As per AnalyticsListener documentation:

/**
 * Called when a seek operation started.
 *
 * @param eventTime The event time.
 */
 void onSeekStarted(EventTime eventTime);

/**
 * Called when a seek operation was processed.
 *
 * @param eventTime The event time.
 */
void onSeekProcessed(EventTime eventTime);

So these callbacks are triggered when player playback position is changed and what you are looking for is scrubbing listener.

I assume you are using PlayerView with stock player controls turned on i.e. PlayerControlView but this class only support visibility change listener VisibilityListener and supports no other callback / listener.

So to handle scrubStart and scrubStop operations one has to create a custom android.widget.SeekBar and handle callback from

SeekBar.OnSeekBarChangeListener

onStartTrackingTouch and onStopTrackingTouch callbacks will do exactly what you desire to. I hope this helps

Upvotes: 1

Related Questions