[go: up one dir, main page]

vpaid-ad

4.0.4 • Public • Published

vpaid-ad

VPAID ad class for extending purposes.

Build Status npm version js-standard-style bitHound Score Greenkeeper badge codecov

This is a reference implementation of VPAID ad. Feel free to extend this to suit your needs. It implements the most basic set of VPAID methods.

Installing using npm

npm i --save vpaid-ad

Usage

You can extend it using this way:

const Linear = require('vpaid-ad/src/linear')
class VpaidAd extends Linear {
  initAd (width, height, viewMode, desiredBitrate, creativeData, environmentVars) {
   // Do something
    super.initAd(
      width,
      height,
      viewMode,
      desiredBitrate,
      creativeData,
      environmentVars
    )
  }
}
 
window.getVPAIDAd = function () {
  return new VpaidAd()
}

Your player can then call:

vpaid = window.getVPAIDAd()
vpaid.subscribe(...)

clickThru

There's a special clickThru method that you can use:

vpaid.clickThru({
  url: 'https://example.com',
  id: 'my-id',
  playerHandles: true
})

The above function emits the parameters as both an object and as an array.

As an array:

["https://example.com", "my-id", true]

As an object:

{
  "url": "https://example.com",
  "id": "my-id",
  "playerHandles": true
}

Resources

Package Sidebar

Install

npm i vpaid-ad

Weekly Downloads

16

Version

4.0.4

License

MIT

Unpacked Size

355 kB

Total Files

39

Last publish

Collaborators

  • kahwee