Package com.castlabs.android.drm

# Interface DrmLicenseManager<T extends com.google.android.exoplayer2.drm.ExoMediaCrypto>

Type Parameters:
  `T` - The type of `ExoMediaCrypto` to use with the DRM session.

All Superinterfaces:
  `com.google.android.exoplayer2.drm.DrmSessionManager<T>`

public interface DrmLicenseManager<T extends com.google.android.exoplayer2.drm.ExoMediaCrypto> extends com.google.android.exoplayer2.drm.DrmSessionManager<T>
Extension of the `DrmSessionManager` that also allows to load licenses headless and in one blocking function.

Since:
  3.0.2

- ## Field Summary

  ### Fields inherited from interface com.google.android.exoplayer2.drm.DrmSessionManager

  `DUMMY`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  Close all sessions
  `void`
  `fetchLicence(Looper playbackLooper, com.google.android.exoplayer2.Format format, DrmConfiguration drmConfiguration, boolean avoidClosingSession)`
  Used for pre-fetching a DRM License.
  `void`
  `load(com.google.android.exoplayer2.drm.DrmInitData videoInitData, com.google.android.exoplayer2.drm.DrmInitData audioInitData)`
  Pass in video and audio init data and trigger a license load.
  `void`
  `onComponentError(DrmLicenseManagerComponent drmTimingComponent, Exception exception)`
  Called when a `DrmLicenseManagerComponent` triggers an error
  `void`
  `remove()`
  Removes the license matching the provided `DrmConfiguration`.

  ### Methods inherited from interface com.google.android.exoplayer2.drm.DrmSessionManager

  `acquirePlaceholderSession, acquireSession, canAcquireSession, getExoMediaCryptoType, prepare, release, sessionSharingEnabled`

- ## Method Details

  - ### load

    void load(com.google.android.exoplayer2.drm.DrmInitData videoInitData, com.google.android.exoplayer2.drm.DrmInitData audioInitData) throws Exception
    Pass in video and audio init data and trigger a license load. Implementations of this method must operate in foreground
    Parameters:
      `videoInitData` - The video init data
      `audioInitData` - The audio init data
    Throws:
      `Exception` - in case an error is raised during the license request

  - ### fetchLicence

    void fetchLicence(@NonNull Looper playbackLooper, @NonNull com.google.android.exoplayer2.Format format, @Nullable DrmConfiguration drmConfiguration, boolean avoidClosingSession)
    Used for pre-fetching a DRM License. It should perform the license request but not "enabling" it.
    Parameters:
      `playbackLooper` - The looper associated with the media playback thread.
      `format` - Format holding DRM initialization data. All contained `DrmInitData.SchemeData`s must contain non-null `DrmInitData.SchemeData.data`.
      `drmConfiguration` - DRM configuration to use for the license fetch
      `avoidClosingSession` - Won't close the session if true

  - ### remove

    void remove() throws Exception
    Removes the license matching the provided `DrmConfiguration`.

    Some DRM vendors, such as Widevine, require to perform a request to the DRM server in order to remove the internal key. This is why Internet connectivity may be required. Upon successful license removal, the license will also be removed from the `PlayerSDK.DEFAULT_KEY_STORE`.

    In order to remove the license, it must exist in the `PlayerSDK.DEFAULT_KEY_STORE`.

    Throws:
      `Exception` - in case an error is raised during the license removal

  - ### close

    void close()
    Close all sessions

  - ### onComponentError

    void onComponentError(@NonNull DrmLicenseManagerComponent drmTimingComponent, @NonNull Exception exception)
    Called when a `DrmLicenseManagerComponent` triggers an error
    Parameters:
      `drmTimingComponent` - component that is triggering this error
      `exception` - exception thrown by the component