npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fnet/vast-vmap

v0.1.2

Published

This project is designed to facilitate the generation of VMAP (Video Multiple Ad Playlist) compliant XML documents using data retrieved from a collection of VAST (Video Ad Serving Template) ad providers. The goal is to enable integration and management of

Downloads

19

Readme

@fnet/vast-vmap

This project is designed to facilitate the generation of VMAP (Video Multiple Ad Playlist) compliant XML documents using data retrieved from a collection of VAST (Video Ad Serving Template) ad providers. The goal is to enable integration and management of multiple video ads into a single VMAP document, which can be utilized to schedule video ad breaks during content playback.

How It Works

The module accepts a configuration object containing a list of VAST providers. When initialized, it processes each provider to construct an ad break within the VMAP document based on the VAST data returned from the providers. The finalized VMAP XML is pretty-printed to ensure it is well-structured and easy to interpret.

Key Features

  • Multiple VAST Provider Support: Accepts an array of VAST providers to generate ad data.
  • Ad Break Construction: Generates ad breaks for each provider with detailed ad sources.
  • Customization: Allows for additional attributes such as the extension of the ad break, which can modify playback characteristics.
  • XML Serialization: Outputs the VMAP as a well-formed, indent-friendly XML document for smooth integration with video players supporting VMAP.

Conclusion

The @fnet/vast-vmap module provides a straightforward solution for creating VMAP documents from multiple VAST ad providers. It is aimed at users who need to integrate multiple video ads efficiently during content playback, ensuring a seamless video ad scheduling experience.

@fnet/vast-vmap Developer Guide

Overview

The @fnet/vast-vmap library is designed to help developers generate VMAP (Video Multiple Ad Playlist) XML data from multiple VAST (Video Ad Serving Template) providers. This allows for seamless integration and management of video ads across different platforms and ad providers. The library focuses on ease of use by providing a straightforward API for creating VMAP documents with support for both direct XML inclusion and ad tag URIs.

Installation

To install the @fnet/vast-vmap library, use either npm or yarn:

Using npm:

npm install @fnet/vast-vmap

Using yarn:

yarn add @fnet/vast-vmap

Usage

The primary functionality of the library is accessible through an asynchronous function titled index. The example below showcases how to initialize the library with a list of providers and retrieve a VMAP XML document.

import VastVmap from '@fnet/vast-vmap';

// Define your VAST providers
const providers = [
  {
    getVAST: async () => ({ type: 'xml', value: '<VAST>...</VAST>' })
  },
  {
    getVAST: async () => ({ type: 'url', value: 'http://example.com/vast.xml' })
  }
];

// Initialize the library with configuration
const vastVmapProcessor = await VastVmap({ providers });

// Retrieve VMAP Data
vastVmapProcessor.getVAST().then(vmap => {
  console.log(vmap); // Outputs the prettified VMAP XML
});

Examples

Here are some examples that illustrate the common use cases:

Example 1: Simple VMAP Generation

Here is how you can create a VMAP XML with two VAST sources, one providing XML directly and the other providing a URL.

import VastVmap from '@fnet/vast-vmap';

const providers = [
  {
    getVAST: async () => ({
      type: 'xml',
      value: '<VAST version="3.0">....</VAST>'
    })
  },
  {
    getVAST: async () => ({
      type: 'url',
      value: 'https://example.com/ad/vast.xml'
    })
  }
];

const vastVmapProcessor = await VastVmap({ providers });

const vmapData = await vastVmapProcessor.getVAST();

console.log(vmapData.value);

Example 2: Complex VMAP with Bumper Suppression

This example illustrates a VMAP with a bumper suppression on the last ad break.

import VastVmap from '@fnet/vast-vmap';

const providers = [
  {
    getVAST: async () => ({ type: 'xml', value: '<VAST>...</VAST>' })
  },
  {
    getVAST: async () => ({ type: 'xml', value: '<VAST>...</VAST>' })
  }
];

const vastVmapProcessor = await VastVmap({ providers });

const vmapData = await vastVmapProcessor.getVAST();

console.log(vmapData.value);

Acknowledgement

This library leverages the simplicity of asynchronous functions in JavaScript to streamline the process of combining VAST data into a standard VMAP format, ensuring a cohesive ad experience across multiple sources.

Input Schema

$schema: https://json-schema.org/draft/2020-12/schema
title: VastConfig
type: object
properties:
  providers:
    type: array
    items:
      type: object
      properties:
        getVAST:
          type: string
required:
  - providers
additionalProperties: false