Class VastAdUnit

This class provides everything necessary to run a Vast ad.

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 = 'VAST'

Ad unit type. Will be VAST for VastAdUnit

Methods

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

    the volume of the ad unit.

    Throws

    if ad unit is not started.

    Throws

    if ad unit is finished.

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

    The Emitter instance.

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

    Parameters

    • width: number

      the new width of the ad container.

    • height: number

      the new height of the ad container.

    • viewmode: string

      fullscreen | normal | thumbnail

    Returns Promise<void>

    Promise that resolves once the unit was resized

  • Sets the volume of the ad unit.

    Parameters

    • volume: number

      must be a value between 0 and 1;

    Returns void

    Throws

    if ad unit is not started.

    Throws

    if ad unit is finished.

  • Starts the ad unit.

    Returns Promise<void>

    Throws

    if called twice.

    Throws

    if ad unit is finished.

Generated using TypeDoc