Back to Exoplayer

MediaItem.DrmConfiguration.Builder (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/MediaItem.DrmConfiguration.Builder.html

latest9.8 KB
Original Source

Package com.google.android.exoplayer2

Class MediaItem.DrmConfiguration.Builder


public static final classMediaItem.DrmConfiguration.Builderextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")

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](https://developer.android.com/reference/java/util/UUID.html "class or interface in java.util")scheme)

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

Method Detail

- 

setScheme

@CanIgnoreReturnValue
public[MediaItem.DrmConfiguration.Builder](MediaItem.DrmConfiguration.Builder.html "class in com.google.android.exoplayer2")setScheme​([UUID](https://developer.android.com/reference/java/util/UUID.html "class or interface in java.util")scheme)

Sets the UUID of the protection scheme.

- 

setLicenseUri

@CanIgnoreReturnValue
public[MediaItem.DrmConfiguration.Builder](MediaItem.DrmConfiguration.Builder.html "class in com.google.android.exoplayer2")setLicenseUri​(@Nullable[Uri](https://developer.android.com/reference/android/net/Uri.html "class or interface in android.net")licenseUri)

Sets the optional default DRM license server URI.

- 

setLicenseUri

@CanIgnoreReturnValue
public[MediaItem.DrmConfiguration.Builder](MediaItem.DrmConfiguration.Builder.html "class in com.google.android.exoplayer2")setLicenseUri​(@Nullable[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")licenseUri)

Sets the optional default DRM license server URI.

- 

setLicenseRequestHeaders

@CanIgnoreReturnValue
public[MediaItem.DrmConfiguration.Builder](MediaItem.DrmConfiguration.Builder.html "class in com.google.android.exoplayer2")setLicenseRequestHeaders​([Map](https://developer.android.com/reference/java/util/Map.html "class or interface in java.util")<[String](https://developer.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang"),​[String](https://developer.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")> licenseRequestHeaders)

Sets the optional request headers attached to DRM license requests.

- 

setMultiSession

@CanIgnoreReturnValue
public[MediaItem.DrmConfiguration.Builder](MediaItem.DrmConfiguration.Builder.html "class in com.google.android.exoplayer2")setMultiSession​(boolean multiSession)

Sets whether multi session is enabled.

- 

setForceDefaultLicenseUri

@CanIgnoreReturnValue
public[MediaItem.DrmConfiguration.Builder](MediaItem.DrmConfiguration.Builder.html "class in com.google.android.exoplayer2")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](MediaItem.DrmConfiguration.Builder.html "class in com.google.android.exoplayer2")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](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")@InlineMe(replacement="this.setForceSessionsForAudioAndVideoTracks(forceSessionsForAudioAndVideoTracks)")
public[MediaItem.DrmConfiguration.Builder](MediaItem.DrmConfiguration.Builder.html "class in com.google.android.exoplayer2")forceSessionsForAudioAndVideoTracks​(boolean forceSessionsForAudioAndVideoTracks)

Deprecated. Use setForceSessionsForAudioAndVideoTracks(boolean) instead.

- 

setForceSessionsForAudioAndVideoTracks

@CanIgnoreReturnValue
public[MediaItem.DrmConfiguration.Builder](MediaItem.DrmConfiguration.Builder.html "class in com.google.android.exoplayer2")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](MediaItem.DrmConfiguration.Builder.html "class in com.google.android.exoplayer2")setForcedSessionTrackTypes​([List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<[@TrackType](C.TrackType.html "annotation in com.google.android.exoplayer2")[Integer](https://developer.android.com/reference/java/lang/Integer.html?is-external=true "class or interface in java.lang")> 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](MediaItem.DrmConfiguration.Builder.html "class in com.google.android.exoplayer2")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](MediaItem.DrmConfiguration.html "class in com.google.android.exoplayer2")build()