Package com.google.android.exoplayer2.drm

## Class ErrorStateDrmSession

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

- All Implemented Interfaces:
    `DrmSession`

      public final class ErrorStateDrmSession
      extends Object
      implements DrmSession

  A `DrmSession` that's in a terminal error state.

- - ### Nested Class Summary

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

      `DrmSession.DrmSessionException, DrmSession.State`

  - ### Field Summary

    - ### Fields inherited from interface com.google.android.exoplayer2.drm.DrmSession

      `STATE_ERROR, STATE_OPENED, STATE_OPENED_WITH_KEYS, STATE_OPENING, STATE_RELEASED`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ErrorStateDrmSession​(DrmSession.DrmSessionException error)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `acquire​(DrmSessionEventListener.EventDispatcher eventDispatcher)` | Increments the reference count.
    `DrmSession.DrmSessionException` | `getError()` | Returns the cause of the error state, or null if `DrmSession.getState()` is not `DrmSession.STATE_ERROR`.
    `ExoMediaCrypto` | `getMediaCrypto()` | Returns an `ExoMediaCrypto` for the open session, or null if called before the session has been opened or after it's been released.
    `byte[]` | `getOfflineLicenseKeySetId()` | Returns the key set id of the offline license loaded into this session, or null if there isn't one.
    `UUID` | `getSchemeUuid()` | Returns the DRM scheme UUID for this session.
    `int` | `getState()` | Returns the current state of the session, which is one of `DrmSession.STATE_ERROR`, `DrmSession.STATE_RELEASED`, `DrmSession.STATE_OPENING`, `DrmSession.STATE_OPENED` and `DrmSession.STATE_OPENED_WITH_KEYS`.
    `boolean` | `playClearSamplesWithoutKeys()` | Returns whether this session allows playback of clear samples prior to keys being loaded.
    `Map<String,​String>` | `queryKeyStatus()` | Returns a map describing the key status for the session, or null if called before the session has been opened or after it's been released.
    `void` | `release​(DrmSessionEventListener.EventDispatcher eventDispatcher)` | Decrements the reference count.

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

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

- - ### Constructor Detail

    - #### ErrorStateDrmSession

          public ErrorStateDrmSession​(DrmSession.DrmSessionException error)

  - ### Method Detail

    - #### getState

          public int getState()

      Description copied from interface: `DrmSession`
      Returns the current state of the session, which is one of `DrmSession.STATE_ERROR`, `DrmSession.STATE_RELEASED`, `DrmSession.STATE_OPENING`, `DrmSession.STATE_OPENED` and `DrmSession.STATE_OPENED_WITH_KEYS`.
      Specified by:
        `getState` in interface `DrmSession`

    - #### playClearSamplesWithoutKeys

          public boolean playClearSamplesWithoutKeys()

      Description copied from interface: `DrmSession`
      Returns whether this session allows playback of clear samples prior to keys being loaded.
      Specified by:
        `playClearSamplesWithoutKeys` in interface `DrmSession`

    - #### getError

          @Nullable
          public DrmSession.DrmSessionException getError()

      Description copied from interface: `DrmSession`
      Returns the cause of the error state, or null if `DrmSession.getState()` is not `DrmSession.STATE_ERROR`.
      Specified by:
        `getError` in interface `DrmSession`

    - #### getSchemeUuid

          public final UUID getSchemeUuid()

      Description copied from interface: `DrmSession`
      Returns the DRM scheme UUID for this session.
      Specified by:
        `getSchemeUuid` in interface `DrmSession`

    - #### getMediaCrypto

          @Nullable
          public ExoMediaCrypto getMediaCrypto()

      Description copied from interface: `DrmSession`
      Returns an `ExoMediaCrypto` for the open session, or null if called before the session has been opened or after it's been released.
      Specified by:
        `getMediaCrypto` in interface `DrmSession`

    - #### queryKeyStatus

          @Nullable
          public Map<String,​String> queryKeyStatus()

      Description copied from interface: `DrmSession`
      Returns a map describing the key status for the session, or null if called before the session has been opened or after it's been released.

      Since DRM license policies vary by vendor, the specific status field names are determined by each DRM vendor. Refer to your DRM provider documentation for definitions of the field names for a particular DRM engine plugin.

      Specified by:
        `queryKeyStatus` in interface `DrmSession`
      Returns:
        A map describing the key status for the session, or null if called before the session has been opened or after it's been released.
      See Also:
        `MediaDrm.queryKeyStatus(byte[])`

    - #### getOfflineLicenseKeySetId

          @Nullable
          public byte[] getOfflineLicenseKeySetId()

      Description copied from interface: `DrmSession`
      Returns the key set id of the offline license loaded into this session, or null if there isn't one.
      Specified by:
        `getOfflineLicenseKeySetId` in interface `DrmSession`

    - #### acquire

          public void acquire​(@Nullable
                              DrmSessionEventListener.EventDispatcher eventDispatcher)

      Description copied from interface: `DrmSession`
      Increments the reference count. When the caller no longer needs to use the instance, it must call `DrmSession.release(DrmSessionEventListener.EventDispatcher)` to decrement the reference count.
      Specified by:
        `acquire` in interface `DrmSession`
      Parameters:
        `eventDispatcher` - The `DrmSessionEventListener.EventDispatcher` used to route DRM-related events dispatched from this session, or null if no event handling is needed.

    - #### release

          public void release​(@Nullable
                              DrmSessionEventListener.EventDispatcher eventDispatcher)

      Description copied from interface: `DrmSession`
      Decrements the reference count. If the reference count drops to 0 underlying resources are released, and the instance cannot be re-used.
      Specified by:
        `release` in interface `DrmSession`
      Parameters:
        `eventDispatcher` - The `DrmSessionEventListener.EventDispatcher` to disconnect when the session is released (the same instance (possibly null) that was passed by the caller to `DrmSession.acquire(DrmSessionEventListener.EventDispatcher)`).