Package com.google.android.exoplayer2.drm

## Class HttpMediaDrmCallback

- java.lang.Object
- - com.google.android.exoplayer2.drm.HttpMediaDrmCallback

- All Implemented Interfaces:
    `MediaDrmCallback`

      public final class HttpMediaDrmCallback
      extends Object
      implements MediaDrmCallback

  A `MediaDrmCallback` that makes requests using `DataSource` instances.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `HttpMediaDrmCallback​(String defaultLicenseUrl, boolean forceDefaultLicenseUrl, DataSource.Factory dataSourceFactory)` | Constructs an instance.
    `HttpMediaDrmCallback​(String defaultLicenseUrl, DataSource.Factory dataSourceFactory)` | Constructs an instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `clearAllKeyRequestProperties()` | Clears all headers for key requests made by the callback.
    `void` | `clearKeyRequestProperty​(String name)` | Clears a header for key requests made by the callback.
    `byte[]` | `executeKeyRequest​(UUID uuid, ExoMediaDrm.KeyRequest request)` | Executes a key request.
    `byte[]` | `executeProvisionRequest​(UUID uuid, ExoMediaDrm.ProvisionRequest request)` | Executes a provisioning request.
    `void` | `setKeyRequestProperty​(String name, String value)` | Sets a header for key requests made by the callback.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### HttpMediaDrmCallback

          public HttpMediaDrmCallback​(@Nullable
                                      String defaultLicenseUrl,
                                      DataSource.Factory dataSourceFactory)

      Constructs an instance.
      Parameters:
        `defaultLicenseUrl` - The default license URL. Used for key requests that do not specify their own license URL. May be `null` if it's known that all key requests will specify their own URLs.
        `dataSourceFactory` - A factory from which to obtain `DataSource` instances. This will usually be an HTTP-based `DataSource`.

    - #### HttpMediaDrmCallback

          public HttpMediaDrmCallback​(@Nullable
                                      String defaultLicenseUrl,
                                      boolean forceDefaultLicenseUrl,
                                      DataSource.Factory dataSourceFactory)

      Constructs an instance.
      Parameters:
        `defaultLicenseUrl` - The default license URL. Used for key requests that do not specify their own license URL, or for all key requests if `forceDefaultLicenseUrl` is set to true. May be `null` if `forceDefaultLicenseUrl` is `false` and if it's known that all key requests will specify their own URLs.
        `forceDefaultLicenseUrl` - Whether to force use of `defaultLicenseUrl` for key requests that include their own license URL.
        `dataSourceFactory` - A factory from which to obtain `DataSource` instances. This will * usually be an HTTP-based `DataSource`.

  - ### Method Detail

    - #### setKeyRequestProperty

          public void setKeyRequestProperty​(String name,
                                            String value)

      Sets a header for key requests made by the callback.
      Parameters:
        `name` - The name of the header field.
        `value` - The value of the field.

    - #### clearKeyRequestProperty

          public void clearKeyRequestProperty​(String name)

      Clears a header for key requests made by the callback.
      Parameters:
        `name` - The name of the header field.

    - #### clearAllKeyRequestProperties

          public void clearAllKeyRequestProperties()

      Clears all headers for key requests made by the callback.

    - #### executeProvisionRequest

          public byte[] executeProvisionRequest​(UUID uuid,
                                                ExoMediaDrm.ProvisionRequest request)
                                         throws MediaDrmCallbackException

      Description copied from interface: `MediaDrmCallback`
      Executes a provisioning request.
      Specified by:
        `executeProvisionRequest` in interface `MediaDrmCallback`
      Parameters:
        `uuid` - The UUID of the content protection scheme.
        `request` - The request.
      Returns:
        The response data.
      Throws:
        `MediaDrmCallbackException` - If an error occurred executing the request.

    - #### executeKeyRequest

          public byte[] executeKeyRequest​(UUID uuid,
                                          ExoMediaDrm.KeyRequest request)
                                   throws MediaDrmCallbackException

      Description copied from interface: `MediaDrmCallback`
      Executes a key request.
      Specified by:
        `executeKeyRequest` in interface `MediaDrmCallback`
      Parameters:
        `uuid` - The UUID of the content protection scheme.
        `request` - The request.
      Returns:
        The response data.
      Throws:
        `MediaDrmCallbackException` - If an error occurred executing the request.