Package com.google.android.exoplayer2

## Class MediaItem.DrmConfiguration.Builder

- java.lang.Object
- - com.google.android.exoplayer2.MediaItem.DrmConfiguration.Builder

- Enclosing class:
    MediaItem.DrmConfiguration

      public static final class MediaItem.DrmConfiguration.Builder
      extends Object

  Builder for `MediaItem.DrmConfiguration`.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Builder​(UUID scheme)` | Constructs an instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `MediaItem.DrmConfiguration` | `build()` |
    `MediaItem.DrmConfiguration.Builder` | `forceSessionsForAudioAndVideoTracks​(boolean forceSessionsForAudioAndVideoTracks)` | Deprecated. Use `setForceSessionsForAudioAndVideoTracks(boolean)` instead.
    `MediaItem.DrmConfiguration.Builder` | `setForceDefaultLicenseUri​(boolean forceDefaultLicenseUri)` | Sets whether to always use the default DRM license server URI even if the media specifies its own DRM license server URI.
    `MediaItem.DrmConfiguration.Builder` | `setForcedSessionTrackTypes​(List<@TrackType Integer> forcedSessionTrackTypes)` | Sets a list of `track type` constants for which to use a DRM session even when the tracks are in the clear.
    `MediaItem.DrmConfiguration.Builder` | `setForceSessionsForAudioAndVideoTracks​(boolean forceSessionsForAudioAndVideoTracks)` | Sets whether a DRM session should be used for clear tracks of type `C.TRACK_TYPE_VIDEO` and `C.TRACK_TYPE_AUDIO`.
    `MediaItem.DrmConfiguration.Builder` | `setKeySetId​(byte[] keySetId)` | Sets the key set ID of the offline license.
    `MediaItem.DrmConfiguration.Builder` | `setLicenseRequestHeaders​(Map<String,​String> licenseRequestHeaders)` | Sets the optional request headers attached to DRM license requests.
    `MediaItem.DrmConfiguration.Builder` | `setLicenseUri​(Uri licenseUri)` | Sets the optional default DRM license server URI.
    `MediaItem.DrmConfiguration.Builder` | `setLicenseUri​(String licenseUri)` | Sets the optional default DRM license server URI.
    `MediaItem.DrmConfiguration.Builder` | `setMultiSession​(boolean multiSession)` | Sets whether multi session is enabled.
    `MediaItem.DrmConfiguration.Builder` | `setPlayClearContentWithoutKey​(boolean playClearContentWithoutKey)` | Sets whether clear samples within protected content should be played when keys for the encrypted part of the content have yet to be loaded.
    `MediaItem.DrmConfiguration.Builder` | `setScheme​(UUID scheme)` | Sets the `UUID` of the protection scheme.

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

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

- - ### Constructor Detail

    - #### Builder

          public Builder​(UUID scheme)

      Constructs an instance.
      Parameters:
        `scheme` - The `UUID` of the protection scheme.

  - ### Method Detail

    - #### setScheme

          @CanIgnoreReturnValue
          public MediaItem.DrmConfiguration.Builder setScheme​(UUID scheme)

      Sets the `UUID` of the protection scheme.

    - #### setLicenseUri

          @CanIgnoreReturnValue
          public MediaItem.DrmConfiguration.Builder setLicenseUri​(@Nullable
                                                                  Uri licenseUri)

      Sets the optional default DRM license server URI.

    - #### setLicenseUri

          @CanIgnoreReturnValue
          public MediaItem.DrmConfiguration.Builder setLicenseUri​(@Nullable
                                                                  String licenseUri)

      Sets the optional default DRM license server URI.

    - #### setLicenseRequestHeaders

          @CanIgnoreReturnValue
          public MediaItem.DrmConfiguration.Builder setLicenseRequestHeaders​(Map<String,​String> licenseRequestHeaders)

      Sets the optional request headers attached to DRM license requests.

    - #### setMultiSession

          @CanIgnoreReturnValue
          public MediaItem.DrmConfiguration.Builder setMultiSession​(boolean multiSession)

      Sets whether multi session is enabled.

    - #### setForceDefaultLicenseUri

          @CanIgnoreReturnValue
          public MediaItem.DrmConfiguration.Builder setForceDefaultLicenseUri​(boolean forceDefaultLicenseUri)

      Sets whether to always use the default DRM license server URI even if the media specifies its own DRM license server URI.

    - #### setPlayClearContentWithoutKey

          @CanIgnoreReturnValue
          public MediaItem.DrmConfiguration.Builder setPlayClearContentWithoutKey​(boolean playClearContentWithoutKey)

      Sets whether clear samples within protected content should be played when keys for the encrypted part of the content have yet to be loaded.

    - #### forceSessionsForAudioAndVideoTracks

          @CanIgnoreReturnValue
          @Deprecated
          @InlineMe(replacement="this.setForceSessionsForAudioAndVideoTracks(forceSessionsForAudioAndVideoTracks)")
          public MediaItem.DrmConfiguration.Builder forceSessionsForAudioAndVideoTracks​(boolean forceSessionsForAudioAndVideoTracks)

      Deprecated.
      Use `setForceSessionsForAudioAndVideoTracks(boolean)` instead.

    - #### setForceSessionsForAudioAndVideoTracks

          @CanIgnoreReturnValue
          public MediaItem.DrmConfiguration.Builder setForceSessionsForAudioAndVideoTracks​(boolean forceSessionsForAudioAndVideoTracks)

      Sets whether a DRM session should be used for clear tracks of type `C.TRACK_TYPE_VIDEO` and `C.TRACK_TYPE_AUDIO`.

      This method overrides what has been set by previously calling `setForcedSessionTrackTypes(List)`.

    - #### setForcedSessionTrackTypes

          @CanIgnoreReturnValue
          public MediaItem.DrmConfiguration.Builder setForcedSessionTrackTypes​(List<@TrackType Integer> forcedSessionTrackTypes)

      Sets a list of `track type` constants for which to use a DRM session even when the tracks are in the clear.

      For the common case of using a DRM session for `C.TRACK_TYPE_VIDEO` and `C.TRACK_TYPE_AUDIO`, `setForceSessionsForAudioAndVideoTracks(boolean)` can be used.

      This method overrides what has been set by previously calling `setForceSessionsForAudioAndVideoTracks(boolean)`.

    - #### setKeySetId

          @CanIgnoreReturnValue
          public MediaItem.DrmConfiguration.Builder setKeySetId​(@Nullable
                                                                byte[] keySetId)

      Sets the key set ID of the offline license.

      The key set ID identifies an offline license. The ID is required to query, renew or release an existing offline license (see `DefaultDrmSessionManager#setMode(int mode,byte[] offlineLicenseKeySetId)`).

    - #### build

          public MediaItem.DrmConfiguration build()