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_DISABLEDto disable the usage of the secured surface view. SeeSurfaceView.setSecure(boolean)FORCE_UNSECURED_DECODERenforces the usage of the unsecured video decoders
- Since:
- 1.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classHolds flags for experimental features.static interfaceCallback interface that can be used to detect rooted devices. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic intAudio codec buffer mode.static booleanGlobal parameter to enable or disable audio and video components clipping to their period duration (DASH-only).static floatThe codec normalized weight for hardware implementation1.0fused for the default track selection.static floatThe codec normalized weight for software implementation0.5fused for the default track selection.static floatThe hardware codec H264 (AVC) normalized weight0.5fused for the default video track selection.static floatThe software codec H264 (AVC) normalized weight0.4fused for the default video track selection.static floatThe hardware codec H265 (HEVC) normalized weight1.0fused for the default video track selection.static floatThe software codec H265 (HEVC) normalized weight0.3fused for the default video track selection.static floatThe normalized weight0.2fof the codec other thanCODEC_WEIGHT_MIME_H265_HW,CODEC_WEIGHT_MIME_H265_SW,CODEC_WEIGHT_MIME_H264_HWandCODEC_WEIGHT_MIME_H264_SWnormalized weight0.5fused for default video track selection.static StringShould be set to the companion sdk name if used.static StringShould be set to the companion sdk version if used.static intPeriod in ms, used to poll the device's connectivity, whenENABLE_CONNECTIVITY_CHECKSis enabledstatic ConnectivityCheckThe default connectivity check that will be used at runtime to check for internet connectivity.static intConfigure the exception severity that will cause theCrashlog.report(Throwable)to be triggered automatically.static NetworkConfigurationThe default network configuration used by the downloader for both manifests and segmentsstatic DrmConfigurationDefault DRM configuration to be used when no DRM configuration is contained inPlayerConfig.static booleanIf true, then any non-empty DRM URL found in the manifest will be used instead ofDrmConfiguration.urlDefault is falsestatic com.google.android.exoplayer2.upstream.InternalSourceSelector.FactoryThe defaultInternalSourceSelector.Factoryused during CDN fallback e.g.static KeyStoreThe default key store that will be used to store and restore offline keys.static intThe maximum number of frames that can be dropped between invocations ofVideoRendererListener.onDroppedFrames(int, long)Set to-1to disable.static longSet toLong.MAX_VALUEto permanently disable the video qualitystatic intThe number of dropped frames withinDROPPED_VIDEO_FRAME_THRESHOLD_DURATION_MSto trigger video quality blacklisting.static longThe duration to keep frame dropped eventsstatic intBy 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 booleanDefault global value to enable or disable automatic setting of a speed to 1x when playing ads.static booleanEnable audio codec sync interactions with queueing.static booleanIf true (default), allows the player to fallback to other decoders if it failed to initialize the primary decoder.static booleanKey status change listener can be installed to CDM's starting API 23 and is used to get statuses of known key ids.static booleanBy default, the player will not automatically recover from loss of connectivity.static booleanThe default value to enable/disable internal handling of DASH event callbacksstatic booleanWhen multipleDrmsystems 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 booleanThe player selects unsecure codec when starting playing clear part of the content e.g.static booleanIf set to true, the body of the HTTP response will be returned inCastlabsPlayerException.getErrorData()when available.static booleanIndicates whether to consider as fatal errors the ones encountered while downloading segments with MimeTypeMimeTypes.BASE_TYPE_APPLICATION.static booleanWhether to allow to invalidate selections on renderer capabilities change.static booleanEnable a codec workaround that disables codec-reconfiguration on some devices.static booleanIf set totrueand text language specified bySdkConsts.INTENT_PREFERRED_TEXT_LANGUAGEdoes not match any of the available text tracks then the first available text track will still be enabled.static booleanDeprecated.static booleanWhether to trigger the alternative Manifest callback when an error occurs while downloading segments with MimeTypeMimeTypes.BASE_TYPE_APPLICATION.static booleanIf true (default), allows the player to fallback to unsecure decoders if it failed to initialize the primary decoder.static booleanEnable video codec sync interactions with queueing.static booleanIf true (default), allows the player to fallback to other decoders if it failed to initialize the primary decoder.static booleanGlobal 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 final PlayerSDK.ExperimentalFlagsSet of feature which are catalogued as Experimental.static intBy default, the player queries the currently selected video codec if it supports fast adaptive bitrate switching (SdkConsts.FAST_BITRATE_SWITCHING_AUTO).static booleanThe default value is true.static booleanBy default the player pre-fetches the license as soon as tracks are selected and segments are ready to be downloaded.static booleanIf 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 booleanGlobal parameter whether to prefer DRM init data in segments over the manifest's data (DASH-only).static booleanSets the behaviour whenFORCE_HDCP_EXCEPTIONisfalse, otherwise the option is ignored.static booleanBy default the player creates two DRM sessions, one for Audio, and one for Video.static booleanDisable the usage of the secure decoder pipeline.static booleanBy default the player will deduce the maximum input size that is used to configure the video codec viaMediaFormatand theMediaFormat.KEY_MAX_INPUT_SIZEkey.static booleanDeprecated.useDrmConfiguration.forceWidevineL3instead, orDrmTodayConfiguration.Builder.forceWidevineL3(boolean)if using DrmTodayConfiguration.static longThis is the time in milliseconds to wait for DRM key to change its status fromKeyStatus.OutputNotAllowedtoKeyStatus.Usablebefore throwing an exception.static longThis is the time in milliseconds to delay the HDMI connection event.static HttpDataSourceBuilderThe HTTP data source factory that is used to create http data sources.static LicenseLoaderThe license loaderstatic booleanGlobal parameter to enable or disable the video merging option, default istruestatic booleanDefault global value to enable or disable automatic playback pausing when HDMI is disconnected.static intThe default setting for HD content filter.static longInterval in ms used to post playback position updates Default is1000Lstatic longTimeout in milliseconds to release the underlying Player.static floatThe preference of the codec implementation weight100.0f, compare toPREFERENCE_CODEC_MIME,PREFERENCE_TRACK_TYPEandPREFERENCE_PIXEL_COUNT.static floatThe preference of the codec mimes weight20.0f, compare toPREFERENCE_CODEC_IMPL,PREFERENCE_TRACK_TYPEandPREFERENCE_PIXEL_COUNT.static floatThe preference of the pixel count weight10.0f, compare toPREFERENCE_CODEC_MIME,PREFERENCE_CODEC_IMPLandPREFERENCE_TRACK_TYPE.static floatThe preference of the track type weight40.0f, compare toPREFERENCE_CODEC_MIME,PREFERENCE_CODEC_IMPLandPREFERENCE_PIXEL_COUNT.static booleanEnable this options if you have to play DASH Manifests that are not spec conform and define AdaptationSets' before BaseURLs'.static booleanDefault global value to enable or disable automatic restoring of a speed after playing ads.static intUse this flag to configure handling of secondary displays.static booleanDisable Secure SurfaceViewstatic intPlayer mode parameter that is applied to seeking.static longTimeout in milliseconds to set the player Surface.static KeyStoreThe SSL key store used to verify certificates only in case the system default key store fails to verify them.static SubtitlesPreviewBuilderStatic 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 TrackTypeProviderThe track type provider that will be used to define track group and tracks types and their weights.static com.google.android.exoplayer2.mediacodec.MediaCodecAdapter.FactoryFactory for creatingMediaCodecAdapterinstances for video playback.static intVideo codec buffer mode.static intThe default global video codec filter used to configure the video codec filtering.static VideoFilterConfigurationThe default globalVideoFilterConfigurationto use in order to filter video qualities.static PointDeprecated.UseVIDEO_FILTERinstead. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddLegacyDeviceScreenResolution(String manufacturer, String model) Add a device for which its screen dimensions will be read using the legacy approach.static ContextAccess the globally configured application context used by the SDK.static List<Downloadable> Returns the list of currently registered downloadable plugins.static Collection<DrmLicenseManagerComponent> Returns the list of currently registered DrmLicenseManagerComponents.static List<PlayerControllerPlugin> Returns the list of currently registered player-view plugins.static List<PlayerPlugin> Returns the list of currently registered player plugins.static List<PlayerViewPlugin> Returns the list of currently registered player-view plugins.static <T extends Plugin>
TReturns the instance of the registered plugin or null if no plugin was foundstatic Collection<Plugin> Returns the list of currently registered plugins.static List<TrackRendererPlugin> Returns the list of currently registered track renderer plugins.static StringExposes the SDK versionstatic voidInitializes the SDK using the given context and the defaultManifestLicenseLoaderto find a meta-data entry with the keycastlabs-licensein your Applications Manifest.static voidinit(Context ctx, LicenseLoader licenseLoader) Initializes the SDK using the given context andLicenseLoaderto find and load a license file.static voidInitializes the SDK using the given context and the license specified here.static booleanisPluginRegistered(Drm drm) INTERNAL! This is an internal method and you will not need to call this method explicitly.static voidregister(Downloadable plugin) Register a newDownloadableplugin that can be used to download content for offline playback.static voidRegister external Drm plugin to the sdk.static voidregister(PlayerControllerPlugin plugin) Register a newPlayerControllerPluginstatic voidregister(PlayerPlugin plugin) Register a new player pluginstatic voidregister(PlayerViewPlugin plugin) Register a newPlayerViewPluginstatic voidregister(TrackRendererPlugin plugin) Register a new track renderer pluginstatic voidRegister a new pluginstatic voidRegister a new DrmLicenseManagerComponentstatic voidsetSdkLogLevel(int sdkLogLevel) Sets the log level for the SDKstatic voidINTERNAL 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.forceWidevineL3instead, 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_SWITCHINGtoSdkConsts.FAST_BITRATE_SWITCHING_DISABLEDin 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_DISPLAYwhich 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_SECUREandDisplay.FLAG_SUPPORTS_PROTECTED_BUFFERSare 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_NONEorSdkConsts.VIDEO_CODEC_FILTER_CAPSThe default one isSdkConsts.VIDEO_CODEC_FILTER_CAPS. It is overwritten for single playback session by the value of the keySdkConsts.INTENT_VIDEO_CODEC_FILTERwhen 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. -
SEEK_MODE
public static int SEEK_MODEPlayer mode parameter that is applied to seeking. Seeking to sync points is typically faster but less accurate than exact seeking. One ofSdkConsts.SEEK_EXACT,SdkConsts.SEEK_PREVIOUS_SYNC,SdkConsts.SEEK_NEXT_SYNCorSdkConsts.SEEK_CLOSEST_SYNC. Default isSdkConsts.SEEK_EXACT -
VIDEO_CODEC_BUFFER_MODE
public static int VIDEO_CODEC_BUFFER_MODEVideo codec buffer mode.- See Also:
-
AUDIO_CODEC_BUFFER_MODE
public static int AUDIO_CODEC_BUFFER_MODEAudio codec buffer mode.- See Also:
-
ENABLE_VIDEO_CODEC_SYNC_INTERACTIONS_WITH_QUEUEING
public static boolean ENABLE_VIDEO_CODEC_SYNC_INTERACTIONS_WITH_QUEUEINGEnable video codec sync interactions with queueing. -
ENABLE_AUDIO_CODEC_SYNC_INTERACTIONS_WITH_QUEUEING
public static boolean ENABLE_AUDIO_CODEC_SYNC_INTERACTIONS_WITH_QUEUEINGEnable 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_DISCONNECTEDorPlayerConfig.pauseOnHdmiDisconnectedOnly 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_UPorPlayerConfig.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_SPEEDorPlayerConfig.restoreSpeed -
VIDEO_SIZE_FILTER
Deprecated.UseVIDEO_FILTERinstead.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_FILTERwhen the latter is set. Note When setting the value to other thanSdkConsts.VIDEO_SIZE_FILTER_AUTOit is strongly recommended to set theVIDEO_CODEC_FILTERtoSdkConsts.VIDEO_CODEC_FILTER_CAPSotherwise the video streams with high resolutions will be forced to play on devices that may not have support for it. -
VIDEO_FILTER
The default globalVideoFilterConfigurationto use in order to filter video qualities. Applied to both ads and content tracks. Can be an instance ofVideoFilterConfiguration, or one ofSdkConsts.VIDEO_FILTER_AUTOorSdkConsts.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_FILTERwhen the latter is set. Note When setting the value to other thanSdkConsts.VIDEO_FILTER_AUTOit is strongly recommended to set theVIDEO_CODEC_FILTERtoSdkConsts.VIDEO_CODEC_FILTER_CAPSotherwise 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 totrueand text language specified bySdkConsts.INTENT_PREFERRED_TEXT_LANGUAGEdoes 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 -
ENABLE_INVALIDATE_SELECTION_ON_RENDERER_CAPS_CHANGED
public static boolean ENABLE_INVALIDATE_SELECTION_ON_RENDERER_CAPS_CHANGEDWhether to allow to invalidate selections on renderer capabilities change. The default value istrue. Currently is only applicable to audio renderers -
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_DATAorPlayerConfig.forceInStreamDrmInitDataThe 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, theSharedPreferencesKeyStorewill 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 tonullwhen 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_STOREwith 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, theDefaultTrackTypeProviderwill 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.Factoryused during CDN fallback e.g. DASH multi BaseUrl handling -
EXPERIMENTAL
Set of feature which are catalogued as Experimental. As such they are not production-ready and shall only be used for development purposes. -
PREFERENCE_CODEC_IMPL
public static float PREFERENCE_CODEC_IMPLThe preference of the codec implementation weight100.0f, compare toPREFERENCE_CODEC_MIME,PREFERENCE_TRACK_TYPEandPREFERENCE_PIXEL_COUNT. Used to define the priority of the codec implementationsCODEC_WEIGHT_IMPL_HWorCODEC_WEIGHT_IMPL_SWover other weights -
PREFERENCE_TRACK_TYPE
public static float PREFERENCE_TRACK_TYPEThe preference of the track type weight40.0f, compare toPREFERENCE_CODEC_MIME,PREFERENCE_CODEC_IMPLandPREFERENCE_PIXEL_COUNT. Used to define the priority of the track types seeTrackTypeProviderover other weights -
PREFERENCE_CODEC_MIME
public static float PREFERENCE_CODEC_MIMEThe preference of the codec mimes weight20.0f, compare toPREFERENCE_CODEC_IMPL,PREFERENCE_TRACK_TYPEandPREFERENCE_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_SWorCODEC_WEIGHT_MIME_OTHERover other weights -
PREFERENCE_PIXEL_COUNT
public static float PREFERENCE_PIXEL_COUNTThe preference of the pixel count weight10.0f, compare toPREFERENCE_CODEC_MIME,PREFERENCE_CODEC_IMPLandPREFERENCE_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.0fused for the default track selection. -
CODEC_WEIGHT_IMPL_SW
public static float CODEC_WEIGHT_IMPL_SWThe codec normalized weight for software implementation0.5fused for the default track selection. -
CODEC_WEIGHT_MIME_H265_HW
public static float CODEC_WEIGHT_MIME_H265_HWThe hardware codec H265 (HEVC) normalized weight1.0fused 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.3fused 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.5fused 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.4fused for the default video track selection. -
CODEC_WEIGHT_MIME_OTHER
public static float CODEC_WEIGHT_MIME_OTHERThe normalized weight0.2fof the codec other thanCODEC_WEIGHT_MIME_H265_HW,CODEC_WEIGHT_MIME_H265_SW,CODEC_WEIGHT_MIME_H264_HWandCODEC_WEIGHT_MIME_H264_SWnormalized weight0.5fused 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-1to disable all automated crash reports. By default errors with severityCastlabsPlayerException.SEVERITY_INFOor 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_ENABLEDorSdkConsts.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.preferTrickPlayTracksinsteadBy 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 totrueto 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 totruewill 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_CHECKSis enabled- See Also:
-
PLAYBACK_POSITION_PERIOD_MS
public static long PLAYBACK_POSITION_PERIOD_MSInterval in ms used to post playback position updates Default is1000L -
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_ENABLEDorSdkConsts.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.Another use-case to enable pre-scan option is when DASH-IF:Laurls are not defined in all the ContentProtection elements and the URL entries can be re-used from where defined with DRM types and KeyIds (PSSH data) on those elements being equal.
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! -
VIDEO_CODEC_ADAPTER_FACTORY
@Nullable public static com.google.android.exoplayer2.mediacodec.MediaCodecAdapter.Factory VIDEO_CODEC_ADAPTER_FACTORYFactory for creatingMediaCodecAdapterinstances for video playback. When set tonullthen the defaultDefaultVideoCodecAdapterFactoryis usedReplace with a custom factory for advanced use cases like custom codec selection or behavior.
-
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 withPlayerControllerand 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. -
DEFAULT_DRM_CONFIGURATION
Default DRM configuration to be used when no DRM configuration is contained inPlayerConfig. By default this configuration is not defined and equals tonull. The common use-case to define it is when DASH manifest contains DRM urls e.g. DASH-IF:Laurl elements: DEFAULT_DRM_CONFIGURATION = DrmConfiguration.DEFAULT or any other constructed configuration.Note that when DRM configuration is defined here, then the player expects encrypted content and the clear content will be played out using secure decoders where possible.
-
DEFAULT_DRM_PREFER_MANIFEST_URL
public static boolean DEFAULT_DRM_PREFER_MANIFEST_URLIf true, then any non-empty DRM URL found in the manifest will be used instead ofDrmConfiguration.urlDefault is false -
ENABLE_DRM_FALLBACK
public static boolean ENABLE_DRM_FALLBACKWhen multipleDrmsystems 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 withDrmTodayConfigurationonly and whenDrmConfiguration.drmis 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 viaMediaFormatand theMediaFormat.KEY_MAX_INPUT_SIZEkey. 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_EXCEPTIONisfalse, otherwise the option is ignored. If set totruethen 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.OutputNotAllowedtoKeyStatus.Usablebefore 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_MStimeout. 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. -
FATAL_ERROR_ON_SECONDARY_DISPLAY_NOT_ALLOWED
public static boolean FATAL_ERROR_ON_SECONDARY_DISPLAY_NOT_ALLOWEDThe default value is true. If set to false, then no fatal error is raised when trying to connect to the secondary display while not permitted. -
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. -
DROPPED_VIDEO_FRAME_COUNT_TO_NOTIFY
public static int DROPPED_VIDEO_FRAME_COUNT_TO_NOTIFYThe maximum number of frames that can be dropped between invocations ofVideoRendererListener.onDroppedFrames(int, long)Set to-1to disable. Default is50 -
DROPPED_VIDEO_FRAME_DISABLE_DURATION_MS
public static long DROPPED_VIDEO_FRAME_DISABLE_DURATION_MSSet toLong.MAX_VALUEto permanently disable the video quality -
DROPPED_VIDEO_FRAME_THRESHOLD_COUNT
public static int DROPPED_VIDEO_FRAME_THRESHOLD_COUNTThe number of dropped frames withinDROPPED_VIDEO_FRAME_THRESHOLD_DURATION_MSto trigger video quality blacklisting. Blacklisting time is configured withDROPPED_VIDEO_FRAME_DISABLE_DURATION_MSSet to-1to disable blacklisting (default) -
DROPPED_VIDEO_FRAME_THRESHOLD_DURATION_MS
public static long DROPPED_VIDEO_FRAME_THRESHOLD_DURATION_MSThe duration to keep frame dropped events -
COMPANION_SDK_NAME
Should be set to the companion sdk name if used. -
COMPANION_SDK_VERSION
Should be set to the companion sdk version if used. -
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 defaultManifestLicenseLoaderto find a meta-data entry with the keycastlabs-licensein 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 andLicenseLoaderto 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 a newDownloadableplugin that can be used to download content for offline playback.- Parameters:
plugin- The plugin
-
register
Register external Drm plugin to the sdk.- Parameters:
drm- drm to be registered
-
register
Register a new plugin- Parameters:
plugin- the plugin
-
setSdkLogLevel
public static void setSdkLogLevel(int sdkLogLevel) Sets the log level for the SDK- Parameters:
sdkLogLevel- Must be one of the followingLog.VERBOSELog.DEBUGLog.INFOLog.WARNLog.ERRORLog.ASSERT
-
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 the list of currently registered track renderer plugins.- Returns:
- plugins the list of currently registered track renderer plugins
-
getPlayerPlugins
Returns the list of currently registered player plugins.- Returns:
- plugins the list of currently registered player plugins
-
getPlugins
Returns the list of currently registered plugins.- Returns:
- plugins the list of currently registered plugins
-
getDrmLicenseManagerComponents
Returns the list of currently registered DrmLicenseManagerComponents.- Returns:
- the list of currently registered DrmLicenseManagerComponents
-
getDownloadablePlugins
Returns the list of currently registered downloadable plugins.- Returns:
- plugins The list of currently registered downloadable plugins
-
getPlayerViewPlugins
Returns the list of currently registered player-view plugins.- Returns:
- plugins The list of currently registered player-view plugins
-
getPlayerControllerPlugins
Returns the list of currently registered player-view plugins.- 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.MANUFACTURERmodel- manufacturer of the device, as found inBuild.MODEL
-
TrickplayConfiguration.preferTrickPlayTracksinstead