DrmUtil
@UnstableApi
public final class DrmUtil
DRM-related utility methods.
Summary
Nested types |
|---|
@DocumentedIdentifies the operation which caused a DRM-related error. |
Constants |
|
|---|---|
static final int |
Corresponds to failures caused by an |
static final int |
Corresponds to failures caused by an operation related to obtaining DRM licenses. |
static final int |
Corresponds to failures caused by an operation related to provisioning the device. |
Public methods |
|
|---|---|
static MediaDrmCallback.Response |
executePost(Executes a HTTP POST request with retry handling and returns the entire response in a byte buffer. |
static int |
@PlaybackException.ErrorCodeReturns the |
static boolean |
Returns true if |
static boolean |
Returns true if |
Constants
ERROR_SOURCE_EXO_MEDIA_DRM
public static final int ERROR_SOURCE_EXO_MEDIA_DRM = 1
Corresponds to failures caused by an ExoMediaDrm method call.
ERROR_SOURCE_LICENSE_ACQUISITION
public static final int ERROR_SOURCE_LICENSE_ACQUISITION = 2
Corresponds to failures caused by an operation related to obtaining DRM licenses.
ERROR_SOURCE_PROVISIONING
public static final int ERROR_SOURCE_PROVISIONING = 3
Corresponds to failures caused by an operation related to provisioning the device.
Public methods
executePost
public static MediaDrmCallback.Response executePost(
DataSource dataSource,
String url,
@Nullable byte[] httpBody,
Map<String, String> requestProperties
)
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.
The LoadEventInfo returned inside the MediaDrmCallback.Response will have the following fields unset, and they must be updated by caller before the LoadEventInfo is used elsewhere:
| Parameters | |
|---|---|
DataSource dataSource |
A |
String url |
The requested URL. |
@Nullable byte[] httpBody |
The HTTP request payload. |
Map<String, String> requestProperties |
A keyed map of HTTP header request properties. |
| Returns | |
|---|---|
MediaDrmCallback.Response |
A |
| Throws | |
|---|---|
androidx.media3.exoplayer.drm.MediaDrmCallbackException |
if an exception was encountered during the download. |
getErrorCodeForMediaDrmException
@PlaybackException.ErrorCode
public static int getErrorCodeForMediaDrmException(
Throwable exception,
@DrmUtil.ErrorSource int errorSource
)
Returns the PlaybackException.ErrorCode that corresponds to the given DRM-related exception.
| Parameters | |
|---|---|
Throwable exception |
The DRM-related exception for which to obtain a corresponding |
@DrmUtil.ErrorSource int errorSource |
The |
| Returns | |
|---|---|
int |
The |
isFailureToConstructNotProvisionedException
public static boolean isFailureToConstructNotProvisionedException(@Nullable Throwable e)
Returns true if e represents a failure to construct a NotProvisionedException. See b/291440132.
isFailureToConstructResourceBusyException
public static boolean isFailureToConstructResourceBusyException(@Nullable Throwable e)
Returns true if e represents a failure to construct a ResourceBusyException. See b/291440132.