Methods Summary |
---|
public void | adjustVolume(int direction, int flags)Adjust the volume of the output this session is playing on. The direction
must be one of {@link AudioManager#ADJUST_LOWER},
{@link AudioManager#ADJUST_RAISE}, or {@link AudioManager#ADJUST_SAME}.
The command will be ignored if the session does not support
{@link VolumeProviderCompat#VOLUME_CONTROL_RELATIVE} or
{@link VolumeProviderCompat#VOLUME_CONTROL_ABSOLUTE}. The flags in
{@link AudioManager} may be used to affect the handling.
mImpl.adjustVolume(direction, flags);
|
public boolean | dispatchMediaButtonEvent(android.view.KeyEvent keyEvent)Send the specified media button event to the session. Only media keys can
be sent by this method, other keys will be ignored.
if (keyEvent == null) {
throw new IllegalArgumentException("KeyEvent may not be null");
}
return mImpl.dispatchMediaButtonEvent(keyEvent);
|
public android.os.Bundle | getExtras()Get the extras for this session.
return mImpl.getExtras();
|
public long | getFlags()Get the flags for this session. Flags are defined in
{@link MediaSessionCompat}.
return mImpl.getFlags();
|
public java.lang.Object | getMediaController()Gets the underlying framework
{@link android.media.session.MediaController} object.
This method is only supported on API 21+.
return mImpl.getMediaController();
|
public android.support.v4.media.MediaMetadataCompat | getMetadata()Get the current metadata for this session.
return mImpl.getMetadata();
|
public java.lang.String | getPackageName()Get the session owner's package name.
return mImpl.getPackageName();
|
public android.support.v4.media.session.MediaControllerCompat$PlaybackInfo | getPlaybackInfo()Get the current playback info for this session.
return mImpl.getPlaybackInfo();
|
public PlaybackStateCompat | getPlaybackState()Get the current playback state for this session.
return mImpl.getPlaybackState();
|
public java.util.List | getQueue()Get the current play queue for this session if one is set. If you only
care about the current item {@link #getMetadata()} should be used.
return mImpl.getQueue();
|
public java.lang.CharSequence | getQueueTitle()Get the queue title for this session.
return mImpl.getQueueTitle();
|
public int | getRatingType()Get the rating type supported by the session. One of:
- {@link RatingCompat#RATING_NONE}
- {@link RatingCompat#RATING_HEART}
- {@link RatingCompat#RATING_THUMB_UP_DOWN}
- {@link RatingCompat#RATING_3_STARS}
- {@link RatingCompat#RATING_4_STARS}
- {@link RatingCompat#RATING_5_STARS}
- {@link RatingCompat#RATING_PERCENTAGE}
return mImpl.getRatingType();
|
public android.app.PendingIntent | getSessionActivity()Get an intent for launching UI associated with this session if one
exists.
return mImpl.getSessionActivity();
|
public MediaSessionCompat.Token | getSessionToken()Get the token for the session this controller is connected to.
return mToken;
|
public android.support.v4.media.session.MediaControllerCompat$TransportControls | getTransportControls()Get a {@link TransportControls} instance for this session.
return mImpl.getTransportControls();
|
public void | registerCallback(android.support.v4.media.session.MediaControllerCompat$Callback callback)Adds a callback to receive updates from the Session. Updates will be
posted on the caller's thread.
registerCallback(callback, null);
|
public void | registerCallback(android.support.v4.media.session.MediaControllerCompat$Callback callback, android.os.Handler handler)Adds a callback to receive updates from the session. Updates will be
posted on the specified handler's thread.
if (callback == null) {
throw new IllegalArgumentException("callback cannot be null");
}
if (handler == null) {
handler = new Handler();
}
mImpl.registerCallback(callback, handler);
|
public void | sendCommand(java.lang.String command, android.os.Bundle params, android.os.ResultReceiver cb)Sends a generic command to the session. It is up to the session creator
to decide what commands and parameters they will support. As such,
commands should only be sent to sessions that the controller owns.
if (TextUtils.isEmpty(command)) {
throw new IllegalArgumentException("command cannot be null or empty");
}
mImpl.sendCommand(command, params, cb);
|
public void | setVolumeTo(int value, int flags)Set the volume of the output this session is playing on. The command will
be ignored if it does not support
{@link VolumeProviderCompat#VOLUME_CONTROL_ABSOLUTE}. The flags in
{@link AudioManager} may be used to affect the handling.
mImpl.setVolumeTo(value, flags);
|
public void | unregisterCallback(android.support.v4.media.session.MediaControllerCompat$Callback callback)Stop receiving updates on the specified callback. If an update has
already been posted you may still receive it after calling this method.
if (callback == null) {
throw new IllegalArgumentException("callback cannot be null");
}
mImpl.unregisterCallback(callback);
|