Class 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
    • Constructor Detail

      • BroadpeakPlugin

        public BroadpeakPlugin​(@Nullable
                               String analyticsUrl,
                               @Nullable
                               String nanoCDNHost,
                               @Nullable
                               String broadpeakDomainNames)
        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 Detail

      • 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.
      • 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