Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Ads

Ads Media.

description

This class implements Google IMA SDK v3.0 to display VAST and VPAID advertisements

see

https://developers.google.com/interactive-media-ads/

class

Ads

Hierarchy

  • Ads

Index

Constructors

constructor

  • new Ads(media: Media, adsUrl: string, autoStart?: boolean): Ads
  • Create an instance of Ads.

    memberof

    Ads

    Parameters

    • media: Media
    • adsUrl: string
    • Optional autoStart: boolean

    Returns Ads

Properties

Private adDisplayContainer

adDisplayContainer: any

Container to display Ads.

see

https://tinyurl.com/ya3zksso

type

google.ima.adDisplayContainer

memberof

Ads

adsActive

adsActive: boolean = false

Flag to indicate that current Ad is being played.

type

boolean

memberof

Ads

Private adsContainer

adsContainer: HTMLDivElement

Element in which Ads will be created.

type

HTMLDivElement

memberof

Ads

adsCurrentTime

adsCurrentTime: number = 0

Store the current Ad's current time position to be passed in the timeupdate event.

type

number

memberof

Ads

adsDone

adsDone: boolean = false

Flag to indicate that individual Ad has been played.

type

boolean

memberof

Ads

adsDuration

adsDuration: number = 0

Store the current Ad's duration.

type

number

memberof

Ads

adsEnded

adsEnded: boolean = false

Flag to indicate when player has finished playing all Ads.

Type of Ads could be: pre-roll, mid-roll, post-roll or combination of them.

type

boolean

memberof

Ads

Private adsLoader

adsLoader: any

Object which allows to request ads from ad servers or a dynamic ad insertion stream.

see

https://tinyurl.com/ycwp4ufd

type

google.ima.AdsLoader

memberof

Ads

adsManager

adsManager: any = null

Object which handles playing ads after they've been received from the server.

see

https://tinyurl.com/ybjas4ut

type

google.ima.AdsManager

memberof

Ads

adsMuted

adsMuted: boolean = false

Flag to indicate if Ad is currently muted or not.

type

boolean

memberof

Ads

Private adsRequest

adsRequest: any

Object containing the data used to request ads from the server.

see

https://tinyurl.com/ya8bxjf4

type

google.ima.adsRequest

memberof

Ads

adsStarted

adsStarted: boolean = false

Flag to indicate that Ads are ready to being played.

type

boolean

memberof

Ads

Private adsUrl

adsUrl: string

The VAST/VPAID URL to play Ads.

type

string

memberof

Ads

adsVolume

adsVolume: number

Store the current Ad's volume level.

type

number

memberof

Ads

Private autoStart

autoStart: boolean = false

Flag to indicate if Ad should be played automatically

type

boolean

memberof

Ads

Private autoplayAllowed

autoplayAllowed: boolean = false

Flag to indicate if Ad can be played via autoplay attribute.

type

boolean

memberof

Ads

Private autoplayRequiresMuted

autoplayRequiresMuted: boolean = false

Flag to indicate if Ad can autoplayed while muted.

type

boolean

memberof

Ads

Private element

element: HTMLMediaElement

Native video/audio tag to execute native events.

type

HTMLMediaElement

memberof

Ads

Private events

events: string[]

List of IMA SDK events to be executed.

type

string[]

memberof

Ads

intervalTimer

intervalTimer: number = 0

Element to present changes in current time while Ad is being played.

type

number

memberof

Ads

Private media

media: Media

Instance of Media object to execute actions once Ad has ended/skipped.

type

Media

memberof

Ads

Private promise

promise: Promise<any>

Promise to start all IMA SDK elements, once the library has been loaded.

type

Promise

memberof

Ads

Accessors

currentTime

  • get currentTime(): number
  • set currentTime(value: number): void
  • Retrieve the current Ad's current time position.

    memberof

    Ads

    Returns number

  • Set the current Ad's current time position.

    memberof

    Ads

    Parameters

    • value: number

    Returns void

duration

  • get duration(): number
  • Retrieve the current Ad's duration.

    memberof

    Ads

    Returns number

ended

  • get ended(): boolean
  • Retrieve the current Ad's ended status.

    memberof

    Ads

    Returns boolean

muted

  • get muted(): boolean
  • set muted(value: boolean): void
  • Retrieve the current Ad's muted status.

    memberof

    Ads

    Returns boolean

  • Set the current Ad's muted status.

    memberof

    Ads

    Parameters

    • value: boolean

    Returns void

paused

  • get paused(): boolean
  • Retrieve the current Ad's paused status.

    memberof

    Ads

    Returns boolean

volume

  • get volume(): number
  • set volume(value: number): void
  • Retrieve current Ad's volume level.

    memberof

    Ads

    Returns number

  • Set the current Ad's volume level.

    memberof

    Ads

    Parameters

    • value: number

    Returns void

Methods

Private _assign

  • _assign(event: any): void
  • Dispatch IMA SDK's events via OpenPlayer.

    memberof

    Ads

    Parameters

    • event: any

    Returns void

Private _contentEndedListener

  • _contentEndedListener(): void
  • Callback to be executed once the Ad has ended.

    memberof

    Ads

    Returns void

Private _error

  • _error(event: any): void
  • Dispatch an IMA SDK error that will destroy the Ads instance and resume original media.

    memberof

    Ads

    Parameters

    • event: any

    Returns void

Private _loaded

  • _loaded(adsManagerLoadedEvent: any): void
  • Callback to be executed once IMA SDK manager is loaded.

    memberof

    Ads

    Parameters

    • adsManagerLoadedEvent: any

    Returns void

Private _onContentPauseRequested

  • _onContentPauseRequested(): void
  • Callback to be executed once the Ad has been paused.

    memberof

    Ads

    Returns void

Private _onContentResumeRequested

  • _onContentResumeRequested(): void
  • Callback to be executed once the Ad has been resumed.

    memberof

    Ads

    Returns void

Private _playAds

  • _playAds(): void
  • Internal callback to start playing Ads or resume media if error is detected.

    memberof

    Ads

    Returns void

Private _requestAds

  • _requestAds(): void
  • Setup final attributes to the Ad before playing it, which include initial dimensions and capabilities to autoplay Ad or not.

    memberof

    Ads

    Returns void

Private _resumeMedia

  • _resumeMedia(): void
  • Callback to resume original media.

    This can happen when Ad is being skipped or has ended.

    memberof

    Ads

    Returns void

Private _setup

  • _setup(): void
  • Prepare container and request loader so Ads can be played.

    memberof

    Ads

    Returns void

Private _start

  • _start(manager: any): void
  • Callback to be executed to start playing Ad.

    memberof

    Ads

    Parameters

    • manager: any

    Returns void

destroy

  • destroy(): void
  • Execute any callbacks to destroy Ads.

    memberof

    Ads

    Returns void

load

  • load(): void
  • Create the Ads container and loader to process the Ads URL provided.

    memberof

    Ads

    Returns void

pause

  • pause(): void
  • Pause Ad if adsManager is active.

    memberof

    Ads

    Returns void

play

  • play(): void
  • Start playing/resume Ad if adsManager is active.

    memberof

    Ads

    Returns void

resizeAds

  • resizeAds(width?: number, height?: number, transform?: string): void
  • Change dimensions of Ad.

    memberof

    Ads

    Parameters

    • Optional width: number

      The new width of the Ad's container.

    • Optional height: number

      The new height of the Ad's container.

    • Optional transform: string

      CSS transform property to align Ad if fill mode is enabled.

    Returns void

Generated using TypeDoc