public final class

MediaItem.DrmConfiguration.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.media3.common.MediaItem.DrmConfiguration.Builder

Overview

Builder for MediaItem.DrmConfiguration.

Summary

Constructors
publicBuilder(java.util.UUID scheme)

Constructs an instance.

Methods
public MediaItem.DrmConfigurationbuild()

public MediaItem.DrmConfiguration.BuilderforceSessionsForAudioAndVideoTracks(boolean useClearSessionsForAudioAndVideoTracks)

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

public MediaItem.DrmConfiguration.BuildersetForceDefaultLicenseUri(boolean forceDefaultLicenseUri)

Sets whether to always use the default DRM license server URI even if the media specifies its own DRM license server URI.

public MediaItem.DrmConfiguration.BuildersetForcedSessionTrackTypes(java.util.List<java.lang.Integer> forcedSessionTrackTypes)

Sets a list of track type constants for which to use a DRM session even when the tracks are in the clear.

public MediaItem.DrmConfiguration.BuildersetKeySetId(byte[] keySetId[])

Sets the key set ID of the offline license.

public MediaItem.DrmConfiguration.BuildersetLicenseRequestHeaders(java.util.Map<java.lang.String, java.lang.String> licenseRequestHeaders)

Sets the optional request headers attached to DRM license requests.

public MediaItem.DrmConfiguration.BuildersetLicenseUri(Uri licenseUri)

Sets the optional default DRM license server URI.

public MediaItem.DrmConfiguration.BuildersetMultiSession(boolean multiSession)

Sets whether multi session is enabled.

public MediaItem.DrmConfiguration.BuildersetPlayClearContentWithoutKey(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.

public MediaItem.DrmConfiguration.BuildersetScheme(java.util.UUID scheme)

Sets the java.util.UUID of the protection scheme.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder(java.util.UUID scheme)

Constructs an instance.

Parameters:

scheme: The java.util.UUID of the protection scheme.

Methods

public MediaItem.DrmConfiguration.Builder setScheme(java.util.UUID scheme)

Sets the java.util.UUID of the protection scheme.

public MediaItem.DrmConfiguration.Builder setLicenseUri(Uri licenseUri)

Sets the optional default DRM license server URI.

public MediaItem.DrmConfiguration.Builder setLicenseRequestHeaders(java.util.Map<java.lang.String, java.lang.String> licenseRequestHeaders)

Sets the optional request headers attached to DRM license requests.

public MediaItem.DrmConfiguration.Builder setMultiSession(boolean multiSession)

Sets whether multi session is enabled.

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.

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.

public MediaItem.DrmConfiguration.Builder forceSessionsForAudioAndVideoTracks(boolean useClearSessionsForAudioAndVideoTracks)

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 MediaItem.DrmConfiguration.Builder.setForcedSessionTrackTypes(List).

public MediaItem.DrmConfiguration.Builder setForcedSessionTrackTypes(java.util.List<java.lang.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 C.TRACK_TYPE_VIDEO and C.TRACK_TYPE_AUDIO, MediaItem.DrmConfiguration.Builder.forceSessionsForAudioAndVideoTracks(boolean) can be used.

This method overrides what has been set by previously calling MediaItem.DrmConfiguration.Builder.forceSessionsForAudioAndVideoTracks(boolean).

public MediaItem.DrmConfiguration.Builder setKeySetId(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)).