Package com.castlabs.sdk.broadpeak

# Class BroadpeakPlugin

java.lang.Object
com.castlabs.android.Plugin
com.castlabs.sdk.broadpeak.BroadpeakPlugin

public class BroadpeakPlugin extends Plugin
This plugin integrates Broadpeak Analytics with the castLabs Player SDK. You can enable and register the plugin before you initialize the SDK:

      private static final String ANALYTICS_URL = "http://48.15.16.23";

      public class MyApp extends Application {
         @Override
          public void onCreate() {
              super.onCreate();

              BroadpeakPlugin broadpeak = new BroadpeakPlugin(ANALYTICS_URL, NANO_CDN_HOST, DOMAIN_NAMES);

              PlayerSDK.register(broadpeak);
              PlayerSDK.init(getApplicationContext());
          }
     }

Since:
  4.1.8

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static int`
  `SESSION_START_RETRIES`
  Number of retries to start a session.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BroadpeakPlugin(String analyticsUrl, String nanoCDNHost, String broadpeakDomainNames)`
  Creates a new instance of `BroadpeakPlugin`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static AnalyticsMetaData`
  `createMetadata(boolean live, String assetId, Bundle customParameters, SparseArray<Object> options)`
  Create analytics metadata based on provided data
  `static AnalyticsMetaData`
  `createMetadata(AnalyticsMetaData analyticsMetaData, Bundle customParameters, SparseArray<Object> options)`
  Update provided analytics metadata with extra Broadpeak metadata
  `String`
  `getId()`
  `void`
  `init(Context context)`
  `void`
  `setEnabled(boolean enabled)`
  Enables or disables the BroadpeakPlugin.

  ### Methods inherited from class com.castlabs.android.Plugin

  `onRemotePlay`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### SESSION_START_RETRIES

    public static int SESSION_START_RETRIES
    Number of retries to start a session. Default is 3.

- ## Constructor Details

  - ### BroadpeakPlugin

    public BroadpeakPlugin(@Nullable String analyticsUrl, @Nullable String nanoCDNHost, @Nullable String broadpeakDomainNames)
    Creates a new instance of `BroadpeakPlugin`.
    Parameters:
      `analyticsUrl` - Host where to send analytics. Can be null if the analytics service is not to be used.
      `nanoCDNHost` - Broadpeak's Nano CDN Host. Can be null.
      `broadpeakDomainNames` - Broadpeak Domain Names. If null, the default ("*") will be used.

- ## Method Details

  - ### setEnabled

    public void setEnabled(boolean enabled)
    Enables or disables the BroadpeakPlugin. Note that this has to be set to the desired value *before* the `PlayerController` creation. Default is true.
    Parameters:
      `enabled` - whether to enable the plugin or not.

  - ### init

    public void init(Context context)
    Overrides:
      `init` in class `Plugin`

  - ### createMetadata

    @NonNull public static AnalyticsMetaData createMetadata(boolean live, @NonNull String assetId, @Nullable Bundle customParameters, @Nullable SparseArray<Object> options)
    Create analytics metadata based on provided data
    Parameters:
      `live` - true if the current content is a live stream and false otherwise
      `assetId` - The asset ID uniquely identifies the content
      `customParameters` - Custom Broadpeak parameters, which will be added to the `StreamingSession`. The params must be String values. Can be null.
      `options` - Custom Broadpeak options, which will be added to the `StreamingSession`. Keys for these options are declared in `StreamingSessionOptions`. Values must be boolean, int or String. Can be null.
    Returns:
      Created analytics metadata

  - ### createMetadata

    @NonNull public static AnalyticsMetaData createMetadata(@NonNull AnalyticsMetaData analyticsMetaData, @Nullable Bundle customParameters, @Nullable SparseArray<Object> options)
    Update provided analytics metadata with extra Broadpeak metadata
    Parameters:
      `analyticsMetaData` - Existing AnalyticsMetadata where to add Broadpeak metadata
      `customParameters` - Custom Broadpeak parameters, which will be added to the `StreamingSession`. The params must be String values. Can be null.
      `options` - Custom Broadpeak options, which will be added to the `StreamingSession`. Keys for these options are declared in `StreamingSessionOptions`. Values must be boolean, int or String. Can be null.
    Returns:
      Updated analytics metadata

  - ### getId

    @NonNull public String getId()
    Specified by:
      `getId` in class `Plugin`