Package com.castlabs.android.player
Class DrmLicenseLoader.Builder
- java.lang.Object
-
- com.castlabs.android.player.DrmLicenseLoader.Builder
-
- Enclosing class:
- DrmLicenseLoader
public static class DrmLicenseLoader.Builder extends Object
Use this builder class to generate new instances of theDrmLicenseLoader.
-
-
Constructor Summary
Constructors Constructor Description Builder(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DrmLicenseLoader.BuildercontentType(int contentType)Explicitly set the content type.DrmLicenseLoader.BuilderdataSourceFactory(DataSourceFactory dataSourceFactory)Set the data source factory that is used to generate content requests.DrmLicenseLoaderget()Creates the license loader.DrmLicenseLoader.BuilderheaderParameter(String key, String value)Add a header parameter to each content data requestDrmLicenseLoader.BuildermanifestModifier(ManifestModifier manifestModifier)Add aManifestModifierto optionally trim tracks out of it.DrmLicenseLoader.BuildermergeVideoTracks(boolean mergeVideoTracks)Explicitly set the merge video tracks flag.DrmLicenseLoader.BuilderqueryParameter(String key, String value)Add a query parameter to each content data requestDrmLicenseLoader.BuildersourceSelectorFactory(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 Detail
-
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.contentTypePlayerConfig.mergeVideoTracks
- Parameters:
context- The contextplayerConfig- The bundle datacallback- The callback
-
-
Method Detail
-
contentType
@NonNull public DrmLicenseLoader.Builder contentType(int 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
@NonNull public DrmLicenseLoader.Builder mergeVideoTracks(boolean 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
@NonNull public DrmLicenseLoader.Builder queryParameter(@NonNull String key, @NonNull String value)
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 aManifestModifierto 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
@NonNull public DrmLicenseLoader get() throws IllegalArgumentException, NullPointerException
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
-
-