Class PlayerSDK
init(Context)
or init(Context, LicenseLoader)
to initialize the SDK.
Global configuration
The following application can be configured globally as static member of this class:
SECURE_SURFACE_VIEW_DISABLED
to disable the usage of the secured surface view. SeeSurfaceView.setSecure(boolean)
FORCE_UNSECURED_DECODER
enforces the usage of the unsecured video decoders
- Since:
- 1.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Callback interface that can be used to detect rooted devices. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic int
static boolean
Global parameter to enable or disable audio and video components clipping to their period duration (DASH-only).static float
The codec normalized weight for hardware implementation1.0f
used for the default track selection.static float
The codec normalized weight for software implementation0.5f
used for the default track selection.static float
The hardware codec H264 (AVC) normalized weight0.5f
used for the default video track selection.static float
The software codec H264 (AVC) normalized weight0.4f
used for the default video track selection.static float
The hardware codec H265 (HEVC) normalized weight1.0f
used for the default video track selection.static float
The software codec H265 (HEVC) normalized weight0.3f
used for the default video track selection.static float
The normalized weight0.2f
of the codec other thanCODEC_WEIGHT_MIME_H265_HW
,CODEC_WEIGHT_MIME_H265_SW
,CODEC_WEIGHT_MIME_H264_HW
andCODEC_WEIGHT_MIME_H264_SW
normalized weight0.5f
used for default video track selection.static int
Period in ms, used to poll the device's connectivity, whenENABLE_CONNECTIVITY_CHECKS
is enabledstatic ConnectivityCheck
The default connectivity check that will be used at runtime to check for internet connectivity.static int
Configure the exception severity that will cause theCrashlog.report(Throwable)
to be triggered automatically.static NetworkConfiguration
The default network configuration used by the downloader for both manifests and segmentsstatic com.google.android.exoplayer2.upstream.InternalSourceSelector.Factory
The defaultInternalSourceSelector.Factory
used during CDN fallback e.g.static KeyStore
The default key store that will be used to store and restore offline keys.static int
By default the player queries the device API version and internal API for support of the GL based dummy surface for faster and smoother transitions when the playback surface is attached/detached from the video codec.static boolean
Default global value to enable or disable automatic setting of a speed to 1x when playing ads.static boolean
static boolean
If true (default), allows the player to fallback to other decoders if it failed to initialize the primary decoder.static boolean
Key status change listener can be installed to CDM's starting API 23 and is used to get statuses of known key ids.static boolean
By default, the player will not automatically recover from loss of connectivity.static boolean
The default value to enable/disable internal handling of DASH event callbacksstatic boolean
When multipleDrm
systems are present on a device and one of them fails locally then the playback is automatically restarted and configured with another DRM type being available.static boolean
The player selects unsecure codec when starting playing clear part of the content e.g.static boolean
If set to true, the body of the HTTP response will be returned inCastlabsPlayerException.getErrorData()
when available.static boolean
Indicates whether to consider as fatal errors the ones encountered while downloading segments with MimeTypeMimeTypes.BASE_TYPE_APPLICATION
.static boolean
Enable a codec workaround that disables codec-reconfiguration on some devices.static boolean
If set totrue
and text language specified bySdkConsts.INTENT_PREFERRED_TEXT_LANGUAGE
does not match any of the available text tracks then the first available text track will still be enabled.static boolean
Deprecated.static boolean
Whether to trigger the alternative Manifest callback when an error occurs while downloading segments with MimeTypeMimeTypes.BASE_TYPE_APPLICATION
.static boolean
If true (default), allows the player to fallback to unsecure decoders if it failed to initialize the primary decoder.static boolean
static boolean
If true (default), allows the player to fallback to other decoders if it failed to initialize the primary decoder.static boolean
Global parameter to enable or disable the workaround whether all video frames are marked as sync frames but should not be treated as sync frames except the very first in a segment (DASH-only)static int
By default, the player queries the currently selected video codec if it supports fast adaptive bitrate switching (SdkConsts.FAST_BITRATE_SWITCHING_AUTO
).static boolean
By default the player pre-fetches the license as soon as tracks are selected and segments are ready to be downloaded.static boolean
If set to true, the behavior of the sdk on HDMI disconnect/hdcp disconnects would be to throw a fatal exception to indicate a crypto error as well as an info exception to indicate HDMI disconnection.static boolean
Global parameter whether to prefer DRM init data in segments over the manifest's data (DASH-only).static boolean
Sets the behaviour whenFORCE_HDCP_EXCEPTION
isfalse
, otherwise the option is ignored.static boolean
By default the player creates two DRM sessions, one for Audio, and one for Video.static boolean
Disable the usage of the secure decoder pipeline.static boolean
By default the player will deduce the maximum input size that is used to configure the video codec viaMediaFormat
and theMediaFormat.KEY_MAX_INPUT_SIZE
key.static boolean
Deprecated.useDrmConfiguration.forceWidevineL3
instead, orDrmTodayConfiguration.Builder.forceWidevineL3(boolean)
if using DrmTodayConfiguration.static long
This is the time in milliseconds to wait for DRM key to change its status fromKeyStatus.OutputNotAllowed
toKeyStatus.Usable
before throwing an exception.static long
This is the time in milliseconds to delay the HDMI connection event.static HttpDataSourceBuilder
The HTTP data source factory that is used to create http data sources.static LicenseLoader
The license loaderstatic boolean
Global parameter to enable or disable the video merging option, default istrue
static boolean
Default global value to enable or disable automatic playback pausing when HDMI is disconnected.static int
The default setting for HD content filter.static long
Timeout in milliseconds to release the underlying Player.static float
The preference of the codec implementation weight100.0f
, compare toPREFERENCE_CODEC_MIME
,PREFERENCE_TRACK_TYPE
andPREFERENCE_PIXEL_COUNT
.static float
The preference of the codec mimes weight20.0f
, compare toPREFERENCE_CODEC_IMPL
,PREFERENCE_TRACK_TYPE
andPREFERENCE_PIXEL_COUNT
.static float
The preference of the pixel count weight10.0f
, compare toPREFERENCE_CODEC_MIME
,PREFERENCE_CODEC_IMPL
andPREFERENCE_TRACK_TYPE
.static float
The preference of the track type weight40.0f
, compare toPREFERENCE_CODEC_MIME
,PREFERENCE_CODEC_IMPL
andPREFERENCE_PIXEL_COUNT
.static boolean
Enable this options if you have to play DASH Manifests that are not spec conform and define AdaptationSets' before BaseURLs'.static boolean
Default global value to enable or disable automatic restoring of a speed after playing ads.static int
Use this flag to configure handling of secondary displays.static boolean
Disable Secure SurfaceViewstatic long
Timeout in milliseconds to set the player Surface.static KeyStore
The SSL key store used to verify certificates only in case the system default key store fails to verify them.static SubtitlesPreviewBuilder
Static property that can be set (usually by plugins) to register a preview builder that is in turn used to create subtitle preview views.If specified, the callback implementation will be triggered on the main thread and inform about the current system status.static TrackTypeProvider
The track type provider that will be used to define track group and tracks types and their weights.static int
static int
The default global video codec filter used to configure the video codec filtering.static VideoFilterConfiguration
The default globalVideoFilterConfiguration
to use in order to filter video qualities.static Point
Deprecated.UseVIDEO_FILTER
instead. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addLegacyDeviceScreenResolution
(String manufacturer, String model) Add a device for which its screen dimensions will be read using the legacy approach.static Context
Access the globally configured application context used by the SDK.static List<Downloadable>
static Collection<DrmLicenseManagerComponent>
static List<PlayerControllerPlugin>
static List<PlayerPlugin>
static List<PlayerViewPlugin>
static <T extends Plugin>
TReturns the instance of the registered plugin or null if no plugin was foundstatic Collection<Plugin>
static List<TrackRendererPlugin>
static String
Exposes the SDK versionstatic void
Initializes the SDK using the given context and the defaultManifestLicenseLoader
to find a meta-data entry with the keycastlabs-license
in your Applications Manifest.static void
init
(Context ctx, LicenseLoader licenseLoader) Initializes the SDK using the given context andLicenseLoader
to find and load a license file.static void
Initializes the SDK using the given context and the license specified here.static boolean
isPluginRegistered
(Drm drm) INTERNAL! This is an internal method and you will not need to call this method explicitly.static void
register
(Downloadable plugin) static void
Register external Drm plugin to the sdk.static void
register
(PlayerControllerPlugin plugin) Register a newPlayerControllerPlugin
static void
register
(PlayerPlugin plugin) Register a new player pluginstatic void
register
(PlayerViewPlugin plugin) Register a newPlayerViewPlugin
static void
register
(TrackRendererPlugin plugin) Register a new track renderer pluginstatic void
Register a new pluginstatic void
Register a new DrmLicenseManagerComponentstatic void
INTERNAL method that will block until the SDK is fully initialized.
-
Field Details
-
SECURE_SURFACE_VIEW_DISABLED
public static boolean SECURE_SURFACE_VIEW_DISABLEDDisable Secure SurfaceView -
FORCE_UNSECURED_DECODER
public static boolean FORCE_UNSECURED_DECODERDisable the usage of the secure decoder pipeline. Note that this will prevent playback of protected content on some devices. -
FORCE_WIDEVINE_L3
public static boolean FORCE_WIDEVINE_L3Deprecated.useDrmConfiguration.forceWidevineL3
instead, orDrmTodayConfiguration.Builder.forceWidevineL3(boolean)
if using DrmTodayConfiguration.If set to true, Widevine L3 will be enforces. Note that this will prevent playback of DRM content where the license requires L1 security. This flag can be set for certain devices that are known to have broken secure decoder implementation to allow Widevine protected content playback. -
ENABLE_MAX_REF_FRAME_WORKAROUND
public static boolean ENABLE_MAX_REF_FRAME_WORKAROUNDEnable a codec workaround that disables codec-reconfiguration on some devices. The devices list currently covers Huawei P7 and P8-Lite as well as Qualcomm CPU. The workaround seems to be needed if the decoder is initialized with no B-Frame support and then switches to a track with B-Frames. In that case re-configuration is not sufficient and a full decoder reset is required.Please note that the same effect can be achieved bu setting
FAST_BITRATE_SWITCHING
toSdkConsts.FAST_BITRATE_SWITCHING_DISABLED
in case there are other devices that need this workaround.More information can be found at https://github.com/google/ExoPlayer/issues/2416
-
SECONDARY_DISPLAY
public static int SECONDARY_DISPLAYUse this flag to configure handling of secondary displays. Secondary displays are registered when an external HDMI display is connected (for phones and tablets) or screen mirriring is enabled. This is the default setting that will be used for all player instances. The default isSdkConsts.SECONDARY_DISPLAY_ALLOW_UNPROTECTED_CONTENT | SdkConsts.SECONDARY_DISPLAY_ALLOW_SECURE_DISPLAY
which will always allow the usage of a secondary display for unprotected content and will allow a secondary display for protected content if the secondary display is considered secure (both flagsDisplay.FLAG_SECURE
andDisplay.FLAG_SUPPORTS_PROTECTED_BUFFERS
are set totrue
). Note that this is the default setting that will be applied to all player instances, but you can usePlayerController.setSecondaryDisplay(int)
to overwrite the default per player instance. -
PLAYBACK_HD_CONTENT
public static int PLAYBACK_HD_CONTENTThe default setting for HD content filter. This is a bit field consisting of the values ofSdkConsts.ALLOW_HD_CLEAR_CONTENT
,SdkConsts.ALLOW_HD_DRM_ROOT_OF_TRUST
,SdkConsts.ALLOW_HD_DRM_SECURE_MEDIA_PATH
,SdkConsts.ALLOW_HD_NEVER
, andSdkConsts.ALLOW_HD_DRM_SOFTWARE
. The value here specifies under which circumstances HD representations are allowed and will not be filtered away. The default setting is:SdkConsts.ALLOW_HD_CLEAR_CONTENT | SdkConsts.ALLOW_HD_DRM_SECURE_MEDIA_PATH
. This allows playback of HD content for unencrypted streams or for streams that are protected with a DRM that supportsSecurityLevel.SECURE_MEDIA_PATH
. This field holds the global default, but you can specify a content specific setting using the player controllersPlayerController.setHdPlaybackEnabled(int)
-
VIDEO_CODEC_FILTER
public static int VIDEO_CODEC_FILTERThe default global video codec filter used to configure the video codec filtering. This value should be one ofSdkConsts.VIDEO_CODEC_FILTER_NONE
orSdkConsts.VIDEO_CODEC_FILTER_CAPS
The default one isSdkConsts.VIDEO_CODEC_FILTER_NONE
. It is overwritten for single playback session by the value of the keySdkConsts.INTENT_VIDEO_CODEC_FILTER
when the latter is set. -
ENABLE_VIDEO_DECODER_FALLBACK
public static boolean ENABLE_VIDEO_DECODER_FALLBACKIf true (default), allows the player to fallback to other decoders if it failed to initialize the primary decoder. This can for instance happen if the primary decoder is a hardware implementation and is already blocked by another playback session. In that case, secondary decoders, i.e. software implementations, will be used if possible. -
ENABLE_AUDIO_DECODER_FALLBACK
public static boolean ENABLE_AUDIO_DECODER_FALLBACKIf true (default), allows the player to fallback to other decoders if it failed to initialize the primary decoder. This can for instance happen if the primary decoder is a hardware implementation and is already blocked by another playback session. In that case, secondary decoders, i.e. software implementations, will be used if possible. -
ENABLE_UNSECURE_DECODER_FALLBACK
public static boolean ENABLE_UNSECURE_DECODER_FALLBACKIf true (default), allows the player to fallback to unsecure decoders if it failed to initialize the primary decoder. This requires that the video decoder fallback is enabled. -
VIDEO_CODEC_BUFFER_MODE
public static int VIDEO_CODEC_BUFFER_MODE -
AUDIO_CODEC_BUFFER_MODE
public static int AUDIO_CODEC_BUFFER_MODE -
ENABLE_VIDEO_CODEC_SYNC_INTERACTIONS_WITH_QUEUEING
public static boolean ENABLE_VIDEO_CODEC_SYNC_INTERACTIONS_WITH_QUEUEING -
ENABLE_AUDIO_CODEC_SYNC_INTERACTIONS_WITH_QUEUEING
public static boolean ENABLE_AUDIO_CODEC_SYNC_INTERACTIONS_WITH_QUEUEING -
PAUSE_ON_HDMI_DISCONNECTED
public static boolean PAUSE_ON_HDMI_DISCONNECTEDDefault global value to enable or disable automatic playback pausing when HDMI is disconnected. Can be per playback specified withSdkConsts.INTENT_PAUSE_ON_HDMI_DISCONNECTED
orPlayerConfig.pauseOnHdmiDisconnected
Only for API higher or equal to 21 -
ENABLE_AD_SPEED_UP
public static boolean ENABLE_AD_SPEED_UPDefault global value to enable or disable automatic setting of a speed to 1x when playing ads. By default the ads will be played at 1x speed. The option can also be set for specific playback only withSdkConsts.INTENT_ENABLE_AD_SPEED_UP
orPlayerConfig.enableAdSpeedUp
-
RESTORE_SPEED
public static boolean RESTORE_SPEEDDefault global value to enable or disable automatic restoring of a speed after playing ads. By default the speed will be set to the one used before playing ads. The option can also be set for specific playback only withSdkConsts.INTENT_RESTORE_SPEED
orPlayerConfig.restoreSpeed
-
VIDEO_SIZE_FILTER
Deprecated.UseVIDEO_FILTER
instead.The default global pixel count filter used to configure the video size filtering. This value should be a validPoint
(w x h) or one ofSdkConsts.VIDEO_SIZE_FILTER_AUTO
,SdkConsts.VIDEO_SIZE_FILTER_NONE
. The default one isSdkConsts.VIDEO_SIZE_FILTER_AUTO
. It is overwritten for single playback session by the value of the keySdkConsts.INTENT_VIDEO_SIZE_FILTER
when the latter is set. Note When setting the value to other thanSdkConsts.VIDEO_SIZE_FILTER_AUTO
it is strongly recommended to set theVIDEO_CODEC_FILTER
toSdkConsts.VIDEO_CODEC_FILTER_CAPS
otherwise the video streams with high resolutions will be forced to play on devices that may not have support for it. -
VIDEO_FILTER
The default globalVideoFilterConfiguration
to use in order to filter video qualities. Applied to both ads and content tracks. Can be an instance ofVideoFilterConfiguration
, or one ofSdkConsts.VIDEO_FILTER_AUTO
orSdkConsts.VIDEO_FILTER_NONE
. The default one isSdkConsts.VIDEO_FILTER_AUTO
. It is overwritten for single playback session by the value of the keySdkConsts.INTENT_VIDEO_FILTER
when the latter is set. Note When setting the value to other thanSdkConsts.VIDEO_FILTER_AUTO
it is strongly recommended to set theVIDEO_CODEC_FILTER
toSdkConsts.VIDEO_CODEC_FILTER_CAPS
otherwise the video streams with high resolutions will be forced to play on devices that may not have support for it. -
MERGE_VIDEO_TRACKS
public static boolean MERGE_VIDEO_TRACKSGlobal parameter to enable or disable the video merging option, default istrue
-
ENABLE_TEXT_WITH_NO_PREFERRED_LANGUAGE
public static boolean ENABLE_TEXT_WITH_NO_PREFERRED_LANGUAGEIf set totrue
and text language specified bySdkConsts.INTENT_PREFERRED_TEXT_LANGUAGE
does not match any of the available text tracks then the first available text track will still be enabled. This is the default behaviour. -
ENABLE_DASH_EVENT_CALLBACK
public static boolean ENABLE_DASH_EVENT_CALLBACKThe default value to enable/disable internal handling of DASH event callbacks -
ENABLE_WORKAROUND_EVERY_VIDEO_FRAME_IS_SYNC_FRAME
public static boolean ENABLE_WORKAROUND_EVERY_VIDEO_FRAME_IS_SYNC_FRAMEGlobal parameter to enable or disable the workaround whether all video frames are marked as sync frames but should not be treated as sync frames except the very first in a segment (DASH-only) Note: enable it only when needed, since it degrades the seek performance -
CLIP_PERIODS
public static boolean CLIP_PERIODSGlobal parameter to enable or disable audio and video components clipping to their period duration (DASH-only). Enable to clip un-aligned durations of audio and video components to their period duration. The default is true -
FORCE_IN_STREAM_DRM_INIT_DATA
public static boolean FORCE_IN_STREAM_DRM_INIT_DATAGlobal parameter whether to prefer DRM init data in segments over the manifest's data (DASH-only). The parameter can also be set for a single stream viaSdkConsts.INTENT_FORCE_IN_STREAM_DRM_INIT_DATA
orPlayerConfig.forceInStreamDrmInitData
The default is false -
DEFAULT_KEY_STORE
The default key store that will be used to store and restore offline keys. If no default is set wheninit(Context)
is called, theSharedPreferencesKeyStore
will be used. -
SSL_KEY_STORE
The SSL key store used to verify certificates only in case the system default key store fails to verify them. Thus, this is NOT a replacement of the system key store! Leave or set it tonull
when no custom verification is needed. Set it up when your certificate is not (yet) trusted by the system or the application is running on the older version of system without the needed CA. Note: The application shall take care of maintaining the custom key store and keeping it up-to-date. Note: There is a limitation of using customSSL_KEY_STORE
with enabled okhttp plugin as it brings a significant delay when opening a connection. -
TRACK_TYPE_PROVIDER
The track type provider that will be used to define track group and tracks types and their weights. If it is not set wheninit(Context)
is called, theDefaultTrackTypeProvider
will be used -
DEFAULT_DOWNLOADER_NETWORK_CONFIGURATION
The default network configuration used by the downloader for both manifests and segments -
DEFAULT_INTERNAL_SOURCE_SELECTOR_FACTORY
public static com.google.android.exoplayer2.upstream.InternalSourceSelector.Factory DEFAULT_INTERNAL_SOURCE_SELECTOR_FACTORYThe defaultInternalSourceSelector.Factory
used during CDN fallback e.g. DASH multi BaseUrl handling -
PREFERENCE_CODEC_IMPL
public static float PREFERENCE_CODEC_IMPLThe preference of the codec implementation weight100.0f
, compare toPREFERENCE_CODEC_MIME
,PREFERENCE_TRACK_TYPE
andPREFERENCE_PIXEL_COUNT
. Used to define the priority of the codec implementationsCODEC_WEIGHT_IMPL_HW
orCODEC_WEIGHT_IMPL_SW
over other weights -
PREFERENCE_TRACK_TYPE
public static float PREFERENCE_TRACK_TYPEThe preference of the track type weight40.0f
, compare toPREFERENCE_CODEC_MIME
,PREFERENCE_CODEC_IMPL
andPREFERENCE_PIXEL_COUNT
. Used to define the priority of the track types seeTrackTypeProvider
over other weights -
PREFERENCE_CODEC_MIME
public static float PREFERENCE_CODEC_MIMEThe preference of the codec mimes weight20.0f
, compare toPREFERENCE_CODEC_IMPL
,PREFERENCE_TRACK_TYPE
andPREFERENCE_PIXEL_COUNT
. Used to define the priority of the codec mimesCODEC_WEIGHT_MIME_H265_HW
,CODEC_WEIGHT_MIME_H265_SW
,CODEC_WEIGHT_MIME_H264_HW
,CODEC_WEIGHT_MIME_H264_SW
orCODEC_WEIGHT_MIME_OTHER
over other weights -
PREFERENCE_PIXEL_COUNT
public static float PREFERENCE_PIXEL_COUNTThe preference of the pixel count weight10.0f
, compare toPREFERENCE_CODEC_MIME
,PREFERENCE_CODEC_IMPL
andPREFERENCE_TRACK_TYPE
. Used to define the priority of the pixel count values (width x height) over other weights -
CODEC_WEIGHT_IMPL_HW
public static float CODEC_WEIGHT_IMPL_HWThe codec normalized weight for hardware implementation1.0f
used for the default track selection. -
CODEC_WEIGHT_IMPL_SW
public static float CODEC_WEIGHT_IMPL_SWThe codec normalized weight for software implementation0.5f
used for the default track selection. -
CODEC_WEIGHT_MIME_H265_HW
public static float CODEC_WEIGHT_MIME_H265_HWThe hardware codec H265 (HEVC) normalized weight1.0f
used for the default video track selection. -
CODEC_WEIGHT_MIME_H265_SW
public static float CODEC_WEIGHT_MIME_H265_SWThe software codec H265 (HEVC) normalized weight0.3f
used for the default video track selection. -
CODEC_WEIGHT_MIME_H264_HW
public static float CODEC_WEIGHT_MIME_H264_HWThe hardware codec H264 (AVC) normalized weight0.5f
used for the default video track selection. -
CODEC_WEIGHT_MIME_H264_SW
public static float CODEC_WEIGHT_MIME_H264_SWThe software codec H264 (AVC) normalized weight0.4f
used for the default video track selection. -
CODEC_WEIGHT_MIME_OTHER
public static float CODEC_WEIGHT_MIME_OTHERThe normalized weight0.2f
of the codec other thanCODEC_WEIGHT_MIME_H265_HW
,CODEC_WEIGHT_MIME_H265_SW
,CODEC_WEIGHT_MIME_H264_HW
andCODEC_WEIGHT_MIME_H264_SW
normalized weight0.5f
used for default video track selection. -
CRASHLOG_AUTO_REPORT
public static int CRASHLOG_AUTO_REPORTConfigure the exception severity that will cause theCrashlog.report(Throwable)
to be triggered automatically. This should be one ofCastlabsPlayerException.SEVERITY_INFO
,CastlabsPlayerException.SEVERITY_WARNING
,CastlabsPlayerException.SEVERITY_ERROR
, or-1
to disable all automated crash reports. By default errors with severityCastlabsPlayerException.SEVERITY_INFO
or higher will be reported. -
FAST_BITRATE_SWITCHING
public static int FAST_BITRATE_SWITCHINGBy default, the player queries the currently selected video codec if it supports fast adaptive bitrate switching (SdkConsts.FAST_BITRATE_SWITCHING_AUTO
). There are however devices where the codec reports an incorrect value. For these devices, you can force the setting to eitherSdkConsts.FAST_BITRATE_SWITCHING_ENABLED
orSdkConsts.FAST_BITRATE_SWITCHING_DISABLED
. Set this field to one ofSdkConsts.FAST_BITRATE_SWITCHING_AUTO
(default),SdkConsts.FAST_BITRATE_SWITCHING_ENABLED
, orSdkConsts.FAST_BITRATE_SWITCHING_DISABLED
. -
ENABLE_TRICK_MODE_TRACK_SWITCH
public static boolean ENABLE_TRICK_MODE_TRACK_SWITCHDeprecated.UseTrickplayConfiguration.preferTrickPlayTracks
insteadBy default, the player will not switch to any trick mode tracks when the playback speed is changed and will stay on the current video track. Set the value totrue
to use the trick mode track when the latter is available -
ENABLE_CONNECTIVITY_CHECKS
public static boolean ENABLE_CONNECTIVITY_CHECKSBy default, the player will not automatically recover from loss of connectivity. Setting this flag totrue
will enable automatic recovery in case the device will loose internet connectivity.- See Also:
-
CONNECTIVITY_CHECK_PERIOD_MS
public static int CONNECTIVITY_CHECK_PERIOD_MSPeriod in ms, used to poll the device's connectivity, whenENABLE_CONNECTIVITY_CHECKS
is enabled- See Also:
-
DUMMY_SURFACE_MODE
public static int DUMMY_SURFACE_MODEBy default the player queries the device API version and internal API for support of the GL based dummy surface for faster and smoother transitions when the playback surface is attached/detached from the video codec.This feature is used, for instance, when client side Ad insertion is enabled through the IMA plugin.
On some devices though, the GL support for the dummy surface and is not properly implemented. In this case, this flag can be use to disable the auto detection mode and manually enable or disable the usage of the dummy surface by setting this flag to
SdkConsts.DUMMY_SURFACE_ENABLED
orSdkConsts.DUMMY_SURFACE_DISABLED
.Please note that this flag is automatically adjusted during the initialization of the SDK based on the current device. If you intent to change the value if this flag, make sure you change it before the call to
init(Context)
. -
PRESCAN_DASH_MANIFESTS
public static boolean PRESCAN_DASH_MANIFESTSEnable this options if you have to play DASH Manifests that are not spec conform and define AdaptationSets' before BaseURLs'. The spec defines the entries in a Period in the Manifest as a sequence where the order matters and BaseURL entries should appear before other entries. Enabling this options causes the Manifest parser to pre-scan the Manifest for BaseURL entries. Note that this means the parser needs to scan the Manifest twice and you should only enable this if it is necessary. -
HTTP_DATASOURCE_BUILDER
The HTTP data source factory that is used to create http data sources. Note that is us a public field because it is used by some plugins and extensions but you usually do not need to set this field manually! -
SUBTITLE_PREVIEW_BUILDER
Static property that can be set (usually by plugins) to register a preview builder that is in turn used to create subtitle preview views. -
CONNECTIVITY_CHECKER
The default connectivity check that will be used at runtime to check for internet connectivity. -
FORCE_SINGLE_DRM_SESSION
public static boolean FORCE_SINGLE_DRM_SESSIONBy default the player creates two DRM sessions, one for Audio, and one for Video. If you are certain that the DRM backend returns all required license keys with one request, you can use this flag to enforce only one DRM session. -
FORCE_DRM_LICENSE_PREFETCH
public static boolean FORCE_DRM_LICENSE_PREFETCHBy default the player pre-fetches the license as soon as tracks are selected and segments are ready to be downloaded. This provides smooth period transitions withPlayerController
and smooth items transitions withSingleControllerPlaylist
. If disabled, then the license will only be acquired when needed for decryption by a renderer. -
ENABLE_DRM_PLACEHOLDER_SESSION
public static boolean ENABLE_DRM_PLACEHOLDER_SESSIONThe player selects unsecure codec when starting playing clear part of the content e.g. DASH period. Then, when the content is switched to the encrypted one, the unsecure codec is closed and is replaced with a secure one. The user may experience a black screen while the codec is changed. Note that the unsecure codec is selected even if the secure one is forced via player configuration. This flag when enabled, allows to select the secure codec even if the playback starts with content clear part. The default is Util.SDK_INT >= 23. The placeholder is disabled for older devices by default as not all the devices below API 23 may support DRM session sharing needed for placeholder to work correctly. -
ENABLE_DRM_FALLBACK
public static boolean ENABLE_DRM_FALLBACKWhen multipleDrm
systems are present on a device and one of them fails locally then the playback is automatically restarted and configured with another DRM type being available. The fallback works withDrmTodayConfiguration
only and whenDrmConfiguration.drm
is specified asDrm.BestAvailable
. The fallback can be disabled by setting this flag tofalse
. The most secure after the failed DRM is selected always during the fallback. Note that the video quality may degrade after the DRM fallback, consider for example OMA not allowing HD playback. Examples of possible DRM fallbacks: Widevine to PlayReady, Widevine to OMA, Widevine to PlayReady to OMA. -
ENABLE_CDM_KEY_STATUS
public static boolean ENABLE_CDM_KEY_STATUSKey status change listener can be installed to CDM's starting API 23 and is used to get statuses of known key ids. Can be overridden with true or false -
FORCE_VIDEO_CODEC_MAX_INPUT_SIZE_UNKNOWN
public static boolean FORCE_VIDEO_CODEC_MAX_INPUT_SIZE_UNKNOWNBy default the player will deduce the maximum input size that is used to configure the video codec viaMediaFormat
and theMediaFormat.KEY_MAX_INPUT_SIZE
key. On some devices, the internal buffer size might not be set correctly and will be to small. You can try to set this flag to true on such devices to work around this issue.Note it is generally advised to use this on targeted devices only where this actually works around in issue in the codec implementation.
- Since:
- 4.1.6
-
ENABLE_FATAL_RETRY_MIME_APPLICATION
public static boolean ENABLE_FATAL_RETRY_MIME_APPLICATIONIndicates whether to consider as fatal errors the ones encountered while downloading segments with MimeTypeMimeTypes.BASE_TYPE_APPLICATION
. -
ENABLE_TRIGGER_MANIFEST_FALLBACK_MIME_APPLICATION
public static boolean ENABLE_TRIGGER_MANIFEST_FALLBACK_MIME_APPLICATIONWhether to trigger the alternative Manifest callback when an error occurs while downloading segments with MimeTypeMimeTypes.BASE_TYPE_APPLICATION
. -
SYSTEM_STATUS_CALLBACK
If specified, the callback implementation will be triggered on the main thread and inform about the current system status. Please note that this might happen multiple times.The system status is evaluated when the SDK is initialized so please make sure that you are setting this callback before you call
init(Context, String)
. -
FORCE_HDCP_EXCEPTION
public static boolean FORCE_HDCP_EXCEPTIONIf set to true, the behavior of the sdk on HDMI disconnect/hdcp disconnects would be to throw a fatal exception to indicate a crypto error as well as an info exception to indicate HDMI disconnection. The default behavior is for it be false where the SDK would only throw an exception with severity INFO to indicate HDMI/HDCP disconnect and pause till reconnection is achieved. -
FORCE_REOPEN_ON_HDCP_STATE_CHANGE
public static boolean FORCE_REOPEN_ON_HDCP_STATE_CHANGESets the behaviour whenFORCE_HDCP_EXCEPTION
isfalse
, otherwise the option is ignored. If set totrue
then the playback will be closed and then re-opened when HDCP state allows playback, otherwise (default) the playback will not be closed but the video qualities not allowed for playback will be disabled. -
HDCP_EXCEPTION_TIMEOUT_MS
public static long HDCP_EXCEPTION_TIMEOUT_MSThis is the time in milliseconds to wait for DRM key to change its status fromKeyStatus.OutputNotAllowed
toKeyStatus.Usable
before throwing an exception. The timeout is needed when HDMI-display only device is turned on together with HDMI-display and playback starts shortly. It may be the case that HDCP session is not ready yet and needs some more time to complete its setup, so that the playback has to wait. After the timeout the playback will throw CryptoException assuming the output digital requirements can not be met on the current device. Set to {literal 0} to disable the timeout. -
HDMI_CONNECTION_DELAY_MS
public static long HDMI_CONNECTION_DELAY_MSThis is the time in milliseconds to delay the HDMI connection event. The delay is what usually required for the device to setup HDCP session with external display. Devices with API >= 23 does not need this delay as they are operating withinHDCP_EXCEPTION_TIMEOUT_MS
timeout. For other devices this value is defaulted to 3000 ms. Therefore, when the player is re-opening the stream upon HDMI event then it will wait for the specified delay. -
PLAYER_RELEASE_TIMEOUT_MS
public static long PLAYER_RELEASE_TIMEOUT_MSTimeout in milliseconds to release the underlying Player. -
SET_SURFACE_TIMEOUT_MS
public static long SET_SURFACE_TIMEOUT_MSTimeout in milliseconds to set the player Surface. -
licenseLoader
The license loader -
ENABLE_ERROR_RESPONSE_BODY
public static boolean ENABLE_ERROR_RESPONSE_BODYIf set to true, the body of the HTTP response will be returned inCastlabsPlayerException.getErrorData()
when available. The key to get it from the bundle isCastlabsPlayerException.RESPONSE_BODY
-
-
Method Details
-
init
Initializes the SDK using the given context and the defaultManifestLicenseLoader
to find a meta-data entry with the keycastlabs-license
in your Applications Manifest.Please note that you need to
register(Plugin)
all plugins you want to use before you call this method.Note that in case the license key is invalid the SDK will not be initialized and the error will be sent via the
PlayerListener.onError(CastlabsPlayerException)
. The SDK however can still be tried to re-initialized with valid key if applicable.- Parameters:
ctx
- The application context
-
init
Initializes the SDK using the given context and the license specified here. Please note that you need toregister(Plugin)
all plugins you want to use before you call this method.Note that in case the license key is invalid the SDK will not be initialized and the error will be sent via the
PlayerListener.onError(CastlabsPlayerException)
. The SDK however can still be tried to re-initialized with valid key if applicable.- Parameters:
ctx
- The application contextlicense
- The license key
-
init
Initializes the SDK using the given context andLicenseLoader
to find and load a license file. Please note that you need toregister(Plugin)
all plugins you want to use before you call this method.Note that in case the license key is invalid the SDK will not be initialized and the error will be sent via the
PlayerListener.onError(CastlabsPlayerException)
. The SDK however can still be tried to re-initialized with valid key if applicable.- Parameters:
ctx
- the contextlicenseLoader
- the license loader that will be used to load the license data
-
waitForInitialization
INTERNAL method that will block until the SDK is fully initialized. You usually do not need to call this method manually.- Throws:
Throwable
- in case an error occurs during initialization
-
getContext
Access the globally configured application context used by the SDK. A runtime exception is thrown if the SDK is not initialized.- Returns:
- context the context used by the SDK
- Throws:
RuntimeException
- if the SDK is not yet initialized
-
register
Register a new track renderer plugin- Parameters:
plugin
- the plugin
-
register
Register a new player plugin- Parameters:
plugin
- the plugin
-
register
-
register
Register external Drm plugin to the sdk.- Parameters:
drm
- drm to be registered
-
register
Register a new plugin- Parameters:
plugin
- the plugin
-
registerDrmLicenseManagerComponent
Register a new DrmLicenseManagerComponent- Parameters:
component
- the component
-
register
Register a newPlayerViewPlugin
- Parameters:
plugin
- The plugin- Since:
- 3.2.2
-
register
Register a newPlayerControllerPlugin
- Parameters:
plugin
- The plugin- Since:
- 4.0.0
-
getPlugin
Returns the instance of the registered plugin or null if no plugin was found- Type Parameters:
T
- The plugin class type- Parameters:
pluginClass
- The plugin class- Returns:
- Plugin the plugin instance
-
getTrackRendererPlugins
- Returns:
- plugins the list of currently registered track renderer plugins
-
getPlayerPlugins
- Returns:
- plugins the list of currently registered player plugins
-
getPlugins
- Returns:
- plugins the list of currently registered plugins
-
getDrmLicenseManagerComponents
- Returns:
- the list of currently registered DrmLicenseManagerComponents
-
getDownloadablePlugins
- Returns:
- plugins The list of currently registered downloadable plugins
-
getPlayerViewPlugins
- Returns:
- plugins The list of currently registered player-view plugins
-
getPlayerControllerPlugins
- Returns:
- plugins The list of currently registered player-view plugins
-
isPluginRegistered
INTERNAL! This is an internal method and you will not need to call this method explicitly. If you are looking for an APU to get information about the support of a given DRM system, please take a look atDrmUtils.isDrmSupported(Drm)
.- Parameters:
drm
- The DRM system- Returns:
- True if a plugin is registered that supports the given DRM type
-
getVersion
Exposes the SDK version- Returns:
- The SDK version
-
addLegacyDeviceScreenResolution
Add a device for which its screen dimensions will be read using the legacy approach.It has been seen that on some STBs, the underlying new APIs are not reliable while the approach for Android versions < 25 results in the expected behaviour.
Note that this method won't work with all devices, and it is specially likely not to work with devices running on API >=25.
In case the legacy method is forced for a device, but no resolution is available through it, it will default to the standard behaviour.
- Parameters:
manufacturer
- manufacturer of the device, as found inBuild.MANUFACTURER
model
- manufacturer of the device, as found inBuild.MODEL
-
TrickplayConfiguration.preferTrickPlayTracks
instead