Package com.castlabs.android.player
Class DrmLicenseLoader.Builder
java.lang.Object
com.castlabs.android.player.DrmLicenseLoader.Builder
- Enclosing class:
DrmLicenseLoader
Use this builder class to generate new instances of the
DrmLicenseLoader
.-
Constructor Summary
ConstructorDescriptionBuilder
(Context context, PlayerConfig playerConfig, DrmLicenseLoader.Callback callback) Create a new builder to generate a license loader instance using the given PlayerConfig data.Builder
(Context context, String contentUrl, DrmConfiguration drmConfiguration, DrmLicenseLoader.Callback callback) Create a new builder to generate a license loader instance. -
Method Summary
Modifier and TypeMethodDescriptioncontentType
(int contentType) Explicitly set the content type.dataSourceFactory
(DataSourceFactory dataSourceFactory) Set the data source factory that is used to generate content requests.get()
Creates the license loader.headerParameter
(String key, String value) Add a header parameter to each content data requestmanifestModifier
(ManifestModifier manifestModifier) Add aManifestModifier
to optionally trim tracks out of it.mergeVideoTracks
(boolean mergeVideoTracks) Explicitly set the merge video tracks flag.queryParameter
(String key, String value) Add a query parameter to each content data requestsourceSelectorFactory
(com.google.android.exoplayer2.upstream.InternalSourceSelector.Factory sourceSelectorFactory) Set the source selector factory that is used to pick up a base url from the manifest
-
Constructor Details
-
Builder
public Builder(@NonNull Context context, @Nullable String contentUrl, @NonNull DrmConfiguration drmConfiguration, @NonNull DrmLicenseLoader.Callback callback) Create a new builder to generate a license loader instance. A valid content URL shall be specified for license loading. When using for license removal, the content URL can be null but then the content type shall be specified explicitly withcontentType(int)
- Parameters:
context
- The contextcontentUrl
- The URL to the content or null if unknown and removing licensedrmConfiguration
- The DRM configurationcallback
- The callback
-
Builder
public Builder(@NonNull Context context, @NonNull PlayerConfig playerConfig, @NonNull DrmLicenseLoader.Callback callback) Create a new builder to generate a license loader instance using the given PlayerConfig data. The builder will read the following values specified from the configuration:PlayerConfig.contentUrl
- (mandatory) The source URL to the contentPlayerConfig.drmConfiguration
- (mandatory) The DRM configurationPlayerConfig.contentParameters
- Bundle with additional header parameters for manifestsPlayerConfig.contentQueryParameters
- Bundle with additional query parameters for manifestsPlayerConfig.segmentParameters
- Bundle with additional header parameters for segmentsPlayerConfig.segmentQueryParameters
- Bundle with additional query parameters for segmentsPlayerConfig.contentType
PlayerConfig.mergeVideoTracks
- Parameters:
context
- The contextplayerConfig
- The bundle datacallback
- The callback
-
-
Method Details
-
contentType
Explicitly set the content type. Accepted value areSdkConsts.CONTENT_TYPE_DASH
,SdkConsts.CONTENT_TYPE_SMOOTHSTREAMING
,SdkConsts.CONTENT_TYPE_HLS
, orSdkConsts.CONTENT_TYPE_MP4
.- Parameters:
contentType
- The content type- Returns:
- The builder
-
mergeVideoTracks
Explicitly set the merge video tracks flag.- Parameters:
mergeVideoTracks
- The merge video tracks flag- Returns:
- The builder
-
dataSourceFactory
@NonNull public DrmLicenseLoader.Builder dataSourceFactory(@Nullable DataSourceFactory dataSourceFactory) Set the data source factory that is used to generate content requests. Note that this will reset any query and request parameters.- Parameters:
dataSourceFactory
- The data source factory- Returns:
- The builder
-
queryParameter
Add a query parameter to each content data request- Parameters:
key
- the keyvalue
- the value- Returns:
- The builder
-
headerParameter
@NonNull public DrmLicenseLoader.Builder headerParameter(@NonNull String key, @NonNull String value) Add a header parameter to each content data request- Parameters:
key
- the keyvalue
- the value- Returns:
- The builder
-
manifestModifier
@NonNull public DrmLicenseLoader.Builder manifestModifier(@Nullable ManifestModifier manifestModifier) Add aManifestModifier
to optionally trim tracks out of it. In the offline use case, non-downloaded tracks need to be removed from the Manifest, so the loader will properly fetch one of the downloaded tracks in order to acquire the PSSH data.- Parameters:
manifestModifier
- the modifier- Returns:
- The Builder
-
sourceSelectorFactory
@NonNull public DrmLicenseLoader.Builder sourceSelectorFactory(@Nullable com.google.android.exoplayer2.upstream.InternalSourceSelector.Factory sourceSelectorFactory) Set the source selector factory that is used to pick up a base url from the manifest- Parameters:
sourceSelectorFactory
- The source selector factory- Returns:
- The builder
-
get
Creates the license loader.- Returns:
- The license loader
- Throws:
IllegalArgumentException
- in case no plugin was found that can handle the content or no offline ID is specified in the DRM configurationNullPointerException
- if mandatory data are not specified
-