public class

SessionPlayer.PlayerResult

extends java.lang.Object

implements BaseResult

 java.lang.Object

↳androidx.media2.common.SessionPlayer.PlayerResult

Subclasses:

MediaPlayer.DrmResult

Overview

Result class of the asynchronous APIs.

Subclass may extend this class for providing more result and/or custom result code. For the custom result code, follow the convention below to avoid potential code duplication.

  • Predefined error code: Negative integers greater than -100. (i.e. -100 < code < 0)
  • Custom error code: Negative integers equal to or less than -1000. (i.e. code < -1000)
  • Predefined info code: Positive integers less than 100. (i.e. 0 < code < 100)
  • Custom Info code: Positive integers equal to or greater than 1000. (i.e. code > +1000)

Summary

Constructors
publicPlayerResult(int resultCode, MediaItem item)

Constructor that uses the current system clock as the completion time.

Methods
public static <any>createFuture(int resultCode)

public longgetCompletionTime()

Gets the completion time of the command.

public MediaItemgetMediaItem()

Gets the MediaItem for which the command was executed.

public intgetResultCode()

Gets the result code.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public PlayerResult(int resultCode, MediaItem item)

Constructor that uses the current system clock as the completion time.

Parameters:

resultCode: result code. Recommends to use the standard code defined here.
item: media item when the command completed

Methods

public static <any> createFuture(int resultCode)

public int getResultCode()

Gets the result code.

Subclass of the SessionPlayer may have defined customized extra code other than codes defined here. Check the documentation of the class that you're interested in.

Returns:

result code

See also: BaseResult.RESULT_ERROR_UNKNOWN, BaseResult.RESULT_ERROR_INVALID_STATE, BaseResult.RESULT_ERROR_BAD_VALUE, BaseResult.RESULT_ERROR_PERMISSION_DENIED, BaseResult.RESULT_ERROR_IO, BaseResult.RESULT_ERROR_NOT_SUPPORTED, BaseResult.RESULT_INFO_SKIPPED

public long getCompletionTime()

Gets the completion time of the command. Being more specific, it's the same as when the command completed.

Returns:

completion time of the command

public MediaItem getMediaItem()

Gets the MediaItem for which the command was executed. In other words, this is the item sent as an argument of the command if any, otherwise the current media item when the command completed.

Returns:

media item when the command completed. Can be null for an error, or the current media item was null