Class VideoAdUnit

This class provides shared logic among all the ad units.

Hierarchy

Constructors

Properties

error?: AdUnitError

If an error occurs it will contain the reference to the error otherwise it will be bull

errorCode?: number

If an error occurs it will contain the Vast Error code of the error

type?: string

Ad unit type

Methods

  • Returns the current time of the ad Creative or 0 if there is no creative.

    Returns void

    the current time of the ad unit.

  • Returns the duration of the ad Creative or 0 if there is no creative.

    Returns void

    the duration of the ad unit.

  • Synchronously calls each of the listeners registered for the event named eventName, in the order they were registered, passing the supplied arguments to each.

    Parameters

    • eventName: string

      The name of the event.

    • Rest ...args: any[]

    Returns boolean

    Returns true if the event had listeners, false otherwise.

  • Gets the volume of the ad unit.

    Returns void

    the volume of the ad unit.

    Throws

    if ad unit is not started.

    Throws

    if ad unit is finished.

  • Returns boolean

    true if the ad unit is finished and false otherwise

  • Returns boolean

    true if the ad unit has started and false otherwise

  • Register a callback function that will be called if there is an error while running the ad.

    Parameters

    • callback: Listener

      will be called on ad unit error passing the Error instance and an object with the adUnit and the VastChain.

    Returns void

    Throws

    if ad unit is finished.

  • Register a callback function that will be called whenever the ad finishes. No matter if it was finished because de ad ended, or cancelled or there was an error playing the ad.

    Parameters

    • callback: Listener

      will be called once the ad unit finished

    Returns void

    Throws

    if ad unit is finished.

  • Adds a one time listener function for the event named eventName. The next time eventName is triggered, this listener is removed and then invoked.

    Parameters

    • eventName: string

      The name of the event.

    • listener: Listener

      Listener fn that handles the evt.

    Returns VideoAdUnit

    The Emitter instance.

  • Pauses the ad unit.

    Returns void

    Throws

    if ad unit is not started.

    Throws

    if ad unit is finished.

  • This method resizes the ad unit to fit the available space in the passed VideoAdContainer

    Parameters

    • width: number
    • height: number
    • mode: string

    Returns Promise<void>

    Promise that resolves once the unit was resized

    Throws

    if ad unit is not started.

    Throws

    if ad unit is finished.

  • Resumes a previously paused ad unit.

    Returns void

    Throws

    if ad unit is not started.

    Throws

    if ad unit is finished.

  • Sets the volume of the ad unit.

    Parameters

    • _volume: number

    Returns void

    Throws

    if ad unit is not started.

    Throws

    if ad unit is finished.

  • Skips the ad unit.

    Returns void

    Throws

    if ad unit is not started.

    Throws

    if ad unit is finished.

Generated using TypeDoc