com.brightcove.ssai.ui

## Class CompanionAdHandler

- java.lang.Object
- - com.brightcove.player.event.AbstractComponent
  - - com.brightcove.ssai.ui.CompanionAdHandler

- All Implemented Interfaces:
    Component

      @Emits(events="renderedCompanion")
       @ListensFor(events={"startCompanion","endCompanion","skipAd"})
      public class CompanionAdHandler
      extends AbstractComponent

  Handles the displaying of the Companion Ad.

- - ### Field Summary

    - ### Fields inherited from class com.brightcove.player.event.AbstractComponent

      `eventEmitter, listenerTokens`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CompanionAdHandler(android.content.Context context, EventEmitter eventEmitter)` Build a manager given the Android context, the Brightcove video view and the event emitter.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addCompanionContainer(android.view.ViewGroup container)` Add a container for showing companion ads.
    `void` | `clearCompanionContainers()` Clear all the companion containers.

    - ### Methods inherited from class com.brightcove.player.event.AbstractComponent

      `addListener, addOnceListener, getEventEmitter, removeListener, removeListeners`

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

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

- - ### Constructor Detail

    - #### CompanionAdHandler

          public CompanionAdHandler(@NonNull
                                    android.content.Context context,
                                    @NonNull
                                    EventEmitter eventEmitter)

      Build a manager given the Android context, the Brightcove video view and the event emitter.
      Parameters:
        `context` - The given Android context.
        `eventEmitter` - The given Brightcove video view.

  - ### Method Detail

    - #### addCompanionContainer

          public void addCompanionContainer(android.view.ViewGroup container)

      Add a container for showing companion ads. A phone or small tablet might have none or one. Larger devices may have multiple containers for showing companion ads. Note: At the moment only one Companion Ad is supported, calling addCompanionContainer will replace previous container.
      Parameters:
        `container` - The given container to add.

    - #### clearCompanionContainers

          public void clearCompanionContainers()

      Clear all the companion containers.