public static class PlayerService.MediaSessionCallback
extends android.support.v4.media.session.MediaSessionCompat.Callback
PlayerService.onCreateMediaSessionCallback()
方法,
并返回一个自定义的 PlayerService.MediaSessionCallback
实现。
注意!在覆盖 PlayerService.MediaSessionCallback
的方法时,使用 super.xxx
回调超类被覆盖的方法,
因为 PlayerService
的部分功能依赖这些方法。如果没有使用 super.xxx
回调超类被覆盖的方法,则这部分功能将无法正常工作。
构造器和说明 |
---|
MediaSessionCallback(PlayerService playerService) |
限定符和类型 | 方法和说明 |
---|---|
android.support.v4.media.session.MediaSessionCompat |
getMediaSession()
获取播放器的 MediaSessionCompat 对象。
|
Player |
getPlayer()
获取播放器的
Player 对象。 |
PlayerService |
getPlayerService()
获取当前
PlayerService.MediaSessionCallback 关联到的 PlayerService 对象。 |
void |
onCustomAction(java.lang.String action,
android.os.Bundle extras) |
void |
onFastForward() |
boolean |
onMediaButtonEvent(android.content.Intent mediaButtonEvent) |
void |
onPause() |
void |
onPlay() |
void |
onRewind() |
void |
onSeekTo(long pos) |
void |
onSetRepeatMode(int repeatMode) |
void |
onSetShuffleMode(int shuffleMode) |
void |
onSkipToNext() |
void |
onSkipToPrevious() |
void |
onSkipToQueueItem(long id) |
void |
onStop() |
onAddQueueItem, onAddQueueItem, onCommand, onPlayFromMediaId, onPlayFromSearch, onPlayFromUri, onPrepare, onPrepareFromMediaId, onPrepareFromSearch, onPrepareFromUri, onRemoveQueueItem, onRemoveQueueItemAt, onSetCaptioningEnabled, onSetPlaybackSpeed, onSetRating, onSetRating
public MediaSessionCallback(@NonNull PlayerService playerService)
@NonNull public PlayerService getPlayerService()
PlayerService.MediaSessionCallback
关联到的 PlayerService
对象。public android.support.v4.media.session.MediaSessionCompat getMediaSession()
public boolean onMediaButtonEvent(android.content.Intent mediaButtonEvent)
onMediaButtonEvent
在类中 android.support.v4.media.session.MediaSessionCompat.Callback
public void onCustomAction(java.lang.String action, android.os.Bundle extras)
onCustomAction
在类中 android.support.v4.media.session.MediaSessionCompat.Callback
public void onPlay()
onPlay
在类中 android.support.v4.media.session.MediaSessionCompat.Callback
public void onSkipToQueueItem(long id)
onSkipToQueueItem
在类中 android.support.v4.media.session.MediaSessionCompat.Callback
public void onPause()
onPause
在类中 android.support.v4.media.session.MediaSessionCompat.Callback
public void onSkipToNext()
onSkipToNext
在类中 android.support.v4.media.session.MediaSessionCompat.Callback
public void onSkipToPrevious()
onSkipToPrevious
在类中 android.support.v4.media.session.MediaSessionCompat.Callback
public void onFastForward()
onFastForward
在类中 android.support.v4.media.session.MediaSessionCompat.Callback
public void onRewind()
onRewind
在类中 android.support.v4.media.session.MediaSessionCompat.Callback
public void onStop()
onStop
在类中 android.support.v4.media.session.MediaSessionCompat.Callback
public void onSeekTo(long pos)
onSeekTo
在类中 android.support.v4.media.session.MediaSessionCompat.Callback
public void onSetRepeatMode(int repeatMode)
onSetRepeatMode
在类中 android.support.v4.media.session.MediaSessionCompat.Callback
public void onSetShuffleMode(int shuffleMode)
onSetShuffleMode
在类中 android.support.v4.media.session.MediaSessionCompat.Callback