@fnet/vast-sample
v0.1.4
Published
This project, `@fnet/vast-sample`, is designed to provide sample VAST (Video Ad Serving Template) URLs for testing video ad integrations. It helps developers and testers access pre-configured ad samples to verify video ad implementations within their appl
Downloads
3
Readme
@fnet/vast-sample
This project, @fnet/vast-sample
, is designed to provide sample VAST (Video Ad Serving Template) URLs for testing video ad integrations. It helps developers and testers access pre-configured ad samples to verify video ad implementations within their applications, making the process more efficient and straightforward.
How It Works
The project initializes with default sets of VAST URLs categorized by templates such as 'ima', 'vmap', and 'simid'. Each category contains multiple ad sample URLs. Upon request, it randomly selects and returns one URL from the designated category, allowing users to retrieve VAST ad samples for testing purposes.
Key Features
- Pre-configured VAST URLs: Provides a selection of predefined VAST URLs for various ad scenarios.
- Template-based organization: Categorizes URLs under different templates like 'ima', 'vmap', and 'simid' for easy access.
- Random selection: Selects URLs randomly within a template category to simulate different ad serving scenarios.
Conclusion
@fnet/vast-sample
is a practical tool for developers and testers working with video ad functionalities. By offering easy access to sample VAST URLs, it simplifies the process of ad implementation testing, ensuring that video ads function correctly within applications.
@fnet/vast-sample Developer Guide
Overview
The @fnet/vast-sample library provides developers with a straightforward way to fetch VAST (Video Ad Serving Template) and VMAP (Video Multiple Ad Playlist) ad samples. The core functionality of this library is to supply a variety of ad templates that can be used for testing video and multimedia applications. Through its public API, developers can easily access different types of ad samples by specifying templates.
Installation
To use the @fnet/vast-sample library in your project, you can install it using npm or yarn. Open your terminal and run one of the following commands:
Using npm:
npm install @fnet/vast-sample
Using yarn:
yarn add @fnet/vast-sample
Usage
After installation, you can import the library and use its functionality to retrieve ad samples. The primary method provided by this library is getVAST
, which allows you to obtain a random ad sample URL from a specified template type. Here is how you can use it in your code:
import vastSample from '@fnet/vast-sample';
(async () => {
try {
const ad = await vastSample.getVAST({ template: 'ima' });
console.log(ad.value);
} catch (error) {
console.error('Error fetching ad sample:', error);
}
})();
Examples
Fetching an IMA Ad Sample
import vastSample from '@fnet/vast-sample';
(async () => {
const ad = await vastSample.getVAST({ template: 'ima' });
console.log('IMA Ad URL:', ad.value);
})();
Fetching a VMAP Ad Sample
import vastSample from '@fnet/vast-sample';
(async () => {
const ad = await vastSample.getVAST({ template: 'vmap' });
console.log('VMAP Ad URL:', ad.value);
})();
Fetching a SIMID Ad Sample
import vastSample from '@fnet/vast-sample';
(async () => {
const ad = await vastSample.getVAST({ template: 'simid' });
console.log('SIMID Ad URL:', ad.value);
})();
These examples show how you can access different types of ad samples using the getVAST
function of the @fnet/vast-sample library. Simply specify the desired template type, and the function returns an ad sample URL for use in your applications.
Acknowledgement
This library utilizes sample ad URLs provided by Google DoubleClick. We acknowledge Google's contribution in providing these resources for testing and development purposes.
Input Schema
$schema: https://json-schema.org/draft/2020-12/schema
type: object
properties:
template:
type: string
description: Specifies the template type to be used, defaulting to 'ima'.
required: []