/**@class android.media.RemoteControlClient @extends java.lang.Object RemoteControlClient enables exposing information meant to be consumed by remote controls capable of displaying metadata, artwork and media transport control buttons. <p>A remote control client object is associated with a media button event receiver. This event receiver must have been previously registered with {@link android.media.AudioManager#registerMediaButtonEventReceiver(ComponentName)} before the RemoteControlClient can be registered through {@link android.media.AudioManager#registerRemoteControlClient(RemoteControlClient)}. <p>Here is an example of creating a RemoteControlClient instance after registering a media button event receiver: <pre>ComponentName myEventReceiver = new ComponentName(getPackageName(), MyRemoteControlEventReceiver.class.getName()); AudioManager myAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); myAudioManager.registerMediaButtonEventReceiver(myEventReceiver); // build the PendingIntent for the remote control client Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON); mediaButtonIntent.setComponent(myEventReceiver); PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, mediaButtonIntent, 0); // create and register the remote control client RemoteControlClient myRemoteControlClient = new RemoteControlClient(mediaPendingIntent); myAudioManager.registerRemoteControlClient(myRemoteControlClient);</pre> @deprecated Use {@link MediaSession} instead. */ var RemoteControlClient = { /** Playback state of a RemoteControlClient which is stopped. @see #setPlaybackState(int) */ PLAYSTATE_STOPPED : "1", /** Playback state of a RemoteControlClient which is paused. @see #setPlaybackState(int) */ PLAYSTATE_PAUSED : "2", /** Playback state of a RemoteControlClient which is playing media. @see #setPlaybackState(int) */ PLAYSTATE_PLAYING : "3", /** Playback state of a RemoteControlClient which is fast forwarding in the media it is currently playing. @see #setPlaybackState(int) */ PLAYSTATE_FAST_FORWARDING : "4", /** Playback state of a RemoteControlClient which is fast rewinding in the media it is currently playing. @see #setPlaybackState(int) */ PLAYSTATE_REWINDING : "5", /** Playback state of a RemoteControlClient which is skipping to the next logical chapter (such as a song in a playlist) in the media it is currently playing. @see #setPlaybackState(int) */ PLAYSTATE_SKIPPING_FORWARDS : "6", /** Playback state of a RemoteControlClient which is skipping back to the previous logical chapter (such as a song in a playlist) in the media it is currently playing. @see #setPlaybackState(int) */ PLAYSTATE_SKIPPING_BACKWARDS : "7", /** Playback state of a RemoteControlClient which is buffering data to play before it can start or resume playback. @see #setPlaybackState(int) */ PLAYSTATE_BUFFERING : "8", /** Playback state of a RemoteControlClient which cannot perform any playback related operation because of an internal error. Examples of such situations are no network connectivity when attempting to stream data from a server, or expired user credentials when trying to play subscription-based content. @see #setPlaybackState(int) */ PLAYSTATE_ERROR : "9", /** @hide The value of a playback state when none has been declared. Intentionally hidden as an application shouldn't set such a playback state value. */ PLAYSTATE_NONE : "0", /** @hide The default playback type, "local", indicating the presentation of the media is happening on the same device (e.g. a phone, a tablet) as where it is controlled from. */ PLAYBACK_TYPE_LOCAL : "0", /** @hide A playback type indicating the presentation of the media is happening on a different device (i.e. the remote device) than where it is controlled from. */ PLAYBACK_TYPE_REMOTE : "1", /** @hide Playback information indicating the playback volume is fixed, i.e. it cannot be controlled from this object. An example of fixed playback volume is a remote player, playing over HDMI where the user prefer to control the volume on the HDMI sink, rather than attenuate at the source. @see #PLAYBACKINFO_VOLUME_HANDLING. */ PLAYBACK_VOLUME_FIXED : "0", /** @hide Playback information indicating the playback volume is variable and can be controlled from this object. @see #PLAYBACKINFO_VOLUME_HANDLING. */ PLAYBACK_VOLUME_VARIABLE : "1", /** @hide (to be un-hidden) The playback information value indicating the value of a given information type is invalid. @see #PLAYBACKINFO_VOLUME_HANDLING. */ PLAYBACKINFO_INVALID_VALUE : "-2147483648", /** @hide An unknown or invalid playback position value. */ PLAYBACK_POSITION_INVALID : "-1", /** @hide An invalid playback position value associated with the use of {@link #setPlaybackState}(int) used to indicate that playback position will remain unknown. */ PLAYBACK_POSITION_ALWAYS_UNKNOWN : "-9216204211029966080", /** @hide The default playback speed, 1x. */ PLAYBACK_SPEED_1X : "1.0", /** @hide Playback information that defines the type of playback associated with this RemoteControlClient. See {@link #PLAYBACK_TYPE_LOCAL} and {@link #PLAYBACK_TYPE_REMOTE}. */ PLAYBACKINFO_PLAYBACK_TYPE : "1", /** @hide Playback information that defines at what volume the playback associated with this RemoteControlClient is performed. This information is only used when the playback type is not local (see {@link #PLAYBACKINFO_PLAYBACK_TYPE}). */ PLAYBACKINFO_VOLUME : "2", /** @hide Playback information that defines the maximum volume volume value that is supported by the playback associated with this RemoteControlClient. This information is only used when the playback type is not local (see {@link #PLAYBACKINFO_PLAYBACK_TYPE}). */ PLAYBACKINFO_VOLUME_MAX : "3", /** @hide Playback information that defines how volume is handled for the presentation of the media. @see #PLAYBACK_VOLUME_FIXED @see #PLAYBACK_VOLUME_VARIABLE */ PLAYBACKINFO_VOLUME_HANDLING : "4", /** @hide Playback information that defines over what stream type the media is presented. */ PLAYBACKINFO_USES_STREAM : "5", /** Flag indicating a RemoteControlClient makes use of the "previous" media key. @see #setTransportControlFlags(int) @see android.view.KeyEvent#KEYCODE_MEDIA_PREVIOUS */ FLAG_KEY_MEDIA_PREVIOUS : "1", /** Flag indicating a RemoteControlClient makes use of the "rewind" media key. @see #setTransportControlFlags(int) @see android.view.KeyEvent#KEYCODE_MEDIA_REWIND */ FLAG_KEY_MEDIA_REWIND : "2", /** Flag indicating a RemoteControlClient makes use of the "play" media key. @see #setTransportControlFlags(int) @see android.view.KeyEvent#KEYCODE_MEDIA_PLAY */ FLAG_KEY_MEDIA_PLAY : "4", /** Flag indicating a RemoteControlClient makes use of the "play/pause" media key. @see #setTransportControlFlags(int) @see android.view.KeyEvent#KEYCODE_MEDIA_PLAY_PAUSE */ FLAG_KEY_MEDIA_PLAY_PAUSE : "8", /** Flag indicating a RemoteControlClient makes use of the "pause" media key. @see #setTransportControlFlags(int) @see android.view.KeyEvent#KEYCODE_MEDIA_PAUSE */ FLAG_KEY_MEDIA_PAUSE : "16", /** Flag indicating a RemoteControlClient makes use of the "stop" media key. @see #setTransportControlFlags(int) @see android.view.KeyEvent#KEYCODE_MEDIA_STOP */ FLAG_KEY_MEDIA_STOP : "32", /** Flag indicating a RemoteControlClient makes use of the "fast forward" media key. @see #setTransportControlFlags(int) @see android.view.KeyEvent#KEYCODE_MEDIA_FAST_FORWARD */ FLAG_KEY_MEDIA_FAST_FORWARD : "64", /** Flag indicating a RemoteControlClient makes use of the "next" media key. @see #setTransportControlFlags(int) @see android.view.KeyEvent#KEYCODE_MEDIA_NEXT */ FLAG_KEY_MEDIA_NEXT : "128", /** Flag indicating a RemoteControlClient can receive changes in the media playback position through the {@link android.media.AudioTrack.OnPlaybackPositionUpdateListener} interface. This flag must be set in order for components that display the RemoteControlClient information, to display and let the user control media playback position. @see #setTransportControlFlags(int) @see #setOnGetPlaybackPositionListener(OnGetPlaybackPositionListener) @see #setPlaybackPositionUpdateListener(OnPlaybackPositionUpdateListener) */ FLAG_KEY_MEDIA_POSITION_UPDATE : "256", /** Flag indicating a RemoteControlClient supports ratings. This flag must be set in order for components that display the RemoteControlClient information, to display ratings information, and, if ratings are declared editable (by calling {@link android.media.MediaMetadataEditor#addEditableKey(int)} with the {@link android.media.MediaMetadataEditor#RATING_KEY_BY_USER} key), it will enable the user to rate the media, with values being received through the interface set with {@link #setMetadataUpdateListener}(OnMetadataUpdateListener). @see #setTransportControlFlags(int) */ FLAG_KEY_MEDIA_RATING : "512", /** @hide The flags for when no media keys are declared supported. Intentionally hidden as an application shouldn't set the transport control flags to this value. */ FLAGS_KEY_MEDIA_NONE : "0", /** @hide Flag used to signal some type of metadata exposed by the RemoteControlClient is requested. */ FLAG_INFORMATION_REQUEST_METADATA : "1", /** @hide Flag used to signal that the transport control buttons supported by the RemoteControlClient are requested. This can for instance happen when playback is at the end of a playlist, and the "next" operation is not supported anymore. */ FLAG_INFORMATION_REQUEST_KEY_MEDIA : "2", /** @hide Flag used to signal that the playback state of the RemoteControlClient is requested. */ FLAG_INFORMATION_REQUEST_PLAYSTATE : "4", /** @hide Flag used to signal that the album art for the RemoteControlClient is requested. */ FLAG_INFORMATION_REQUEST_ALBUM_ART : "8", /** @hide Flag to reflect that the application controlling this RemoteControlClient sends playback position updates. The playback position being "readable" is considered from the application's point of view. */ MEDIA_POSITION_READABLE : "null", /** @hide Flag to reflect that the application controlling this RemoteControlClient can receive playback position updates. The playback position being "writable" is considered from the application's point of view. */ MEDIA_POSITION_WRITABLE : "null", /**@hide */ DEFAULT_PLAYBACK_VOLUME_HANDLING : "1", /**@hide */ DEFAULT_PLAYBACK_VOLUME : "15", /** @hide Default value for the unique identifier */ RCSE_ID_UNREGISTERED : "-1", /** @hide */ registerWithSession : function( ) {}, /** @hide */ unregisterWithSession : function( ) {}, /**Get a {@link MediaSession} associated with this RCC. It will only have a session while it is registered with {@link android.media.AudioManager#registerRemoteControlClient}. The session returned should not be modified directly by the application but may be used with other APIs that require a session. @return {Object {android.media.session.MediaSession}} A media session object or null. */ getMediaSession : function( ) {}, /**Creates a {@link android.media.MetadataEditor}. @param {Boolean} startEmpty Set to false if you want the MetadataEditor to contain the metadata that was previously applied to the RemoteControlClient, or true if it is to be created empty. @return {Object {android.media.RemoteControlClient.MetadataEditor}} a new MetadataEditor instance. */ editMetadata : function( ) {}, /**Sets the current playback state. @param {Number} state The current playback state, one of the following values: {@link #PLAYSTATE_STOPPED}, {@link #PLAYSTATE_PAUSED}, {@link #PLAYSTATE_PLAYING}, {@link #PLAYSTATE_FAST_FORWARDING}, {@link #PLAYSTATE_REWINDING}, {@link #PLAYSTATE_SKIPPING_FORWARDS}, {@link #PLAYSTATE_SKIPPING_BACKWARDS}, {@link #PLAYSTATE_BUFFERING}, {@link #PLAYSTATE_ERROR}. */ setPlaybackState : function( ) {}, /**Sets the current playback state and the matching media position for the current playback speed. @param {Number} state The current playback state, one of the following values: {@link #PLAYSTATE_STOPPED}, {@link #PLAYSTATE_PAUSED}, {@link #PLAYSTATE_PLAYING}, {@link #PLAYSTATE_FAST_FORWARDING}, {@link #PLAYSTATE_REWINDING}, {@link #PLAYSTATE_SKIPPING_FORWARDS}, {@link #PLAYSTATE_SKIPPING_BACKWARDS}, {@link #PLAYSTATE_BUFFERING}, {@link #PLAYSTATE_ERROR}. @param {Number} timeInMs a 0 or positive value for the current media position expressed in ms (same unit as for when sending the media duration, if applicable, with {@link android.media.MediaMetadataRetriever#METADATA_KEY_DURATION} in the {@link RemoteControlClient.MetadataEditor}). Negative values imply that position is not known (e.g. listening to a live stream of a radio) or not applicable (e.g. when state is {@link #PLAYSTATE_BUFFERING} and nothing had played yet). @param {Number} playbackSpeed a value expressed as a ratio of 1x playback: 1.0f is normal playback, 2.0f is 2x, 0.5f is half-speed, -2.0f is rewind at 2x speed. 0.0f means nothing is playing (e.g. when state is {@link #PLAYSTATE_ERROR}). */ setPlaybackState : function( ) {}, /**Sets the flags for the media transport control buttons that this client supports. @param {Number} transportControlFlags A combination of the following flags: {@link #FLAG_KEY_MEDIA_PREVIOUS}, {@link #FLAG_KEY_MEDIA_REWIND}, {@link #FLAG_KEY_MEDIA_PLAY}, {@link #FLAG_KEY_MEDIA_PLAY_PAUSE}, {@link #FLAG_KEY_MEDIA_PAUSE}, {@link #FLAG_KEY_MEDIA_STOP}, {@link #FLAG_KEY_MEDIA_FAST_FORWARD}, {@link #FLAG_KEY_MEDIA_NEXT}, {@link #FLAG_KEY_MEDIA_POSITION_UPDATE}, {@link #FLAG_KEY_MEDIA_RATING}. */ setTransportControlFlags : function( ) {}, /**Sets the listener to be called whenever the metadata is updated. New metadata values will be received in the same thread as the one in which RemoteControlClient was created. @param {Object {RemoteControlClient.OnMetadataUpdateListener}} l the metadata update listener */ setMetadataUpdateListener : function( ) {}, /**Sets the listener to be called whenever the media playback position is requested to be updated. Notifications will be received in the same thread as the one in which RemoteControlClient was created. @param {Object {RemoteControlClient.OnPlaybackPositionUpdateListener}} l the position update listener to be called */ setPlaybackPositionUpdateListener : function( ) {}, /**Sets the listener to be called whenever the media current playback position is needed. Queries will be received in the same thread as the one in which RemoteControlClient was created. @param {Object {RemoteControlClient.OnGetPlaybackPositionListener}} l the listener to be called to retrieve the playback position */ setOnGetPlaybackPositionListener : function( ) {}, /** @hide Accessor to media button intent description (includes target component) */ getRcMediaIntent : function( ) {}, };