Package com.castlabs.sdk.conviva

# Class ConvivaPlugin.MetadataBuilder

java.lang.Object
com.castlabs.sdk.conviva.ConvivaPlugin.MetadataBuilder

Enclosing class:
  `ConvivaPlugin`

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

- ## 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
  `ConvivaPlugin.MetadataBuilder`
  `adTags(Bundle adTags)`
  Sets Conviva ad tags.
  `ConvivaPlugin.MetadataBuilder`
  `contentMetadata(Bundle contentMetadata)`
  Sets Conviva content metadata.
  `ConvivaPlugin.MetadataBuilder`
  `customTags(Bundle customTags)`
  Sets Conviva custom tags.
  `AnalyticsMetaData`
  `get()`
  Returns the final `AnalyticsMetaData` object.
  `ConvivaPlugin.MetadataBuilder`
  `includeAudioBitrateInAverage(boolean includeAudioBitrateInAverage)`
  Sets whether audio bitrate should be included in Conviva average bitrate metrics.
  `ConvivaPlugin.MetadataBuilder`
  `viewerId(String viewerId)`
  Sets the viewer ID.

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

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

- ## Constructor Details

  - ### 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

  - ### MetadataBuilder

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

- ## Method Details

  - ### viewerId

    @NonNull public ConvivaPlugin.MetadataBuilder viewerId(@Nullable String viewerId)
    Sets the viewer ID.
    Parameters:
      `viewerId` - An identifier for the current user, or null.
    Returns:
      this builder.

  - ### contentMetadata

    @NonNull public ConvivaPlugin.MetadataBuilder contentMetadata(@NonNull Bundle contentMetadata)
    Sets Conviva content metadata.
    Parameters:
      `contentMetadata` - A `Bundle` with Conviva content metadata.
    Returns:
      this builder.

  - ### customTags

    @NonNull public ConvivaPlugin.MetadataBuilder customTags(@Nullable Bundle customTags)
    Sets Conviva custom tags.
    Parameters:
      `customTags` - A `Bundle` with custom tags, or null to remove them.
    Returns:
      this builder.

  - ### adTags

    @NonNull public ConvivaPlugin.MetadataBuilder adTags(@Nullable Bundle adTags)
    Sets Conviva ad tags.
    Parameters:
      `adTags` - A `Bundle` with ad tags, or null to remove them.
    Returns:
      this builder.

  - ### includeAudioBitrateInAverage

    @NonNull public ConvivaPlugin.MetadataBuilder includeAudioBitrateInAverage(boolean includeAudioBitrateInAverage)
    Sets whether audio bitrate should be included in Conviva average bitrate metrics. Default is true. Set to false to report video bitrate only; audio-only streams will report average bitrate as 0.
    Parameters:
      `includeAudioBitrateInAverage` - Whether to include audio bitrate in average bitrate.
    Returns:
      this builder.

  - ### get

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