Package com.castlabs.sdk.youbora
Class YouboraPlugin
java.lang.Object
com.castlabs.android.Plugin
com.castlabs.sdk.youbora.YouboraPlugin
This plugin integrates Youbora Analytics with the Castlabs Player SDK.
Labels reported for disabled subtitle/audio tracks can be customized via
PlayerSDK.ANALYTICS_SETTINGS.
public class MyApp extends Application {
@Override
public void onCreate() {
super.onCreate();
YouboraPlugin youbora = new YouboraPlugin(...);
PlayerSDK.register(youbora);
PlayerSDK.init(getApplicationContext());
}
}
- Since:
- 3.1.5
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic booleanWhether to send offline analytics or not. -
Constructor Summary
ConstructorsConstructorDescriptionYouboraPlugin(com.npaw.NpawPlugin npawPlugin) Create a new instance of this plugin using the default configuration.YouboraPlugin(String systemId) Create a new instance of this plugin using the default configuration. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildRenditionString(int width, int height, double bitrate) Builds a string that represents the rendition.static AnalyticsMetaDatacreateMetadata(boolean live, String assetId, com.npaw.core.options.AnalyticsOptions analyticsOptions) Create anAnalyticsMetaDataobject from a YouboraAnalyticsOptionsobject.static AnalyticsMetaDatacreateMetadata(AnalyticsMetaData analyticsMetaData, com.npaw.core.options.AnalyticsOptions analyticsOptions) Update provided analytics metadata with extra valuesgetId()voidvoidreportWarnings(boolean reportWarnings) Whether to report the SDK Warnings as Youbora non-fatal errors.voidsetEnabled(boolean enabled) Whether to enable this Plugin or notvoidsetErrorMapper(YouboraErrorMapper errorMapper) Sets the mapper used to customize player error codes and messages reported to Youbora.Methods inherited from class com.castlabs.android.Plugin
onRemotePlay
-
Field Details
-
ENABLE_OFFLINE_ANALYTICS
public static boolean ENABLE_OFFLINE_ANALYTICSWhether to send offline analytics or not. If disabled, current stored offline sessions sending throughflushYouboraEvents(Context, String, NpawPlugin)will also be blocked.
-
-
Constructor Details
-
YouboraPlugin
Create a new instance of this plugin using the default configuration.- Parameters:
systemId- The Youbora system id
-
YouboraPlugin
public YouboraPlugin(@NonNull com.npaw.NpawPlugin npawPlugin) Create a new instance of this plugin using the default configuration.- Parameters:
npawPlugin- TheNpawPlugininstance to use
-
-
Method Details
-
init
-
reportWarnings
public void reportWarnings(boolean reportWarnings) Whether to report the SDK Warnings as Youbora non-fatal errors. If disabled, fatal errors will still be reported. Default: false- Parameters:
reportWarnings- Whether to report the SDK Warnings as Youbora non-fatal errors
-
setErrorMapper
Sets the mapper used to customize player error codes and messages reported to Youbora. The mapper is captured when the plugin is registered, so this method should be called before registering the plugin, normally beforePlayerSDK.init(Context).- Parameters:
errorMapper- the error mapper, ornullto use the default reporting when the plugin is registered.- Since:
- 5.0.1
-
getId
-
setEnabled
public void setEnabled(boolean enabled) Whether to enable this Plugin or not- Parameters:
enabled- enable the plugin or not
-
createMetadata
public static AnalyticsMetaData createMetadata(boolean live, @NonNull String assetId, @Nullable com.npaw.core.options.AnalyticsOptions analyticsOptions) Create anAnalyticsMetaDataobject from a YouboraAnalyticsOptionsobject.- Parameters:
live- whether the asset is a live stream or notassetId- unique asset identifieranalyticsOptions- instance of a pre-configuredAnalyticsOptionsobject.- Returns:
- instance of AnalyticsMetaData
-
createMetadata
public static AnalyticsMetaData createMetadata(@NonNull AnalyticsMetaData analyticsMetaData, @Nullable com.npaw.core.options.AnalyticsOptions analyticsOptions) Update provided analytics metadata with extra values- Parameters:
analyticsMetaData- Initial metadata to update with extra valuesanalyticsOptions- instance of a pre-configuredAnalyticsOptionsobject.- Returns:
- instance of AnalyticsMetaData
-
buildRenditionString
Builds a string that represents the rendition.The returned string will have the following format: [width]x[height]@[bitrate]. If either the width or height are < 1, only the bitrate will be returned. If bitrate is < 1, only the dimensions will be returned. If bitrate is < 1, and there are no dimensions, an empty string will be returned. The bitrate will also have one of the following suffixes depending on its magnitude: bps, Kbps, Mbps
- Parameters:
width- width of the asset.height- height of the asset.bitrate- bitrate(in the manifest) of the asset.- Returns:
- A string with the following format: [width]x[height]@[bitrate].
-