Skip to content

@videts/vide


@videts/vide / vast

vast

Interfaces

InterfaceDescription
AdCategory-
AdPluginPlugin scoped to a single ad. Created per-ad, cleaned up on ad end.
AdVerification-
ClassifiedAds-
CompanionHTMLResource-
CompanionIFrameResource-
CompanionStaticResource-
CompanionTrackingEvents-
MediaSelectionHintsHints for context-aware media selection. All fields optional.
NonLinearAd-
PlayableAdA playable ad: the VastAd plus its first linear creative.
PlaySingleAdOptions-
PodResult-
ResolveOptions-
SingleAdResult-
VastCompanionAd-
VastCompanionAds-
VastExtension-
VastNonLinearAds-
VastPluginOptions-
VastProgressEvent-
VastViewableImpression-

Type Aliases

Type AliasDescription
CompanionRenderingMode-
CompanionRequired-
CompanionResource-

Variables

VariableDescription
VAST_BREAK_SHORTENED206: Ad Break shortened. Ad was not served.
VAST_CATEGORY_BLOCKED205: InLine Category violates Wrapper BlockedAdCategories.
VAST_CATEGORY_REQUIRED204: Ad category was required but not provided.
VAST_COMPANION_ERROR600: General CompanionAds error.
VAST_COMPANION_FETCH_ERROR603: Unable to fetch CompanionAds/Companion resource.
VAST_COMPANION_REQUIRED_ERROR602: Unable to display required Companion.
VAST_COMPANION_SIZE_ERROR601: Unable to display Companion because creative dimensions do not fit within Companion display area.
VAST_COMPANION_UNSUPPORTED604: Couldn't find Companion resource with supported type.
VAST_CONDITIONAL_REJECTED408: Conditional ad rejected (deprecated along with conditionalAd).
VAST_DURATION_ERROR202: Media player expecting different duration.
VAST_INLINE_TIMEOUT304: InLine response returned ad unit that failed to result in ad display within defined time limit.
VAST_INTERACTIVE_ERROR902: General InteractiveCreativeFile error.
VAST_INTERACTIVE_NOT_EXECUTED409: Interactive unit in the InteractiveCreativeFile node was not executed.
VAST_LINEAR_ERROR400: General Linear error. Media player is unable to display the Linear Ad.
VAST_LINEARITY_ERROR201: Media player expecting different linearity.
VAST_MEDIA_DISPLAY_ERROR405: Problem displaying MediaFile. MediaFile may include unsupported codecs, different MIME type, etc.
VAST_MEDIA_NOT_FOUND401: File not found. Unable to find Linear/MediaFile from URI.
VAST_MEDIA_TIMEOUT402: Timeout of MediaFile URI.
VAST_MEDIA_UNSUPPORTED403: Couldn't find MediaFile that is supported by this media player.
VAST_MEZZANINE_DOWNLOADING407: Mezzanine is in the process of being downloaded. Ad will not be served until mezzanine is transcoded.
VAST_MEZZANINE_INVALID411: Mezzanine was provided but did not meet required specification. Ad not served.
VAST_MEZZANINE_REQUIRED406: Mezzanine was required but not provided. Ad not served.
VAST_NO_ADS303: No VAST response after one or more Wrappers.
VAST_NONLINEAR_ERROR500: General NonLinearAds error.
VAST_NONLINEAR_FETCH_ERROR502: Unable to fetch NonLinearAds/NonLinear resource.
VAST_NONLINEAR_SIZE_ERROR501: Unable to display NonLinearAd because creative dimensions do not align with creative display area.
VAST_NONLINEAR_UNSUPPORTED503: Couldn't find NonLinear resource with supported type.
VAST_SCHEMA_ERROR101: VAST schema validation error.
VAST_SIZE_ERROR203: Media player expecting different size.
VAST_TRAFFICKING_ERROR200: Trafficking error. Media player received an Ad type it was not expecting and/or cannot play.
VAST_UNDEFINED_ERROR900: Undefined Error.
VAST_VERIFICATION_NOT_EXECUTED410: Verification unit in the Verification node was not executed.
VAST_VERSION_UNSUPPORTED102: VAST version of response not supported.
VAST_VPAID_ERROR901: General VPAID error.
VAST_WRAPPER_ERROR300: General Wrapper error.
VAST_WRAPPER_LIMIT302: Wrapper limit reached, too many Wrapper responses with no InLine response.
VAST_WRAPPER_TIMEOUT301: Timeout of VAST URI provided in Wrapper element.
VAST_XML_PARSE_ERROR100: XML parsing error.

Functions

FunctionDescription
classifyAdsClassify ads from a VAST response into single, pod, or waterfall. Pure function — no side effects.
fetchVastFetch a VAST tag URL. Separated from parsing for testability.
getQuartileDetermine which quartile the current playback position represents.
parseVastParse a VAST XML string into a VastResponse object. Pure function — no side effects, no network access.
playPodPlay all ads in a pod sequentially. Individual failures or skips advance to the next ad.
playSingleAdPlay a single ad creative. Returns a Promise that resolves when the ad finishes (completed, skipped, or error), plus an abort function.
playWaterfallTry ads in waterfall order. Play the first one that loads successfully. Returns the result of the first successful ad, or null if all fail.
resolveVastResolve a VAST tag URL, following Wrapper redirects until an InLine ad is found. Merges tracking from all Wrappers in the chain into the final InLine ad.
selectMediaFileSelect the best media file using a multi-factor scoring algorithm.
trackFire-and-forget tracking. Response is ignored.
trackCompanionViewFire creativeView tracking beacons for a companion ad. Call when the companion is actually displayed to the user.
trackErrorFire error tracking URLs, replacing the [ERRORCODE] macro with the given code. Per VAST 4.2 Section 2.3.6.
trackNonLinearFire a tracking event for a NonLinear ad container. Looks up the event name in the container-level trackingEvents.
vastCreate a VAST ad plugin for vide.