public class ListenerMux extends java.lang.Object implements ExoPlayerListener, android.media.MediaPlayer.OnPreparedListener, android.media.MediaPlayer.OnCompletionListener, android.media.MediaPlayer.OnErrorListener, android.media.MediaPlayer.OnBufferingUpdateListener, android.media.MediaPlayer.OnSeekCompleteListener, OnBufferUpdateListener, MetadataListener
ExoMediaPlayer,
Android VideoView, and the Android MediaPlayer to output to the correct
error listeners.| Modifier and Type | Class and Description |
|---|---|
static class |
ListenerMux.Notifier |
| Constructor and Description |
|---|
ListenerMux(ListenerMux.Notifier notifier) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearSurfaceWhenReady(ClearableSurface clearableSurface)
Specifies the surface to clear when the playback reaches an appropriate state.
|
boolean |
isPrepared()
Retrieves if the player was prepared
|
void |
onBufferingUpdate(int percent)
Called to update status in buffering a media stream.
|
void |
onBufferingUpdate(android.media.MediaPlayer mp,
int percent) |
void |
onCompletion(android.media.MediaPlayer mp) |
void |
onError(ExoMediaPlayer exoMediaPlayer,
java.lang.Exception e) |
boolean |
onError(android.media.MediaPlayer mp,
int what,
int extra) |
void |
onMetadata(com.google.android.exoplayer2.metadata.Metadata metadata)
Called each time there is a metadata associated with current playback time.
|
void |
onPrepared(android.media.MediaPlayer mp) |
void |
onSeekComplete()
Called to indicate the completion of a seek operation.
|
void |
onSeekComplete(android.media.MediaPlayer mp) |
void |
onStateChanged(boolean playWhenReady,
int playbackState) |
void |
onVideoSizeChanged(int width,
int height,
int unAppliedRotationDegrees,
float pixelWidthHeightRatio) |
void |
setMetadataListener(MetadataListener listener)
Sets the listener to inform of ID3 metadata updates
|
void |
setNotifiedCompleted(boolean wasNotified)
Sets weather the listener was notified when the playback was completed
(played through the end).
|
void |
setNotifiedPrepared(boolean wasNotified)
Sets weather the listener was notified when we became prepared.
|
void |
setOnBufferUpdateListener(OnBufferUpdateListener listener)
Sets the listener to inform of buffering updates
|
void |
setOnCompletionListener(OnCompletionListener listener)
Sets the listener to inform of VideoPlayer completion events
|
void |
setOnErrorListener(OnErrorListener listener)
Sets the listener to inform of playback errors
|
void |
setOnPreparedListener(OnPreparedListener listener)
Sets the listener to inform of VideoPlayer prepared events
|
void |
setOnSeekCompletionListener(OnSeekCompletionListener listener)
Sets the listener to inform of VideoPlayer seek completion events
|
public ListenerMux(@NonNull
ListenerMux.Notifier notifier)
public void onBufferingUpdate(android.media.MediaPlayer mp,
int percent)
onBufferingUpdate in interface android.media.MediaPlayer.OnBufferingUpdateListenerpublic void onCompletion(android.media.MediaPlayer mp)
onCompletion in interface android.media.MediaPlayer.OnCompletionListenerpublic boolean onError(android.media.MediaPlayer mp,
int what,
int extra)
onError in interface android.media.MediaPlayer.OnErrorListenerpublic void onSeekComplete(android.media.MediaPlayer mp)
onSeekComplete in interface android.media.MediaPlayer.OnSeekCompleteListenerpublic void onPrepared(android.media.MediaPlayer mp)
onPrepared in interface android.media.MediaPlayer.OnPreparedListenerpublic void onError(ExoMediaPlayer exoMediaPlayer, java.lang.Exception e)
onError in interface ExoPlayerListenerpublic void onStateChanged(boolean playWhenReady,
int playbackState)
onStateChanged in interface ExoPlayerListenerpublic void onSeekComplete()
OnSeekCompletionListeneronSeekComplete in interface OnSeekCompletionListenerpublic void onBufferingUpdate(int percent)
OnBufferUpdateListeneronBufferingUpdate in interface OnBufferUpdateListenerpercent - The integer percent that is buffered [0, 100] inclusivepublic void onMetadata(com.google.android.exoplayer2.metadata.Metadata metadata)
MetadataListeneronMetadata in interface MetadataListenermetadata - The metadata.public void onVideoSizeChanged(int width,
int height,
int unAppliedRotationDegrees,
float pixelWidthHeightRatio)
onVideoSizeChanged in interface ExoPlayerListenerpublic void clearSurfaceWhenReady(@Nullable
ClearableSurface clearableSurface)
clearableSurface is cleared, the reference will be removedclearableSurface - The ClearableSurface to clear when the playback reaches an appropriate statepublic void setOnPreparedListener(@Nullable
OnPreparedListener listener)
listener - The listener to informpublic void setOnCompletionListener(@Nullable
OnCompletionListener listener)
listener - The listener to informpublic void setOnBufferUpdateListener(@Nullable
OnBufferUpdateListener listener)
listener - The listener to informpublic void setOnSeekCompletionListener(@Nullable
OnSeekCompletionListener listener)
listener - The listener to informpublic void setOnErrorListener(@Nullable
OnErrorListener listener)
listener - The listener to informpublic void setMetadataListener(@Nullable
MetadataListener listener)
listener - The listener to informpublic void setNotifiedPrepared(boolean wasNotified)
wasNotified - True if the onPreparedListener was already notifiedpublic boolean isPrepared()
public void setNotifiedCompleted(boolean wasNotified)
wasNotified - True if the onCompletionListener was already notified