Back to Exoplayer

DefaultDrmSessionManager.Builder (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/drm/DefaultDrmSessionManager.Builder.html

latest11.2 KB
Original Source

Package com.google.android.exoplayer2.drm

Class DefaultDrmSessionManager.Builder


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

Builder for DefaultDrmSessionManager instances.

See Builder() for the list of default values.

Constructor Summary

Constructors | Constructor | Description | | --- | --- | | Builder() | Creates a builder with default values. |

Method Summary

All Methods Instance Methods Concrete Methods | Modifier and Type | Method | Description | | --- | --- | --- | | DefaultDrmSessionManager | build​(MediaDrmCallback mediaDrmCallback) | Builds a DefaultDrmSessionManager instance. | | DefaultDrmSessionManager.Builder | setKeyRequestParameters​(Map<String,​String> keyRequestParameters) | Sets the key request parameters to pass as the last argument to ExoMediaDrm.getKeyRequest(byte[], List, int, HashMap). | | DefaultDrmSessionManager.Builder | setLoadErrorHandlingPolicy​(LoadErrorHandlingPolicy loadErrorHandlingPolicy) | Sets the LoadErrorHandlingPolicy for key and provisioning requests. | | DefaultDrmSessionManager.Builder | setMultiSession​(boolean multiSession) | Sets whether this session manager is allowed to acquire multiple simultaneous sessions. | | DefaultDrmSessionManager.Builder | setPlayClearSamplesWithoutKeys​(boolean playClearSamplesWithoutKeys) | Sets whether clear samples within protected content should be played when keys for the encrypted part of the content have yet to be loaded. | | DefaultDrmSessionManager.Builder | setSessionKeepaliveMs​(long sessionKeepaliveMs) | Sets the time to keep DrmSessions alive when they're not in use. | | DefaultDrmSessionManager.Builder | setUseDrmSessionsForClearContent​(@com.google.android.exoplayer2.C.TrackType int... useDrmSessionsForClearContentTrackTypes) | Sets whether this session manager should attach DrmSessions to the clear sections of the media content. | | DefaultDrmSessionManager.Builder | setUuidAndExoMediaDrmProvider​(UUID uuid, ExoMediaDrm.Provider exoMediaDrmProvider) | Sets the UUID of the DRM scheme and the ExoMediaDrm.Provider to use. |

- 

Methods inherited from class java.lang.Object

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

Constructor Detail

- 

Builder

public Builder()

Creates a builder with default values. The default values are: - keyRequestParameters: An empty map. - UUID: C.WIDEVINE_UUID. - ExoMediaDrm.Provider: FrameworkMediaDrm.DEFAULT_PROVIDER. - multiSession: false. - useDrmSessionsForClearContent: No tracks. - playClearSamplesWithoutKeys: false. - LoadErrorHandlingPolicy: DefaultLoadErrorHandlingPolicy.

Method Detail

- 

setKeyRequestParameters

@CanIgnoreReturnValue
public[DefaultDrmSessionManager.Builder](DefaultDrmSessionManager.Builder.html "class in com.google.android.exoplayer2.drm")setKeyRequestParameters​(@Nullable[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")> keyRequestParameters)

Sets the key request parameters to pass as the last argument to ExoMediaDrm.getKeyRequest(byte[], List, int, HashMap). May be null if not parameters need to be passed.

Custom data for PlayReady should be set under DefaultDrmSessionManager.PLAYREADY_CUSTOM_DATA_KEY.

Parameters:keyRequestParameters - A map with parameters.Returns:This builder.

- 

setUuidAndExoMediaDrmProvider

@CanIgnoreReturnValue
public[DefaultDrmSessionManager.Builder](DefaultDrmSessionManager.Builder.html "class in com.google.android.exoplayer2.drm")setUuidAndExoMediaDrmProvider​([UUID](https://developer.android.com/reference/java/util/UUID.html "class or interface in java.util")uuid,[ExoMediaDrm.Provider](ExoMediaDrm.Provider.html "interface in com.google.android.exoplayer2.drm")exoMediaDrmProvider)

Sets the UUID of the DRM scheme and the ExoMediaDrm.Provider to use. Parameters:uuid - The UUID of the DRM scheme.exoMediaDrmProvider - The ExoMediaDrm.Provider.Returns:This builder.

- 

setMultiSession

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

Sets whether this session manager is allowed to acquire multiple simultaneous sessions.

Users should pass false when a single key request will obtain all keys required to decrypt the associated content. multiSession is required when content uses key rotation.

Parameters:multiSession - Whether this session manager is allowed to acquire multiple simultaneous sessions.Returns:This builder.

- 

setUseDrmSessionsForClearContent

@CanIgnoreReturnValue
public[DefaultDrmSessionManager.Builder](DefaultDrmSessionManager.Builder.html "class in com.google.android.exoplayer2.drm")setUseDrmSessionsForClearContent​(@com.google.android.exoplayer2.C.TrackType int... useDrmSessionsForClearContentTrackTypes)

Sets whether this session manager should attach DrmSessions to the clear sections of the media content.

Using DrmSessions for clear content avoids the recreation of decoders when transitioning between clear and encrypted sections of content.

Parameters:useDrmSessionsForClearContentTrackTypes - The track types (C.TRACK_TYPE_AUDIO and/or C.TRACK_TYPE_VIDEO) for which to use a DrmSession regardless of whether the content is clear or encrypted.Returns:This builder.Throws:IllegalArgumentException - If useDrmSessionsForClearContentTrackTypes contains track types other than C.TRACK_TYPE_AUDIO and C.TRACK_TYPE_VIDEO.

- 

setPlayClearSamplesWithoutKeys

@CanIgnoreReturnValue
public[DefaultDrmSessionManager.Builder](DefaultDrmSessionManager.Builder.html "class in com.google.android.exoplayer2.drm")setPlayClearSamplesWithoutKeys​(boolean playClearSamplesWithoutKeys)

Sets whether clear samples within protected content should be played when keys for the encrypted part of the content have yet to be loaded. Parameters:playClearSamplesWithoutKeys - Whether clear samples within protected content should be played when keys for the encrypted part of the content have yet to be loaded.Returns:This builder.

- 

setLoadErrorHandlingPolicy

@CanIgnoreReturnValue
public[DefaultDrmSessionManager.Builder](DefaultDrmSessionManager.Builder.html "class in com.google.android.exoplayer2.drm")setLoadErrorHandlingPolicy​([LoadErrorHandlingPolicy](../upstream/LoadErrorHandlingPolicy.html "interface in com.google.android.exoplayer2.upstream")loadErrorHandlingPolicy)

Sets the LoadErrorHandlingPolicy for key and provisioning requests. Parameters:loadErrorHandlingPolicy - A LoadErrorHandlingPolicy.Returns:This builder.

- 

setSessionKeepaliveMs

@CanIgnoreReturnValue
public[DefaultDrmSessionManager.Builder](DefaultDrmSessionManager.Builder.html "class in com.google.android.exoplayer2.drm")setSessionKeepaliveMs​(long sessionKeepaliveMs)

Sets the time to keep DrmSessions alive when they're not in use.

It can be useful to keep sessions alive during playback of short clear sections of media (e.g. ad breaks) to avoid opening new DRM sessions (and re-requesting keys) at the transition back into secure content. This assumes the secure sections before and after the clear section are encrypted with the same keys.

Defaults to DefaultDrmSessionManager.DEFAULT_SESSION_KEEPALIVE_MS. Pass C.TIME_UNSET to disable keep-alive.

Parameters:sessionKeepaliveMs - The time to keep DrmSessions alive before fully releasing, in milliseconds. Must be > 0 or C.TIME_UNSET to disable keep-alive.Returns:This builder.

- 

build

public[DefaultDrmSessionManager](DefaultDrmSessionManager.html "class in com.google.android.exoplayer2.drm")build​([MediaDrmCallback](MediaDrmCallback.html "interface in com.google.android.exoplayer2.drm")mediaDrmCallback)

Builds a DefaultDrmSessionManager instance.