@videts/vide / vast
vast
Interfaces
| Interface | Description |
|---|---|
| AdCategory | - |
| AdPlugin | Plugin scoped to a single ad. Created per-ad, cleaned up on ad end. |
| AdVerification | - |
| ClassifiedAds | - |
| CompanionHTMLResource | - |
| CompanionIFrameResource | - |
| CompanionStaticResource | - |
| CompanionTrackingEvents | - |
| MediaSelectionHints | Hints for context-aware media selection. All fields optional. |
| NonLinearAd | - |
| PlayableAd | A playable ad: the VastAd plus its first linear creative. |
| PlaySingleAdOptions | - |
| PodResult | - |
| ResolveOptions | - |
| SingleAdResult | - |
| VastCompanionAd | - |
| VastCompanionAds | - |
| VastExtension | - |
| VastNonLinearAds | - |
| VastPluginOptions | - |
| VastProgressEvent | - |
| VastViewableImpression | - |
Type Aliases
| Type Alias | Description |
|---|---|
| CompanionRenderingMode | - |
| CompanionRequired | - |
| CompanionResource | - |
Variables
| Variable | Description |
|---|---|
| VAST_BREAK_SHORTENED | 206: Ad Break shortened. Ad was not served. |
| VAST_CATEGORY_BLOCKED | 205: InLine Category violates Wrapper BlockedAdCategories. |
| VAST_CATEGORY_REQUIRED | 204: Ad category was required but not provided. |
| VAST_COMPANION_ERROR | 600: General CompanionAds error. |
| VAST_COMPANION_FETCH_ERROR | 603: Unable to fetch CompanionAds/Companion resource. |
| VAST_COMPANION_REQUIRED_ERROR | 602: Unable to display required Companion. |
| VAST_COMPANION_SIZE_ERROR | 601: Unable to display Companion because creative dimensions do not fit within Companion display area. |
| VAST_COMPANION_UNSUPPORTED | 604: Couldn't find Companion resource with supported type. |
| VAST_CONDITIONAL_REJECTED | 408: Conditional ad rejected (deprecated along with conditionalAd). |
| VAST_DURATION_ERROR | 202: Media player expecting different duration. |
| VAST_INLINE_TIMEOUT | 304: InLine response returned ad unit that failed to result in ad display within defined time limit. |
| VAST_INTERACTIVE_ERROR | 902: General InteractiveCreativeFile error. |
| VAST_INTERACTIVE_NOT_EXECUTED | 409: Interactive unit in the InteractiveCreativeFile node was not executed. |
| VAST_LINEAR_ERROR | 400: General Linear error. Media player is unable to display the Linear Ad. |
| VAST_LINEARITY_ERROR | 201: Media player expecting different linearity. |
| VAST_MEDIA_DISPLAY_ERROR | 405: Problem displaying MediaFile. MediaFile may include unsupported codecs, different MIME type, etc. |
| VAST_MEDIA_NOT_FOUND | 401: File not found. Unable to find Linear/MediaFile from URI. |
| VAST_MEDIA_TIMEOUT | 402: Timeout of MediaFile URI. |
| VAST_MEDIA_UNSUPPORTED | 403: Couldn't find MediaFile that is supported by this media player. |
| VAST_MEZZANINE_DOWNLOADING | 407: Mezzanine is in the process of being downloaded. Ad will not be served until mezzanine is transcoded. |
| VAST_MEZZANINE_INVALID | 411: Mezzanine was provided but did not meet required specification. Ad not served. |
| VAST_MEZZANINE_REQUIRED | 406: Mezzanine was required but not provided. Ad not served. |
| VAST_NO_ADS | 303: No VAST response after one or more Wrappers. |
| VAST_NONLINEAR_ERROR | 500: General NonLinearAds error. |
| VAST_NONLINEAR_FETCH_ERROR | 502: Unable to fetch NonLinearAds/NonLinear resource. |
| VAST_NONLINEAR_SIZE_ERROR | 501: Unable to display NonLinearAd because creative dimensions do not align with creative display area. |
| VAST_NONLINEAR_UNSUPPORTED | 503: Couldn't find NonLinear resource with supported type. |
| VAST_SCHEMA_ERROR | 101: VAST schema validation error. |
| VAST_SIZE_ERROR | 203: Media player expecting different size. |
| VAST_TRAFFICKING_ERROR | 200: Trafficking error. Media player received an Ad type it was not expecting and/or cannot play. |
| VAST_UNDEFINED_ERROR | 900: Undefined Error. |
| VAST_VERIFICATION_NOT_EXECUTED | 410: Verification unit in the Verification node was not executed. |
| VAST_VERSION_UNSUPPORTED | 102: VAST version of response not supported. |
| VAST_VPAID_ERROR | 901: General VPAID error. |
| VAST_WRAPPER_ERROR | 300: General Wrapper error. |
| VAST_WRAPPER_LIMIT | 302: Wrapper limit reached, too many Wrapper responses with no InLine response. |
| VAST_WRAPPER_TIMEOUT | 301: Timeout of VAST URI provided in Wrapper element. |
| VAST_XML_PARSE_ERROR | 100: XML parsing error. |
Functions
| Function | Description |
|---|---|
| classifyAds | Classify ads from a VAST response into single, pod, or waterfall. Pure function — no side effects. |
| fetchVast | Fetch a VAST tag URL. Separated from parsing for testability. |
| getQuartile | Determine which quartile the current playback position represents. |
| parseVast | Parse a VAST XML string into a VastResponse object. Pure function — no side effects, no network access. |
| playPod | Play all ads in a pod sequentially. Individual failures or skips advance to the next ad. |
| playSingleAd | Play a single ad creative. Returns a Promise that resolves when the ad finishes (completed, skipped, or error), plus an abort function. |
| playWaterfall | Try ads in waterfall order. Play the first one that loads successfully. Returns the result of the first successful ad, or null if all fail. |
| resolveVast | Resolve 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. |
| selectMediaFile | Select the best media file using a multi-factor scoring algorithm. |
| track | Fire-and-forget tracking. Response is ignored. |
| trackCompanionView | Fire creativeView tracking beacons for a companion ad. Call when the companion is actually displayed to the user. |
| trackError | Fire error tracking URLs, replacing the [ERRORCODE] macro with the given code. Per VAST 4.2 Section 2.3.6. |
| trackNonLinear | Fire a tracking event for a NonLinear ad container. Looks up the event name in the container-level trackingEvents. |
| vast | Create a VAST ad plugin for vide. |