Package com.castlabs.sdk.broadpeak

# Class BroadpeakPlugin.MetadataBuilder

java.lang.Object
com.castlabs.sdk.broadpeak.BroadpeakPlugin.MetadataBuilder

Enclosing class:
  `BroadpeakPlugin`

public static final class BroadpeakPlugin.MetadataBuilder extends Object
A helper class to build `AnalyticsMetaData` objects for the Broadpeak plugin.

Since:
  4.4.0

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MetadataBuilder(boolean live, String assetId)`
  Creates a new builder.
  `MetadataBuilder(AnalyticsMetaData analyticsMetaData)`
  Creates a new builder starting from an existing `AnalyticsMetaData` object.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `BroadpeakPlugin.MetadataBuilder`
  `adParameters(Bundle adParameters)`
  Sets custom Broadpeak ad parameters which will be forwarded through `AbstractSession.setAdParameter(String, String)`.
  `BroadpeakPlugin.MetadataBuilder`
  `customParameters(Bundle customParameters)`
  Sets custom Broadpeak parameters, which will be added to the `StreamingSession`.
  `AnalyticsMetaData`
  `get()`
  Returns the final `AnalyticsMetaData` object.
  `BroadpeakPlugin.MetadataBuilder`
  `options(SparseArray<Object> options)`
  Sets custom Broadpeak options, which will be added to the `StreamingSession`.
  `BroadpeakPlugin.MetadataBuilder`
  `precache(boolean precacheEnabled)`
  Enables or disables the precache feature.

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

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

- ## Constructor Details

  - ### MetadataBuilder

    public MetadataBuilder(@NonNull AnalyticsMetaData analyticsMetaData)
    Creates a new builder starting from an existing `AnalyticsMetaData` object.
    Parameters:
      `analyticsMetaData` - The base metadata.

  - ### MetadataBuilder

    public MetadataBuilder(boolean live, @NonNull String assetId)
    Creates a new builder.
    Parameters:
      `live` - true if the current content is a live stream and false otherwise
      `assetId` - The asset ID uniquely identifies the content

- ## Method Details

  - ### customParameters

    @NonNull public BroadpeakPlugin.MetadataBuilder customParameters(@NonNull Bundle customParameters)
    Sets custom Broadpeak parameters, which will be added to the `StreamingSession`. The params must be String values.
    Parameters:
      `customParameters` - A `Bundle` with the custom parameters.
    Returns:
      this builder.

  - ### options

    @NonNull public BroadpeakPlugin.MetadataBuilder options(@NonNull SparseArray<Object> options)
    Sets 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.
    Parameters:
      `options` - A `SparseArray` with the options.
    Returns:
      this builder.

  - ### adParameters

    @NonNull public BroadpeakPlugin.MetadataBuilder adParameters(@NonNull Bundle adParameters)
    Sets custom Broadpeak ad parameters which will be forwarded through `AbstractSession.setAdParameter(String, String)`.
    Parameters:
      `adParameters` - A `Bundle` with the ad parameters.
    Returns:
      this builder.

  - ### precache

    @NonNull public BroadpeakPlugin.MetadataBuilder precache(boolean precacheEnabled)
    Enables or disables the precache feature.
    Parameters:
      `precacheEnabled` - whether to enable the precache or not.
    Returns:
      this builder.

  - ### get

    @NonNull public AnalyticsMetaData get()
    Returns the final `AnalyticsMetaData` object.
    Returns:
      The analytics metadata.