mirror of
https://github.com/samsonjs/media.git
synced 2026-04-04 11:05:47 +00:00
Document that custom commands can only be sent if they are defined
Custom commands from controller to session are blocked if they are
not listed in the available session command list. This isn't well
documented in the Javadoc currently.
#minor-release
PiperOrigin-RevId: 514733568
(cherry picked from commit 20669fca27)
This commit is contained in:
parent
e7f49a8cc8
commit
687362e6fe
2 changed files with 7 additions and 2 deletions
|
|
@ -905,13 +905,14 @@ public class MediaController implements Player {
|
|||
/**
|
||||
* Sends a custom command to the session.
|
||||
*
|
||||
* <p>A command is not accepted if it is not a custom command or the command is not in the list of
|
||||
* {@linkplain #getAvailableSessionCommands() available session commands}.
|
||||
*
|
||||
* <p>Interoperability: When connected to {@link
|
||||
* android.support.v4.media.session.MediaSessionCompat}, {@link SessionResult#resultCode} will
|
||||
* return the custom result code from the {@code android.os.ResultReceiver#onReceiveResult(int,
|
||||
* Bundle)} instead of the standard result codes defined in the {@link SessionResult}.
|
||||
*
|
||||
* <p>A command is not accepted if it is not a custom command.
|
||||
*
|
||||
* @param command The custom command.
|
||||
* @param args The additional arguments. May be empty.
|
||||
* @return A {@link ListenableFuture} of {@link SessionResult} representing the pending
|
||||
|
|
|
|||
|
|
@ -1042,6 +1042,10 @@ public class MediaSession {
|
|||
* Called when a controller sent a custom command through {@link
|
||||
* MediaController#sendCustomCommand(SessionCommand, Bundle)}.
|
||||
*
|
||||
* <p>{@link MediaController} instances are only allowed to send a command if the command has
|
||||
* been added to the {@link MediaSession.ConnectionResult#availableSessionCommands list of
|
||||
* available session commands} in {@link #onConnect} or set via {@link #setAvailableCommands}.
|
||||
*
|
||||
* <p>Interoperability: This will be also called by {@link
|
||||
* android.support.v4.media.MediaBrowserCompat#sendCustomAction}. If so, {@code extras} from
|
||||
* {@link android.support.v4.media.MediaBrowserCompat#sendCustomAction} will be considered as
|
||||
|
|
|
|||
Loading…
Reference in a new issue