DefaultDrmSessionManager.Builder


class DefaultDrmSessionManager.Builder


Builder for DefaultDrmSessionManager instances.

See Builder for the list of default values.

Summary

Public constructors

Creates a builder with default values.

Public functions

DefaultDrmSessionManager!
build(mediaDrmCallback: MediaDrmCallback!)

Builds a DefaultDrmSessionManager instance.

DefaultDrmSessionManager.Builder!
@CanIgnoreReturnValue
setKeyRequestParameters(
    keyRequestParameters: (Mutable)Map<String!, String!>?
)

Sets the key request parameters to pass as the last argument to getKeyRequest.

DefaultDrmSessionManager.Builder!

Sets the LoadErrorHandlingPolicy for key and provisioning requests.

DefaultDrmSessionManager.Builder!

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

DefaultDrmSessionManager.Builder!

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!

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

DefaultDrmSessionManager.Builder!
@CanIgnoreReturnValue
setUseDrmSessionsForClearContent(
    @C.TrackType useDrmSessionsForClearContentTrackTypes: IntArray!
)

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

DefaultDrmSessionManager.Builder!
@CanIgnoreReturnValue
setUuidAndExoMediaDrmProvider(
    uuid: UUID!,
    exoMediaDrmProvider: ExoMediaDrm.Provider!
)

Sets the UUID of the DRM scheme and the ExoMediaDrm.Provider to use.

Public constructors

Public functions

build

fun build(mediaDrmCallback: MediaDrmCallback!): DefaultDrmSessionManager!

Builds a DefaultDrmSessionManager instance.

setKeyRequestParameters

@CanIgnoreReturnValue
fun setKeyRequestParameters(
    keyRequestParameters: (Mutable)Map<String!, String!>?
): DefaultDrmSessionManager.Builder!

Sets the key request parameters to pass as the last argument to getKeyRequest. May be null if not parameters need to be passed.

Custom data for PlayReady should be set under PLAYREADY_CUSTOM_DATA_KEY.

Parameters
keyRequestParameters: (Mutable)Map<String!, String!>?

A map with parameters.

Returns
DefaultDrmSessionManager.Builder!

This builder.

setLoadErrorHandlingPolicy

@CanIgnoreReturnValue
fun setLoadErrorHandlingPolicy(
    loadErrorHandlingPolicy: LoadErrorHandlingPolicy!
): DefaultDrmSessionManager.Builder!

Sets the LoadErrorHandlingPolicy for key and provisioning requests.

Parameters
loadErrorHandlingPolicy: LoadErrorHandlingPolicy!

A LoadErrorHandlingPolicy.

Returns
DefaultDrmSessionManager.Builder!

This builder.

setMultiSession

@CanIgnoreReturnValue
fun setMultiSession(multiSession: Boolean): DefaultDrmSessionManager.Builder!

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: Boolean

Whether this session manager is allowed to acquire multiple simultaneous sessions.

Returns
DefaultDrmSessionManager.Builder!

This builder.

setPlayClearSamplesWithoutKeys

@CanIgnoreReturnValue
fun setPlayClearSamplesWithoutKeys(playClearSamplesWithoutKeys: Boolean): DefaultDrmSessionManager.Builder!

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: Boolean

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

Returns
DefaultDrmSessionManager.Builder!

This builder.

setSessionKeepaliveMs

@CanIgnoreReturnValue
fun setSessionKeepaliveMs(sessionKeepaliveMs: Long): DefaultDrmSessionManager.Builder!

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 DEFAULT_SESSION_KEEPALIVE_MS. Pass TIME_UNSET to disable keep-alive.

Parameters
sessionKeepaliveMs: Long

The time to keep DrmSessions alive before fully releasing, in milliseconds. Must be >0 or TIME_UNSET to disable keep-alive.

Returns
DefaultDrmSessionManager.Builder!

This builder.

setUseDrmSessionsForClearContent

@CanIgnoreReturnValue
fun setUseDrmSessionsForClearContent(
    @C.TrackType useDrmSessionsForClearContentTrackTypes: IntArray!
): DefaultDrmSessionManager.Builder!

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
@C.TrackType useDrmSessionsForClearContentTrackTypes: IntArray!

The track types (TRACK_TYPE_AUDIO and/or TRACK_TYPE_VIDEO) for which to use a DrmSession regardless of whether the content is clear or encrypted.

Returns
DefaultDrmSessionManager.Builder!

This builder.

Throws
java.lang.IllegalArgumentException

If useDrmSessionsForClearContentTrackTypes contains track types other than TRACK_TYPE_AUDIO and TRACK_TYPE_VIDEO.

setUuidAndExoMediaDrmProvider

@CanIgnoreReturnValue
fun setUuidAndExoMediaDrmProvider(
    uuid: UUID!,
    exoMediaDrmProvider: ExoMediaDrm.Provider!
): DefaultDrmSessionManager.Builder!

Sets the UUID of the DRM scheme and the ExoMediaDrm.Provider to use.

Parameters
uuid: UUID!

The UUID of the DRM scheme.

exoMediaDrmProvider: ExoMediaDrm.Provider!

The ExoMediaDrm.Provider.

Returns
DefaultDrmSessionManager.Builder!

This builder.