<MediaFile>s. The library has the following responsibilites:
- Requesting VAST ad tags
- Resolving VAST wrapper tags
- Choosing a
<MediaFile>based on the browser environment
- Loading/initializing a
<MediaFile>(including VPAID creatives)
- Firing VAST tracking pixels/impressions at the correct time
- Opening VAST
Adding to Project
- Install as a dependency
$ yarn add vastmanka
- Use the module
;const vastmanka = document;vastmanka;
Node: A DOM node into which the ad will be inserted. The ad will take up 100% of the width and height of the container.
- optional config:
Object: The following properties are supported
Object: Configuration for fetching VAST ad tags
<Wrapper>s should be fetched automatically. Defaults to
Number: The number of VAST
<Wrapper>s that are allowed to be fetched. Defaults to
Object: Configuration for firing tracking pixels
Functioncan be used to transform the URIs of VAST tracking pixels. The
Functionwill be invoked every time a tracking pixel is fired, with the URI of the pixel as the only argument. The returned
StringURI will be fired. Deaults to an identity
Promise: Fetches a VAST ad tag and loads one of its
<MediaFile>s into the container. The returned
Promisewill be resolved when it is safe to start playback via
- startAd() =>
Promise: Starts playback of the ad. This method may only be called once. The returned
Promisewill be fulfilled when the ad starts playing. This method cannot be called until the
- stopAd() =>
Promise: Stops playback of the ad and cleans-up its resources. Once this method has been called, the ad cannot be started again via
startAd(). The returned
Promisewill be fulfilled when the ad's resources are cleaned-up. This method cannot be called until the
- pauseAd() =>
Promise: Pauses ad playback. The returned
Promisewill be fulfilled when the ad pauses. This method cannot be called until the
- resumeAd() =>
Promise: Resumes ad playback. The returned
Promisewill be fulfilled when ad playback resumes. This method cannot be called until the
Node: The supplied container.
Object: The supplied configuration, with defaults applied.
VAST: A vastacular
VASTinstance representing the fetched ad tag.
Boolean: Indicates if the ad is ready for playback.
Number: The amount of time (in seconds) left in the linear ad. Accessing this property before the ad is loaded will throw an
Number: The total duration of the ad (in seconds.) Accessing this property before the ad is loaded will throw an
Number: Gets/sets the volume of the ad with
0being completely silent and
1being as loud as possible. Accessing (or setting) this property before the ad is loaded will throw an
- Events: All VPAID 2.0 events are supported. A subset of these events are supported for non-VPAID
<MediaFile>s as well. In addition, the following events are emitted:
- ready: Fired when
startAd()may be called and the
- error: Fired when an error occurs with ad loading/playback.
- ready: Fired when
The location of the SWF needed for Flash VPAID playback. The defaults to a location on the jsDelivr CDN. Only override this property if you want to use a version of the SWF you have uploaded yourself.