MediaItem.DrmConfiguration.Builder


public final class MediaItem.DrmConfiguration.Builder


Builder for DrmConfiguration.

Summary

Public constructors

Builder(UUID scheme)

Constructs an instance.

Public methods

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

This method is deprecated.

Use setForceSessionsForAudioAndVideoTracks instead.

MediaItem.DrmConfiguration.Builder
@CanIgnoreReturnValue
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
@CanIgnoreReturnValue
setForceSessionsForAudioAndVideoTracks(
    boolean forceSessionsForAudioAndVideoTracks
)

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

MediaItem.DrmConfiguration.Builder

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

Sets the key set ID of the offline license.

MediaItem.DrmConfiguration.Builder

Sets the optional request headers attached to DRM license requests.

MediaItem.DrmConfiguration.Builder

Sets the optional default DRM license server URI.

MediaItem.DrmConfiguration.Builder

Sets the optional default DRM license server URI.

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

Sets whether multi session is enabled.

MediaItem.DrmConfiguration.Builder
@CanIgnoreReturnValue
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

Sets the UUID of the protection scheme.

Public constructors

Builder

public Builder(UUID scheme)

Constructs an instance.

Parameters
UUID scheme

The UUID of the protection scheme.

Public methods

forceSessionsForAudioAndVideoTracks

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

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.

The default is false.

setForceSessionsForAudioAndVideoTracks

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

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

This method overrides what has been set by previously calling setForcedSessionTrackTypes.

The default is false.

setForcedSessionTrackTypes

@CanIgnoreReturnValue
public MediaItem.DrmConfiguration.Builder setForcedSessionTrackTypes(
    List<@C.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 TRACK_TYPE_VIDEO and TRACK_TYPE_AUDIO, setForceSessionsForAudioAndVideoTracks can be used.

This method overrides what has been set by previously calling setForceSessionsForAudioAndVideoTracks.

The default is an empty list (i.e. DRM sessions are not forced for any track type).

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)).

setLicenseRequestHeaders

@CanIgnoreReturnValue
public MediaItem.DrmConfiguration.Builder setLicenseRequestHeaders(Map<StringString> licenseRequestHeaders)

Sets the optional request headers attached to DRM license requests.

setLicenseUri

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

Sets the optional default DRM license server URI.

setLicenseUri

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

Sets the optional default DRM license server URI.

setMultiSession

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

Sets whether multi session is enabled.

The default is false (multi session disabled).

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.

The default is true.

setScheme

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

Sets the UUID of the protection scheme.