LocalMediaDrmCallback


@UnstableApi
public final class LocalMediaDrmCallback implements MediaDrmCallback


A MediaDrmCallback that provides a fixed response to key requests. Provisioning is not supported. This implementation is primarily useful for providing locally stored keys to decrypt ClearKey protected content. It is not suitable for use with Widevine or PlayReady protected content.

Summary

Public constructors

LocalMediaDrmCallback(byte[] keyResponse)

Public methods

MediaDrmCallback.Response

Executes a key request.

MediaDrmCallback.Response

Executes a provisioning request.

Public constructors

LocalMediaDrmCallback

public LocalMediaDrmCallback(byte[] keyResponse)
Parameters
byte[] keyResponse

The fixed response for all key requests.

Public methods

executeKeyRequest

public MediaDrmCallback.Response executeKeyRequest(UUID uuid, ExoMediaDrm.KeyRequest request)

Executes a key request.

The LoadEventInfo returned inside the Response will have the following fields unset, and they must be updated by caller before the LoadEventInfo is used elsewhere:

Parameters
UUID uuid

The UUID of the content protection scheme.

ExoMediaDrm.KeyRequest request

The request.

Returns
MediaDrmCallback.Response

The response data.

Throws
androidx.media3.exoplayer.drm.MediaDrmCallbackException

If an error occurred executing the request.

executeProvisionRequest

public MediaDrmCallback.Response executeProvisionRequest(
    UUID uuid,
    ExoMediaDrm.ProvisionRequest request
)

Executes a provisioning request.

The LoadEventInfo returned inside the Response will have the following fields unset, and they must be updated by caller before the LoadEventInfo is used elsewhere:

Parameters
UUID uuid

The UUID of the content protection scheme.

ExoMediaDrm.ProvisionRequest request

The request.

Returns
MediaDrmCallback.Response

The response data.

Throws
androidx.media3.exoplayer.drm.MediaDrmCallbackException

If an error occurred executing the request.