Package com.castlabs.android.player

# Class DrmLicenseLoader

java.lang.Object
com.castlabs.android.player.DrmLicenseLoader

public class DrmLicenseLoader extends Object
Use the `DrmLicenseLoader.Builder` to create instances of the license loader. The loader works asynchronously and you need to provide a callback implementation to be informed about potential error and the successful license deliveries.

Please note that you need to specify a unique ID for the DRM configuration `DrmConfiguration.offlineId` and configure the local key storage accordingly (see `PlayerSDK.DEFAULT_KEY_STORE`).

Since:
  3.0.2

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `DrmLicenseLoader.Builder`
  Use this builder class to generate new instances of the `DrmLicenseLoader`.
  `static interface`
  `DrmLicenseLoader.Callback`
  The callback interface for license loader tasks

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static boolean`
  `fetchLicense(Bundle playbackBundle, KeyStore keyStore)`
  Fetches the license and store it in the key store
  `static boolean`
  `fetchLicense(PlayerConfig config, KeyStore keyStore)`
  Fetches the license and store it in the key store
  `void`
  `load()`
  Triggers an asynchronous license loading.
  `void`
  `remove()`
  Triggers an asynchronous license removal.

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

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

- ## Method Details

  - ### fetchLicense

    public static boolean fetchLicense(@NonNull Bundle playbackBundle, @NonNull KeyStore keyStore)
    Fetches the license and store it in the key store
    Parameters:
      `playbackBundle` - The playback bundle
      `keyStore` - The key store to use
    Returns:
      `true` if the fetch was successful and otherwise `false`

  - ### fetchLicense

    public static boolean fetchLicense(@NonNull PlayerConfig config, @NonNull KeyStore keyStore)
    Fetches the license and store it in the key store
    Parameters:
      `config` - The playback config
      `keyStore` - The key store to use
    Returns:
      `true` if the fetch was successful and otherwise `false`

  - ### load

    public void load()
    Triggers an asynchronous license loading. The license loading happens on a dedicated thread in the background. The callback provided will be called to inform about errors or a successful license delivery.
    Throws:
      `NullPointerException` - if mandatory data are not specified

  - ### remove

    public void remove()
    Triggers an asynchronous license removal. The license loading happens on a dedicated thread in the background. The callback provided will be called to inform about errors or a successful license removal.

    Some DRM vendors, such as Widevine, require a request to be performed against the license delivery server. This is why Internet connection might be required.

    On license removal success, the corresponding key in the `PlayerSDK.DEFAULT_KEY_STORE` will also be removed.