public class PlayerListener extends java.lang.Object implements IPlayer.Listener
IPlayer.addListener(IPlayer.Listener)
Constructor and Description |
---|
PlayerListener() |
Modifier and Type | Method and Description |
---|---|
void |
onABProgress(long position,
long duration,
int abState)
WARNING: use position,duration in
C.STATE_PROGRESS_AB_FINISH , remember to do the
judgment(position>=0 && duration>position) |
void |
onAdded() |
boolean |
onAudioFocusChange(int focusChange) |
void |
onBufferingUpdate(int percent) |
int |
onCompletion() |
boolean |
onError(int what,
int extra,
java.lang.Exception e) |
boolean |
onInfo(int what,
int extra) |
boolean |
onIntent(android.content.Intent intent) |
void |
onNotificationRequired(int order)
Notification request(by PlayerService and Notifier maintain)
|
boolean |
onPlayProgress(long position,
long duration) |
void |
onPositionUnitProgress(long position,
int posUnitIndex,
int posUnitState)
WARNING: use position|posUnitIndex in
C.STATE_PROGRESS_POS_UNIT_FINISH , remember to
do the judgment(position>=0) | (posUnitIndex>=0) |
void |
onPrepared() |
void |
onRemoved()
Some need long term stationed, can be add again when on removed.
|
void |
onSeekComplete() |
void |
onStateChanged(int playbackState)
Called when the value returned from
IPlayerBase.getPlaybackState() changes. |
void |
onVideoSizeChanged(int width,
int height,
int unappliedRotationDegrees,
float pixelWidthHeightRatio) |
public void onPrepared()
onPrepared
in interface IPlayerBase.Listener
public void onBufferingUpdate(int percent)
onBufferingUpdate
in interface IPlayerBase.Listener
public void onSeekComplete()
onSeekComplete
in interface IPlayerBase.Listener
public int onCompletion()
onCompletion
in interface IPlayerBase.Listener
C.CMD_RETURN_FORCED
/C.CMD_RETURN_NORMAL
public boolean onInfo(int what, int extra)
onInfo
in interface IPlayerBase.Listener
public boolean onError(int what, int extra, java.lang.Exception e)
onError
in interface IPlayerBase.Listener
public void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio)
onVideoSizeChanged
in interface IPlayerBase.Listener
public void onStateChanged(int playbackState)
IPlayerBase.Listener
IPlayerBase.getPlaybackState()
changes.onStateChanged
in interface IPlayerBase.Listener
public boolean onPlayProgress(long position, long duration)
onPlayProgress
in interface IPlayer.Listener
position
- current play positionduration
- play durationIPlayer.setUpdatePlayProgressDelayMs(long)
public void onPositionUnitProgress(long position, int posUnitIndex, int posUnitState)
IPlayer.Listener
C.STATE_PROGRESS_POS_UNIT_FINISH
, remember to
do the judgment(position>=0) | (posUnitIndex>=0)onPositionUnitProgress
in interface IPlayer.Listener
position
- current play positionposUnitIndex
- current position unit indexposUnitState
- IPlayer.setUpdatePlayProgressDelayMs(long)
public void onABProgress(long position, long duration, int abState)
IPlayer.Listener
C.STATE_PROGRESS_AB_FINISH
, remember to do the
judgment(position>=0 && duration>position)onABProgress
in interface IPlayer.Listener
position
- current play ab position (position - abStartPosition)duration
- ab duration (abEndPosition - abStartPosition)abState
- IPlayer.setUpdatePlayProgressDelayMs(long)
public void onNotificationRequired(int order)
IPlayer.Listener
If you have a custom condition to control whether or not the request notification -> override
@Override public void onNotificationRequired(int order) { if (request conditions) { super.onNotificationRequired(order); } else { super.onNotificationRequired(0); } }
onNotificationRequired
in interface IPlayer.Listener
order
- public boolean onAudioFocusChange(int focusChange)
onAudioFocusChange
in interface IPlayer.Listener
public boolean onIntent(android.content.Intent intent)
onIntent
in interface IPlayer.Listener
public void onAdded()
onAdded
in interface IPlayer.Listener
public void onRemoved()
IPlayer.Listener
onRemoved
in interface IPlayer.Listener