mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
parent
e961def004
commit
b4d72d12f7
2 changed files with 28 additions and 1 deletions
|
|
@ -6,6 +6,8 @@
|
||||||
to indicate whether a controller sent a play or only a prepare command. This
|
to indicate whether a controller sent a play or only a prepare command. This
|
||||||
allows to take advantage of decoder reuse with the MediaSessionConnector
|
allows to take advantage of decoder reuse with the MediaSessionConnector
|
||||||
([#5891](https://github.com/google/ExoPlayer/issues/5891)).
|
([#5891](https://github.com/google/ExoPlayer/issues/5891)).
|
||||||
|
* Add ProgressUpdateListener to PlayerControlView
|
||||||
|
([#5834](https://github.com/google/ExoPlayer/issues/5834)).
|
||||||
|
|
||||||
### 2.10.1 ###
|
### 2.10.1 ###
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -188,6 +188,18 @@ public class PlayerControlView extends FrameLayout {
|
||||||
void onVisibilityChange(int visibility);
|
void onVisibilityChange(int visibility);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Listener to be notified when progress has been updated. */
|
||||||
|
public interface ProgressUpdateListener {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when progress needs to be updated.
|
||||||
|
*
|
||||||
|
* @param position The current position.
|
||||||
|
* @param bufferedPosition The current buffered position.
|
||||||
|
*/
|
||||||
|
void onProgressUpdate(long position, long bufferedPosition);
|
||||||
|
}
|
||||||
|
|
||||||
/** The default fast forward increment, in milliseconds. */
|
/** The default fast forward increment, in milliseconds. */
|
||||||
public static final int DEFAULT_FAST_FORWARD_MS = 15000;
|
public static final int DEFAULT_FAST_FORWARD_MS = 15000;
|
||||||
/** The default rewind increment, in milliseconds. */
|
/** The default rewind increment, in milliseconds. */
|
||||||
|
|
@ -235,7 +247,8 @@ public class PlayerControlView extends FrameLayout {
|
||||||
|
|
||||||
@Nullable private Player player;
|
@Nullable private Player player;
|
||||||
private com.google.android.exoplayer2.ControlDispatcher controlDispatcher;
|
private com.google.android.exoplayer2.ControlDispatcher controlDispatcher;
|
||||||
private VisibilityListener visibilityListener;
|
@Nullable private VisibilityListener visibilityListener;
|
||||||
|
@Nullable private ProgressUpdateListener progressUpdateListener;
|
||||||
@Nullable private PlaybackPreparer playbackPreparer;
|
@Nullable private PlaybackPreparer playbackPreparer;
|
||||||
|
|
||||||
private boolean isAttachedToWindow;
|
private boolean isAttachedToWindow;
|
||||||
|
|
@ -454,6 +467,15 @@ public class PlayerControlView extends FrameLayout {
|
||||||
this.visibilityListener = listener;
|
this.visibilityListener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the {@link ProgressUpdateListener}.
|
||||||
|
*
|
||||||
|
* @param listener The listener to be notified about when progress is updated.
|
||||||
|
*/
|
||||||
|
public void setProgressUpdateListener(@Nullable ProgressUpdateListener listener) {
|
||||||
|
this.progressUpdateListener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the {@link PlaybackPreparer}.
|
* Sets the {@link PlaybackPreparer}.
|
||||||
*
|
*
|
||||||
|
|
@ -855,6 +877,9 @@ public class PlayerControlView extends FrameLayout {
|
||||||
timeBar.setPosition(position);
|
timeBar.setPosition(position);
|
||||||
timeBar.setBufferedPosition(bufferedPosition);
|
timeBar.setBufferedPosition(bufferedPosition);
|
||||||
}
|
}
|
||||||
|
if (progressUpdateListener != null) {
|
||||||
|
progressUpdateListener.onProgressUpdate(position, bufferedPosition);
|
||||||
|
}
|
||||||
|
|
||||||
// Cancel any pending updates and schedule a new one if necessary.
|
// Cancel any pending updates and schedule a new one if necessary.
|
||||||
removeCallbacks(updateProgressAction);
|
removeCallbacks(updateProgressAction);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue