Skip to content

Most visited

Recently visited

navigation

MediaController.Callback

public static abstract class MediaController.Callback
extends Object

java.lang.Object
   ↳ android.media.session.MediaController.Callback


Callback for receiving updates from the session. A Callback can be registered using registerCallback(MediaController.Callback).

Summary

Public constructors

MediaController.Callback()

Public methods

void onAudioInfoChanged(MediaController.PlaybackInfo info)

Override to handle changes to the audio info.

void onExtrasChanged(Bundle extras)

Override to handle changes to the MediaSession extras.

void onMetadataChanged(MediaMetadata metadata)

Override to handle changes to the current metadata.

void onPlaybackStateChanged(PlaybackState state)

Override to handle changes in playback state.

void onQueueChanged(List<MediaSession.QueueItem> queue)

Override to handle changes to items in the queue.

void onQueueTitleChanged(CharSequence title)

Override to handle changes to the queue title.

void onSessionDestroyed()

Override to handle the session being destroyed.

void onSessionEvent(String event, Bundle extras)

Override to handle custom events sent by the session owner without a specified interface.

Inherited methods

From class java.lang.Object

Public constructors

MediaController.Callback

added in API level 21
MediaController.Callback ()

Public methods

onAudioInfoChanged

added in API level 21
void onAudioInfoChanged (MediaController.PlaybackInfo info)

Override to handle changes to the audio info.

Parameters
info MediaController.PlaybackInfo: The current audio info for this session.

onExtrasChanged

added in API level 21
void onExtrasChanged (Bundle extras)

Override to handle changes to the MediaSession extras.

Parameters
extras Bundle: The extras that can include other information associated with the MediaSession.

This value may be null.

onMetadataChanged

added in API level 21
void onMetadataChanged (MediaMetadata metadata)

Override to handle changes to the current metadata.

Parameters
metadata MediaMetadata: The current metadata for the session or null if none.

See also:

onPlaybackStateChanged

added in API level 21
void onPlaybackStateChanged (PlaybackState state)

Override to handle changes in playback state.

Parameters
state PlaybackState: The new playback state of the session

This value must never be null.

onQueueChanged

added in API level 21
void onQueueChanged (List<MediaSession.QueueItem> queue)

Override to handle changes to items in the queue.

Parameters
queue List: A list of items in the current play queue. It should include the currently playing item as well as previous and upcoming items if applicable.

This value may be null.

See also:

onQueueTitleChanged

added in API level 21
void onQueueTitleChanged (CharSequence title)

Override to handle changes to the queue title.

Parameters
title CharSequence: The title that should be displayed along with the play queue such as "Now Playing". May be null if there is no such title.

onSessionDestroyed

added in API level 21
void onSessionDestroyed ()

Override to handle the session being destroyed. The session is no longer valid after this call and calls to it will be ignored.

onSessionEvent

added in API level 21
void onSessionEvent (String event, 
                Bundle extras)

Override to handle custom events sent by the session owner without a specified interface. Controllers should only handle these for sessions they own.

Parameters
event String: The event from the session.

This value must never be null.

extras Bundle: Optional parameters for the event, may be null.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)