@UnstableApi
class DrmUtil


DRM-related utility methods.

Summary

Nested types

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = )
@IntDef(value = )
annotation DrmUtil.ErrorSource

Identifies the operation which caused a DRM-related error.

Constants

const Int

Corresponds to failures caused by an ExoMediaDrm method call.

const Int

Corresponds to failures caused by an operation related to obtaining DRM licenses.

const Int

Corresponds to failures caused by an operation related to provisioning the device.

Public functions

java-static ByteArray<Byte>!
executePost(
    dataSource: DataSource!,
    url: String!,
    httpBody: ByteArray?,
    requestProperties: (Mutable)Map<String!, String!>!
)

Executes a HTTP POST request with retry handling and returns the entire response in a byte buffer.

java-static Int

Returns the PlaybackException.ErrorCode that corresponds to the given DRM-related exception.

java-static Boolean

Returns true if e represents a failure to construct a NotProvisionedException.

java-static Boolean

Returns true if e represents a failure to construct a ResourceBusyException.

Constants

ERROR_SOURCE_EXO_MEDIA_DRM

const val ERROR_SOURCE_EXO_MEDIA_DRM = 1: Int

Corresponds to failures caused by an ExoMediaDrm method call.

ERROR_SOURCE_LICENSE_ACQUISITION

const val ERROR_SOURCE_LICENSE_ACQUISITION = 2: Int

Corresponds to failures caused by an operation related to obtaining DRM licenses.

ERROR_SOURCE_PROVISIONING

const val ERROR_SOURCE_PROVISIONING = 3: Int

Corresponds to failures caused by an operation related to provisioning the device.

Public functions

executePost

java-static fun executePost(
    dataSource: DataSource!,
    url: String!,
    httpBody: ByteArray?,
    requestProperties: (Mutable)Map<String!, String!>!
): ByteArray<Byte>!

Executes a HTTP POST request with retry handling and returns the entire response in a byte buffer.

Note that this method is executing the request synchronously and blocks until finished.

Parameters
dataSource: DataSource!

A DataSource.

url: String!

The requested URL.

httpBody: ByteArray?

The HTTP request payload.

requestProperties: (Mutable)Map<String!, String!>!

A keyed map of HTTP header request properties.

Returns
ByteArray<Byte>!

A byte array that holds the response payload.

Throws
androidx.media3.exoplayer.drm.MediaDrmCallbackException

if an exception was encountered during the download.

getErrorCodeForMediaDrmException

@PlaybackException.ErrorCode
java-static fun getErrorCodeForMediaDrmException(
    exception: Throwable!,
    @DrmUtil.ErrorSource errorSource: Int
): Int

Returns the PlaybackException.ErrorCode that corresponds to the given DRM-related exception.

Parameters
exception: Throwable!

The DRM-related exception for which to obtain a corresponding .

@DrmUtil.ErrorSource errorSource: Int

The ErrorSource for the given exception.

Returns
Int

The PlaybackException.ErrorCode that corresponds to the given DRM-related exception.

isFailureToConstructNotProvisionedException

java-static fun isFailureToConstructNotProvisionedException(e: Throwable?): Boolean

Returns true if e represents a failure to construct a NotProvisionedException. See b/291440132.

isFailureToConstructResourceBusyException

java-static fun isFailureToConstructResourceBusyException(e: Throwable?): Boolean

Returns true if e represents a failure to construct a ResourceBusyException. See b/291440132.