public static final class DefaultDrmSessionManager.Builder
extends java.lang.Object
DefaultDrmSessionManager instances.
See #Builder for the list of default values.
| 构造器和说明 |
|---|
Builder()
Creates a builder with default values.
|
| 限定符和类型 | 方法和说明 |
|---|---|
DefaultDrmSessionManager |
build(MediaDrmCallback mediaDrmCallback)
Builds a
DefaultDrmSessionManager instance. |
DefaultDrmSessionManager.Builder |
setKeyRequestParameters(java.util.Map<java.lang.String,java.lang.String> keyRequestParameters)
Sets the key request parameters to pass as the last argument to
ExoMediaDrm.getKeyRequest(byte[], List, int, HashMap). |
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(int... useDrmSessionsForClearContentTrackTypes)
Sets whether this session manager should attach
DrmSessions to the clear
sections of the media content. |
DefaultDrmSessionManager.Builder |
setUuidAndExoMediaDrmProvider(java.util.UUID uuid,
ExoMediaDrm.Provider exoMediaDrmProvider)
Sets the UUID of the DRM scheme and the
ExoMediaDrm.Provider to use. |
public Builder()
keyRequestParameters: An empty map.
UUID: C.WIDEVINE_UUID.
ExoMediaDrm.Provider: FrameworkMediaDrm.DEFAULT_PROVIDER.
multiSession: false.
useDrmSessionsForClearContent: No tracks.
playClearSamplesWithoutKeys: false.
public DefaultDrmSessionManager.Builder setKeyRequestParameters(java.util.Map<java.lang.String,java.lang.String> keyRequestParameters)
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.
keyRequestParameters - A map with parameters.public DefaultDrmSessionManager.Builder setUuidAndExoMediaDrmProvider(java.util.UUID uuid, ExoMediaDrm.Provider exoMediaDrmProvider)
ExoMediaDrm.Provider to use.uuid - The UUID of the DRM scheme.exoMediaDrmProvider - The ExoMediaDrm.Provider.public DefaultDrmSessionManager.Builder setMultiSession(boolean multiSession)
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.
multiSession - Whether this session manager is allowed to acquire multiple simultaneous
sessions.public DefaultDrmSessionManager.Builder setUseDrmSessionsForClearContent(int... useDrmSessionsForClearContentTrackTypes)
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.
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.java.lang.IllegalArgumentException - If useDrmSessionsForClearContentTrackTypes contains
track types other than C.TRACK_TYPE_AUDIO and C.TRACK_TYPE_VIDEO.public DefaultDrmSessionManager.Builder setPlayClearSamplesWithoutKeys(boolean playClearSamplesWithoutKeys)
playClearSamplesWithoutKeys - Whether clear samples within protected content should be
played when keys for the encrypted part of the content have yet to be loaded.public DefaultDrmSessionManager.Builder setSessionKeepaliveMs(long sessionKeepaliveMs)
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.
sessionKeepaliveMs - The time to keep DrmSessions alive before fully releasing,
in milliseconds. Must be > 0 or C.TIME_UNSET to disable keep-alive.public DefaultDrmSessionManager build(MediaDrmCallback mediaDrmCallback)
DefaultDrmSessionManager instance.