AdStore

Methods

Methods

Name

Type (Returned)

Description

createPlaybackController
(videoSlot:
HTMLVideoElement,
slot: HTMLElement,
playbackParameters:
PlaybackParameters

AdPlaybackController

Creates a controller for one-time ad playback. As a result, an object is returned using which you can control the way ads are played. Method parameters:

  • videoSlot: HTMLVideoElement — A video element that shows video content. Required parameter.
  • slot: HTMLElement — An element that shows ad controls. Required parameter.
  • playbackParameters: PlaybackParameters — Ad playback parameters. Optional parameter.

destroy ()

void

Destroys a class instance. If you call this method for AdStore, playback is stopped. Controllers that were created with the .createPlaybackController(...) method continue playing regardless of whether AdStore is destroyed.

getNonYandexVastXmlTree

type VastTree = {xmlString: string; children: VastTree[]}

Retrieves information about the requested VAST or VAST chain.

Warning

The method doesn't work with ads from the YAN.

preload (preloadParams:
PreloadParams)

Promise<void>

Preloads AdStore data to speed up running ad creatives.

showAd (videoSlot:
HTMLVideoElement,
slot: HTMLElement)

Promise<void>

Shows ads. Method parameters:

  • videoSlot: HTMLVideoElement — A video element that shows video content. Required parameter.
  • slot: HTMLElement — An element that shows ad controls. Required parameter.