Package com.castlabs.android.drm

# Interface DrmLicenseManager

All Superinterfaces:
  `com.google.android.exoplayer2.drm.DrmSessionManager`

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

Since:
  3.0.2

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface com.google.android.exoplayer2.drm.DrmSessionManager

  `com.google.android.exoplayer2.drm.DrmSessionManager.DrmSessionReference`

- ## Field Summary

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

  `DRM_UNSUPPORTED, DUMMY`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  Close all sessions
  `void`
  `fetchLicence(com.google.android.exoplayer2.Format format, DrmConfiguration drmConfiguration)`
  Used for pre-fetching a DRM License.
  `TrackRendererPlugin.Type`
  `getTrackType()`
  Returns which `TrackRendererPlugin.Type` of Tracks this SessionManager handles.
  `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

  `acquireSession, getCryptoType, preacquireSession, prepare, release, sessionSharingEnabled, setPlayer`

- ## Method Details

  - ### getTrackType

    @Nullable TrackRendererPlugin.Type getTrackType()
    Returns which `TrackRendererPlugin.Type` of Tracks this SessionManager handles.
    Returns:
      the Type

  - ### load

    void load(@Nullable com.google.android.exoplayer2.drm.DrmInitData videoInitData, @Nullable 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 com.google.android.exoplayer2.Format format, @Nullable DrmConfiguration drmConfiguration)
    Used for pre-fetching a DRM License. It should perform the license request but not "enabling" it.
    Parameters:
      `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

  - ### 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