Interface SessionCallbackBuilder.CustomCommandProvider

Enclosing class:
SessionCallbackBuilder

public static interface SessionCallbackBuilder.CustomCommandProvider
Callbacks for querying what custom commands are supported, and for handling a custom command when a controller sends it.
  • Method Summary

    Modifier and Type
    Method
    Description
    androidx.media2.session.SessionCommandGroup
    getCustomCommands(androidx.media2.session.MediaSession session, androidx.media2.session.MediaSession.ControllerInfo controllerInfo)
    Returns a SessionCommandGroup with custom commands to publish to the controller, or null if no custom commands should be published.
    androidx.media2.session.SessionResult
    onCustomCommand(androidx.media2.session.MediaSession session, androidx.media2.session.MediaSession.ControllerInfo controllerInfo, androidx.media2.session.SessionCommand customCommand, Bundle args)
    Called when a controller has sent a custom command.
  • Method Details

    • onCustomCommand

      androidx.media2.session.SessionResult onCustomCommand(androidx.media2.session.MediaSession session, androidx.media2.session.MediaSession.ControllerInfo controllerInfo, androidx.media2.session.SessionCommand customCommand, @Nullable Bundle args)
      Called when a controller has sent a custom command.
      Parameters:
      session - The media session.
      controllerInfo - The MediaSession.ControllerInfo for the controller that sent the custom command.
      customCommand - A SessionCommand from the controller.
      args - A Bundle with the extra argument.
      See Also:
      • MediaSession.SessionCallback.onCustomCommand(MediaSession, MediaSession.ControllerInfo, SessionCommand, Bundle)
      • MediaController.sendCustomCommand(SessionCommand, Bundle)
    • getCustomCommands

      @Nullable androidx.media2.session.SessionCommandGroup getCustomCommands(androidx.media2.session.MediaSession session, androidx.media2.session.MediaSession.ControllerInfo controllerInfo)
      Returns a SessionCommandGroup with custom commands to publish to the controller, or null if no custom commands should be published.
      Parameters:
      session - The media session.
      controllerInfo - The MediaSession.ControllerInfo for the controller that is requesting custom commands.
      Returns:
      The custom commands to publish, or null if no custom commands should be published.